commit 07ebba5e99176470575d6a754bc05be2d81c4186
parent 9e6e1ebe58d04f948433b31f44c03fea2aec93be
Author: Benno Schulenberg <bensberg@justemail.net>
Date: Thu, 23 Feb 2017 18:31:36 +0100
tweaks: rename a variable and invert its logic
Diffstat:
4 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/src/nano.c b/src/nano.c
@@ -2671,7 +2671,7 @@ int main(int argc, char **argv)
/* Update the displayed current cursor position only when there
* are no keys waiting in the input buffer. */
if (ISSET(CONST_UPDATE) && get_key_buffer_len() == 0)
- do_cursorpos(TRUE);
+ do_cursorpos(FALSE);
/* Refresh just the cursor position or the entire edit window. */
if (!refresh_needed) {
diff --git a/src/proto.h b/src/proto.h
@@ -756,7 +756,7 @@ void adjust_viewport(update_type location);
void total_redraw(void);
void total_refresh(void);
void display_main_list(void);
-void do_cursorpos(bool constant);
+void do_cursorpos(bool force);
void do_cursorpos_void(void);
void spotlight(bool active, const char *word);
void xon_complaint(void);
diff --git a/src/text.c b/src/text.c
@@ -2510,7 +2510,7 @@ void do_justify(bool full_justify)
/* If needed, unset the cursor-position suppression flag, so the cursor
* position /will/ be displayed upon a return to the main loop. */
if (ISSET(CONST_UPDATE))
- do_cursorpos(TRUE);
+ do_cursorpos(FALSE);
func = func_from_key(&kbinput);
@@ -3664,11 +3664,9 @@ void do_verbatim_input(void)
/* Read in all the verbatim characters. */
kbinput = get_verbatim_kbinput(edit, &kbinput_len);
- /* If constant cursor position display is on, make sure the current
- * cursor position will be properly displayed on the statusbar.
- * Otherwise, blank the statusbar. */
+ /* Unsuppress cursor-position display or blank the statusbar. */
if (ISSET(CONST_UPDATE))
- do_cursorpos(TRUE);
+ do_cursorpos(FALSE);
else {
blank_statusbar();
wnoutrefresh(bottomwin);
diff --git a/src/winio.c b/src/winio.c
@@ -3032,10 +3032,10 @@ void display_main_list(void)
bottombars(MMAIN);
}
-/* If constant is TRUE, we display the current cursor position only if
- * suppress_cursorpos is FALSE. If constant is FALSE, we display the
- * position always. In any case we reset suppress_cursorpos to FALSE. */
-void do_cursorpos(bool constant)
+/* Show info about the current cursor position on the statusbar.
+ * Do this unconditionally when force is TRUE; otherwise, only if
+ * suppress_cursorpos is FALSE. In any case, reset the latter. */
+void do_cursorpos(bool force)
{
char saved_byte;
size_t sum, cur_xpt = xplustabs() + 1;
@@ -3056,8 +3056,8 @@ void do_cursorpos(bool constant)
if (openfile->current != openfile->filebot)
sum--;
- /* If the position needs to be suppressed, don't suppress it next time. */
- if (suppress_cursorpos && constant) {
+ /* If the showing needs to be suppressed, don't suppress it next time. */
+ if (suppress_cursorpos && !force) {
suppress_cursorpos = FALSE;
return;
}
@@ -3081,7 +3081,7 @@ void do_cursorpos(bool constant)
/* Unconditionally display the current cursor position. */
void do_cursorpos_void(void)
{
- do_cursorpos(FALSE);
+ do_cursorpos(TRUE);
}
void enable_nodelay(void)