screen: rename a variable, because 'disable' sounds too permanent
parent
f1b9ba2781
commit
9d6d5b679a
27
src/winio.c
27
src/winio.c
|
@ -36,7 +36,7 @@ static size_t key_buffer_len = 0;
|
||||||
static int statusblank = 0;
|
static int statusblank = 0;
|
||||||
/* The number of keystrokes left after we call statusbar(),
|
/* The number of keystrokes left after we call statusbar(),
|
||||||
* before we actually blank the statusbar. */
|
* before we actually blank the statusbar. */
|
||||||
static bool disable_cursorpos = FALSE;
|
static bool suppress_cursorpos = FALSE;
|
||||||
/* Should we temporarily disable constant cursor position
|
/* Should we temporarily disable constant cursor position
|
||||||
* display? */
|
* display? */
|
||||||
static bool seen_wide = FALSE;
|
static bool seen_wide = FALSE;
|
||||||
|
@ -2079,7 +2079,7 @@ void titlebar(const char *path)
|
||||||
wnoutrefresh(edit);
|
wnoutrefresh(edit);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Display a message on the statusbar, and set disable_cursorpos to
|
/* Display a message on the statusbar, and set suppress_cursorpos to
|
||||||
* TRUE, so that the message won't be immediately overwritten if
|
* TRUE, so that the message won't be immediately overwritten if
|
||||||
* constant cursor position display is on. */
|
* constant cursor position display is on. */
|
||||||
void statusbar(const char *msg, ...)
|
void statusbar(const char *msg, ...)
|
||||||
|
@ -2133,7 +2133,7 @@ void statusbar(const char *msg, ...)
|
||||||
|
|
||||||
wnoutrefresh(bottomwin);
|
wnoutrefresh(bottomwin);
|
||||||
|
|
||||||
disable_cursorpos = TRUE;
|
suppress_cursorpos = TRUE;
|
||||||
|
|
||||||
/* Push the message to the screen straightaway. */
|
/* Push the message to the screen straightaway. */
|
||||||
doupdate();
|
doupdate();
|
||||||
|
@ -3085,11 +3085,8 @@ void display_main_list(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If constant is TRUE, we display the current cursor position only if
|
/* If constant is TRUE, we display the current cursor position only if
|
||||||
* disable_cursorpos is FALSE. Otherwise, we display it
|
* suppress_cursorpos is FALSE. If constant is FALSE, we display the
|
||||||
* unconditionally and set disable_cursorpos to FALSE. If constant is
|
* position always. In any case we reset suppress_cursorpos to FALSE. */
|
||||||
* TRUE and disable_cursorpos is TRUE, we also set disable_cursorpos to
|
|
||||||
* FALSE, so that we leave the current statusbar alone this time, and
|
|
||||||
* display the current cursor position next time. */
|
|
||||||
void do_cursorpos(bool constant)
|
void do_cursorpos(bool constant)
|
||||||
{
|
{
|
||||||
filestruct *f;
|
filestruct *f;
|
||||||
|
@ -3100,6 +3097,7 @@ void do_cursorpos(bool constant)
|
||||||
|
|
||||||
assert(openfile->fileage != NULL && openfile->current != NULL);
|
assert(openfile->fileage != NULL && openfile->current != NULL);
|
||||||
|
|
||||||
|
/* Determine the size of the file up to the cursor. */
|
||||||
f = openfile->current->next;
|
f = openfile->current->next;
|
||||||
c = openfile->current->data[openfile->current_x];
|
c = openfile->current->data[openfile->current_x];
|
||||||
|
|
||||||
|
@ -3111,13 +3109,14 @@ void do_cursorpos(bool constant)
|
||||||
openfile->current->data[openfile->current_x] = c;
|
openfile->current->data[openfile->current_x] = c;
|
||||||
openfile->current->next = f;
|
openfile->current->next = f;
|
||||||
|
|
||||||
if (constant && disable_cursorpos) {
|
/* If the position needs to be suppressed, don't suppress it next time. */
|
||||||
disable_cursorpos = FALSE;
|
if (suppress_cursorpos) {
|
||||||
return;
|
suppress_cursorpos = FALSE;
|
||||||
|
if (constant)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Display the current cursor position on the statusbar, and set
|
/* Display the current cursor position on the statusbar. */
|
||||||
* disable_cursorpos to FALSE. */
|
|
||||||
linepct = 100 * openfile->current->lineno / openfile->filebot->lineno;
|
linepct = 100 * openfile->current->lineno / openfile->filebot->lineno;
|
||||||
colpct = 100 * cur_xpt / cur_lenpt;
|
colpct = 100 * cur_xpt / cur_lenpt;
|
||||||
charpct = (openfile->totsize == 0) ? 0 : 100 * i / openfile->totsize;
|
charpct = (openfile->totsize == 0) ? 0 : 100 * i / openfile->totsize;
|
||||||
|
@ -3128,8 +3127,6 @@ void do_cursorpos(bool constant)
|
||||||
(long)openfile->filebot->lineno, linepct,
|
(long)openfile->filebot->lineno, linepct,
|
||||||
(unsigned long)cur_xpt, (unsigned long)cur_lenpt, colpct,
|
(unsigned long)cur_xpt, (unsigned long)cur_lenpt, colpct,
|
||||||
(unsigned long)i, (unsigned long)openfile->totsize, charpct);
|
(unsigned long)i, (unsigned long)openfile->totsize, charpct);
|
||||||
|
|
||||||
disable_cursorpos = FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unconditionally display the current cursor position. */
|
/* Unconditionally display the current cursor position. */
|
||||||
|
|
Loading…
Reference in New Issue