1
1

since the DISABLE_CURPOS flag is only used in winio.c, reduce it to a

static bool there


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2707 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
David Lawrence Ramsey 2005-06-17 18:27:00 +00:00
родитель 077d0647c9
Коммит ea01474c4b
3 изменённых файлов: 31 добавлений и 25 удалений

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

@ -102,6 +102,9 @@ CVS code -
- Add rcfile options "casesensitive" and "backwards", to do - Add rcfile options "casesensitive" and "backwards", to do
case sensitive and backwards searches by default. Changes to case sensitive and backwards searches by default. Changes to
nanorc.sample and nanorc.5. (DLR) nanorc.sample and nanorc.5. (DLR)
- Since the DISABLE_CURPOS flag is only used in winio.c, reduce
it to a static bool there. Changes to statusbar() and
disable_cursorpos(). (DLR)
- chars.c: - chars.c:
make_mbstring() make_mbstring()
- Change erroneous ENABLE_EXTRA #ifdef to NANO_EXTRA to fix a - Change erroneous ENABLE_EXTRA #ifdef to NANO_EXTRA to fix a

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

@ -291,20 +291,19 @@ typedef struct syntaxtype {
#define BACKWARDS_SEARCH (1<<14) #define BACKWARDS_SEARCH (1<<14)
#define MULTIBUFFER (1<<15) #define MULTIBUFFER (1<<15)
#define SMOOTH_SCROLL (1<<16) #define SMOOTH_SCROLL (1<<16)
#define DISABLE_CURPOS (1<<17) /* Damn, we still need it. */ #define REBIND_DELETE (1<<17)
#define REBIND_DELETE (1<<18) #define NO_CONVERT (1<<18)
#define NO_CONVERT (1<<19) #define BACKUP_FILE (1<<19)
#define BACKUP_FILE (1<<20) #define NO_RCFILE (1<<20)
#define NO_RCFILE (1<<21) #define NO_COLOR_SYNTAX (1<<21)
#define NO_COLOR_SYNTAX (1<<22) #define PRESERVE (1<<22)
#define PRESERVE (1<<23) #define HISTORYLOG (1<<23)
#define HISTORYLOG (1<<24) #define RESTRICTED (1<<24)
#define RESTRICTED (1<<25) #define SMART_HOME (1<<25)
#define SMART_HOME (1<<26) #define WHITESPACE_DISPLAY (1<<26)
#define WHITESPACE_DISPLAY (1<<27) #define MORE_SPACE (1<<27)
#define MORE_SPACE (1<<28) #define TABS_TO_SPACES (1<<28)
#define TABS_TO_SPACES (1<<29) #define USE_UTF8 (1<<29)
#define USE_UTF8 (1<<30)
/* Control key sequences. Changing these would be very, very bad. */ /* Control key sequences. Changing these would be very, very bad. */
#define NANO_CONTROL_SPACE 0 #define NANO_CONTROL_SPACE 0

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

@ -44,6 +44,9 @@ static int statusblank = 0; /* The number of keystrokes left after
* actually blank the statusbar. */ * actually blank the statusbar. */
static size_t statusbar_x = (size_t)-1; static size_t statusbar_x = (size_t)-1;
/* The cursor position in answer. */ /* The cursor position in answer. */
static bool disable_cursorpos = FALSE;
/* Should we temporarily disable
* constant cursor position display? */
static bool resetstatuspos = FALSE; static bool resetstatuspos = FALSE;
/* Should we reset the cursor position /* Should we reset the cursor position
* at the statusbar prompt? */ * at the statusbar prompt? */
@ -2889,7 +2892,7 @@ void statusbar(const char *msg, ...)
* in the statusbar. */ * in the statusbar. */
} }
SET(DISABLE_CURPOS); disable_cursorpos = TRUE;
statusblank = 25; statusblank = 25;
} }
@ -3712,11 +3715,11 @@ void display_main_list(void)
/* If constant is FALSE, the user typed Ctrl-C, so we unconditionally /* If constant is FALSE, the user typed Ctrl-C, so we unconditionally
* display the cursor position. Otherwise, we display it only if the * display the cursor position. Otherwise, we display it only if the
* character position changed and DISABLE_CURPOS is not set. * character position changed and disable_cursorpos is FALSE.
* *
* If constant is TRUE and DISABLE_CURPOS is set, we unset it and update * If constant is TRUE and disable_cursorpos is TRUE, we set the latter
* old_i and old_totsize. That way, we leave the current statusbar * to FALSE and update old_i and old_totsize. That way, we leave the
* alone, but next time we will display. */ * current statusbar alone, but next time we will display. */
void do_cursorpos(bool constant) void do_cursorpos(bool constant)
{ {
char c; char c;
@ -3737,20 +3740,21 @@ void do_cursorpos(bool constant)
current->data[current_x] = c; current->data[current_x] = c;
current->next = f; current->next = f;
/* Check whether totsize is correct. Else there is a bug /* Check whether totsize is correct. If it isn't, there is a bug
* somewhere. */ * somewhere. */
assert(current != filebot || i == totsize); assert(current != filebot || i == totsize);
if (constant && ISSET(DISABLE_CURPOS)) { if (constant && disable_cursorpos) {
UNSET(DISABLE_CURPOS); disable_cursorpos = FALSE;
old_i = i; old_i = i;
old_totsize = totsize; old_totsize = totsize;
return; return;
} }
/* If constant is FALSE, display the position on the statusbar /* If constant is FALSE, display the position on the statusbar
* unconditionally; otherwise, only display the position when the * unconditionally. Otherwise, only display the position when the
* character values have changed. */ * character values have changed. Finally, if disable_cursorpos is
* TRUE, set it to FALSE. */
if (!constant || old_i != i || old_totsize != totsize) { if (!constant || old_i != i || old_totsize != totsize) {
size_t xpt = xplustabs() + 1; size_t xpt = xplustabs() + 1;
size_t cur_len = strlenpt(current->data) + 1; size_t cur_len = strlenpt(current->data) + 1;
@ -3763,7 +3767,7 @@ void do_cursorpos(bool constant)
current->lineno, totlines, linepct, current->lineno, totlines, linepct,
(unsigned long)xpt, (unsigned long)cur_len, colpct, (unsigned long)xpt, (unsigned long)cur_len, colpct,
(unsigned long)i, (unsigned long)totsize, bytepct); (unsigned long)i, (unsigned long)totsize, bytepct);
UNSET(DISABLE_CURPOS); disable_cursorpos = FALSE;
} }
old_i = i; old_i = i;