1
1

since the SAMELINEWRAP flag is only used in nano.c, convert it to a

static int there and free up space for one more flag; also make a few
misc. cleanups involving #ifdefs


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1549 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
David Lawrence Ramsey 2003-09-10 20:08:00 +00:00
родитель 14509a3aa2
Коммит c97acfb2d6
8 изменённых файлов: 61 добавлений и 30 удалений

Просмотреть файл

@ -33,6 +33,9 @@ CVS code -
NANO_SMALL is defined. (DLR) NANO_SMALL is defined. (DLR)
- Source reorganization: move code to src/, docs to doc/. (Jordi) - Source reorganization: move code to src/, docs to doc/. (Jordi)
- Translation updates (see po/ChangeLog for details). - Translation updates (see po/ChangeLog for details).
- Since SAMELINEWRAP is only used in nano.c, make it a static
variable in nano.c instead of a flag, and surround all
wrap_reset() calls with DISABLE_WRAPPING #ifdefs. (DLR)
- files.c: - files.c:
do_browser() do_browser()
- Some of the Pico compatibility options in the file browser - Some of the Pico compatibility options in the file browser
@ -80,6 +83,10 @@ CVS code -
page_up() page_up()
- Removed due to rewrite of movement functions. (David - Removed due to rewrite of movement functions. (David
Benbennick) Benbennick)
- proto.h:
- Surround the do_prev_word() and do_next_word() prototypes with
NANO_SMALL #ifdefs, since the actual functions aren't included
in tiny mode. (DLR)
- rcfile.c: - rcfile.c:
parse_colors() parse_colors()
- Generate an error if we try to use a bright background color - Generate an error if we try to use a bright background color

Просмотреть файл

@ -322,7 +322,9 @@ int do_uncut_text(void)
filestruct *hold = current; filestruct *hold = current;
int i; int i;
#ifndef DISABLE_WRAPPING
wrap_reset(); wrap_reset();
#endif
check_statblank(); check_statblank();
if (cutbuffer == NULL || fileptr == NULL) if (cutbuffer == NULL || fileptr == NULL)
return 0; /* AIEEEEEEEEEEEE */ return 0; /* AIEEEEEEEEEEEE */

Просмотреть файл

@ -427,7 +427,9 @@ int do_insertfile(int loading_file)
inspath[0] = '\0'; inspath[0] = '\0';
} }
#ifndef DISABLE_WRAPPING
wrap_reset(); wrap_reset();
#endif
#if !defined(DISABLE_BROWSER) || !defined(NANO_SMALL) && defined(ENABLE_MULTIBUFFER) #if !defined(DISABLE_BROWSER) || !defined(NANO_SMALL) && defined(ENABLE_MULTIBUFFER)
start_again: /* Goto here when the user cancels the file browser. */ start_again: /* Goto here when the user cancels the file browser. */

Просмотреть файл

@ -49,7 +49,9 @@ int do_page_up(void)
{ {
int i; int i;
#ifndef DISABLE_WRAPPING
wrap_reset(); wrap_reset();
#endif
/* If edittop is the first line of the file, move current up there /* If edittop is the first line of the file, move current up there
* and put the cursor at the beginning of the line. */ * and put the cursor at the beginning of the line. */
@ -91,7 +93,9 @@ int do_page_down(void)
{ {
int i; int i;
#ifndef DISABLE_WRAPPING
wrap_reset(); wrap_reset();
#endif
/* If the last line of the file is onscreen, move current down /* If the last line of the file is onscreen, move current down
* there and put the cursor at the beginning of the line. */ * there and put the cursor at the beginning of the line. */
@ -131,7 +135,9 @@ int do_page_down(void)
int do_up(void) int do_up(void)
{ {
#ifndef DISABLE_WRAPPING
wrap_reset(); wrap_reset();
#endif
check_statblank(); check_statblank();
if (current->prev == NULL) if (current->prev == NULL)
@ -159,7 +165,9 @@ int do_up(void)
* bottom. */ * bottom. */
int do_down(void) int do_down(void)
{ {
#ifndef DISABLE_WRAPPING
wrap_reset(); wrap_reset();
#endif
check_statblank(); check_statblank();
if (current->next == NULL) if (current->next == NULL)

Просмотреть файл

@ -57,6 +57,10 @@
#ifndef DISABLE_WRAPJUSTIFY #ifndef DISABLE_WRAPJUSTIFY
static int fill = 0; /* Fill - where to wrap lines, basically */ static int fill = 0; /* Fill - where to wrap lines, basically */
#endif #endif
#ifndef DISABLE_WRAPPING
static int same_line_wrap = 0; /* Whether wrapped text should be
prepended to the next line */
#endif
static struct termios oldterm; /* The user's original term settings */ static struct termios oldterm; /* The user's original term settings */
static struct sigaction act; /* For all our fun signal handlers */ static struct sigaction act; /* For all our fun signal handlers */
@ -1299,10 +1303,12 @@ int do_mark(void)
return 1; return 1;
} }
#ifndef DISABLE_WRAPPING
void wrap_reset(void) void wrap_reset(void)
{ {
UNSET(SAMELINEWRAP); same_line_wrap = 0;
} }
#endif
#ifndef DISABLE_WRAPPING #ifndef DISABLE_WRAPPING
/* We wrap the given line. Precondition: we assume the cursor has been /* We wrap the given line. Precondition: we assume the cursor has been
@ -1387,7 +1393,7 @@ int do_wrap(filestruct *inptr)
/* We prepend the wrapped text to the next line, if the flag is set, /* We prepend the wrapped text to the next line, if the flag is set,
* and there is a next line, and prepending would not make the line * and there is a next line, and prepending would not make the line
* too long. */ * too long. */
if (ISSET(SAMELINEWRAP) && inptr->next) { if (same_line_wrap && inptr->next) {
wrap_line = inptr->next->data; wrap_line = inptr->next->data;
wrap_line_len = strlen(wrap_line); wrap_line_len = strlen(wrap_line);
@ -1465,7 +1471,7 @@ int do_wrap(filestruct *inptr)
* other sundry things. */ * other sundry things. */
/* later wraps of this line will be prepended to the next line. */ /* later wraps of this line will be prepended to the next line. */
SET(SAMELINEWRAP); same_line_wrap = 1;
/* Each line knows its line number. We recalculate these if we /* Each line knows its line number. We recalculate these if we
* inserted a new line. */ * inserted a new line. */

Просмотреть файл

@ -40,11 +40,12 @@
#endif #endif
#ifndef NANO_SMALL #ifndef NANO_SMALL
/* For the backup file copy ... */ /* For the backup file copy ... */
# define COPYFILEBLOCKSIZE 1024 #define COPYFILEBLOCKSIZE 1024
#endif #endif
#ifdef USE_SLANG /* Slang support enabled */ #ifdef USE_SLANG
/* Slang support enabled */
#include <slcurses.h> #include <slcurses.h>
#define KEY_DC SL_KEY_DELETE #define KEY_DC SL_KEY_DELETE
#define KEY_IC SL_KEY_IC #define KEY_IC SL_KEY_IC
@ -53,7 +54,7 @@
#elif defined(HAVE_NCURSES_H) #elif defined(HAVE_NCURSES_H)
#include <ncurses.h> #include <ncurses.h>
#else /* Uh oh */ #else /* Uh oh */
#include <curses.h> #include <curses.h>
#endif /* CURSES_H */ #endif /* CURSES_H */
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
@ -233,28 +234,27 @@ typedef struct historyheadtype {
#define SUSPEND (1<<7) #define SUSPEND (1<<7)
#define NO_WRAP (1<<8) #define NO_WRAP (1<<8)
#define AUTOINDENT (1<<9) #define AUTOINDENT (1<<9)
#define SAMELINEWRAP (1<<10) #define VIEW_MODE (1<<10)
#define VIEW_MODE (1<<11) #define USE_MOUSE (1<<11)
#define USE_MOUSE (1<<12) #define USE_REGEXP (1<<12)
#define USE_REGEXP (1<<13) #define REGEXP_COMPILED (1<<13)
#define REGEXP_COMPILED (1<<14) #define TEMP_OPT (1<<14)
#define TEMP_OPT (1<<15) #define CUT_TO_END (1<<15)
#define CUT_TO_END (1<<16) #define REVERSE_SEARCH (1<<16)
#define REVERSE_SEARCH (1<<17) #define MULTIBUFFER (1<<17)
#define MULTIBUFFER (1<<18) #define DOS_FILE (1<<18)
#define DOS_FILE (1<<19) #define MAC_FILE (1<<19)
#define MAC_FILE (1<<20) #define SMOOTHSCROLL (1<<20)
#define SMOOTHSCROLL (1<<21) #define DISABLE_CURPOS (1<<21) /* Damn, we still need it */
#define DISABLE_CURPOS (1<<22) /* Damn, we still need it */ #define REBIND_DELETE (1<<22)
#define REBIND_DELETE (1<<23) #define NO_CONVERT (1<<23)
#define NO_CONVERT (1<<24) #define BACKUP_FILE (1<<24)
#define BACKUP_FILE (1<<25) #define NO_RCFILE (1<<25)
#define NO_RCFILE (1<<26) #define COLOR_SYNTAX (1<<26)
#define COLOR_SYNTAX (1<<27) #define PRESERVE (1<<27)
#define PRESERVE (1<<28) #define HISTORY_CHANGED (1<<28)
#define HISTORY_CHANGED (1<<29) #define HISTORYLOG (1<<29)
#define HISTORYLOG (1<<30) #define JUSTIFY_MODE (1<<30)
#define JUSTIFY_MODE (1<<31)
/* Control key sequences, changing these would be very very bad */ /* Control key sequences, changing these would be very very bad */

Просмотреть файл

@ -274,11 +274,13 @@ int do_backspace(void);
int do_delete(void); int do_delete(void);
int do_tab(void); int do_tab(void);
int do_enter(void); int do_enter(void);
#ifndef NANO_SMALL
int do_next_word(void); int do_next_word(void);
int do_prev_word(void); int do_prev_word(void);
#endif
int do_mark(void); int do_mark(void);
void wrap_reset(void);
#ifndef DISABLE_WRAPPING #ifndef DISABLE_WRAPPING
void wrap_reset(void);
int do_wrap(filestruct *inptr); int do_wrap(filestruct *inptr);
#endif #endif
#ifndef DISABLE_SPELLER #ifndef DISABLE_SPELLER

Просмотреть файл

@ -385,7 +385,9 @@ int do_search(void)
filestruct *fileptr = current, *didfind; filestruct *fileptr = current, *didfind;
int fileptr_x = current_x; int fileptr_x = current_x;
#ifndef DISABLE_WRAPPING
wrap_reset(); wrap_reset();
#endif
i = search_init(0); i = search_init(0);
switch (i) { switch (i) {
case -1: case -1:
@ -439,7 +441,9 @@ int do_research(void)
const char *regex_error = _("Invalid regex \"%s\""); const char *regex_error = _("Invalid regex \"%s\"");
#endif /* HAVE_REGEX_H */ #endif /* HAVE_REGEX_H */
#ifndef DISABLE_WRAPPING
wrap_reset(); wrap_reset();
#endif
search_init_globals(); search_init_globals();
if (last_search[0] != '\0') { if (last_search[0] != '\0') {