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
This commit is contained in:
David Lawrence Ramsey 2005-06-17 18:27:00 +00:00
parent 077d0647c9
commit ea01474c4b
3 changed files with 31 additions and 25 deletions

View File

@ -102,6 +102,9 @@ CVS code -
- Add rcfile options "casesensitive" and "backwards", to do
case sensitive and backwards searches by default. Changes to
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:
make_mbstring()
- Change erroneous ENABLE_EXTRA #ifdef to NANO_EXTRA to fix a

View File

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

View File

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