#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
* 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? */
* in the statusbar. */
}
- SET(DISABLE_CURPOS);
+ disable_cursorpos = TRUE;
statusblank = 25;
}
/* 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;
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;
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;