From ce8623669bbe4a1d6d2e1c3d20c1afa285564c41 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Sun, 21 May 2006 21:23:21 +0000 Subject: [PATCH] handle statusbar blanking in one place instead of many, so that it always works consistently, per Benno Schulenberg's patch (with a few tweaks of mine); also, blank the statusbar after 26 keystrokes instead of 25, for compatibility with Pico git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3541 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 11 +++++++++++ src/browser.c | 2 -- src/cut.c | 4 ---- src/move.c | 32 -------------------------------- src/text.c | 2 -- src/winio.c | 11 ++++++++--- 6 files changed, 19 insertions(+), 43 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8175f2d4..3d5223e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -82,6 +82,14 @@ CVS code - resizes more consistent. Changes to handle_sigwinch(), main(), get_kbinput(), parse_kbinput(), get_byte_kbinput(), and get_unicode_kbinput(); removal of reset_kbinput(). (DLR) + - Handle statusbar blanking in one place instead of many, so + that it always works consistently. Changes to do_browser(), + do_cut_text(), do_uncut_text(), do_first_line(), + do_last_line(), do_page_up(), do_page_down(), do_para_begin(), + do_para_end(), do_para_end(), do_next_word(), do_prev_word(), + do_home(), do_end(), do_up(), do_scroll_up(), do_down(), + do_scroll_down(), do_left(), do_right(), do_indent_marked(), + and get_kbinput(). (Benno Schulenberg, minor tweaks by DLR) - browser.c: do_browser() - Reference NANO_GOTODIR_(ALT|F)?KEY instead of @@ -259,6 +267,9 @@ CVS code - - Properly display double-column characters if they're past the first virtual page and their first column is covered by the "$" displayed at the beginning of the line. (DLR) + statusbar() + - Blank the statusbar after 26 keystrokes instead of 25, for + conpatibility with Pico. (DLR) edit_draw() - Properly ignore zero-length regexes in multi-line regexes as well as single-line ones. This avoids a segfault when trying diff --git a/src/browser.c b/src/browser.c index a3d5cc55..d1b206f5 100644 --- a/src/browser.c +++ b/src/browser.c @@ -100,8 +100,6 @@ char *do_browser(char *path, DIR *dir) MEVENT mevent; #endif - check_statusblank(); - /* Compute the line number we're on now, so that we don't divide * by zero. */ fileline = selected; diff --git a/src/cut.c b/src/cut.c index ff3e399f..94c6f98c 100644 --- a/src/cut.c +++ b/src/cut.c @@ -133,8 +133,6 @@ void do_cut_text( assert(openfile->current != NULL && openfile->current->data != NULL); - check_statusblank(); - /* If keep_cutbuffer is FALSE and the cutbuffer isn't empty, blow * away the text in the cutbuffer. */ if (!keep_cutbuffer && cutbuffer != NULL) { @@ -254,8 +252,6 @@ void do_uncut_text(void) wrap_reset(); #endif - check_statusblank(); - /* If the cutbuffer is empty, get out. */ if (cutbuffer == NULL) return; diff --git a/src/move.c b/src/move.c index ae725a68..da9aaa21 100644 --- a/src/move.c +++ b/src/move.c @@ -32,8 +32,6 @@ void do_first_line(void) const filestruct *current_save = openfile->current; size_t pww_save = openfile->placewewant; - check_statusblank(); - openfile->current = openfile->fileage; openfile->current_x = 0; openfile->placewewant = 0; @@ -47,8 +45,6 @@ void do_last_line(void) const filestruct *current_save = openfile->current; size_t pww_save = openfile->placewewant; - check_statusblank(); - openfile->current = openfile->filebot; openfile->current_x = strlen(openfile->filebot->data); openfile->placewewant = xplustabs(); @@ -62,8 +58,6 @@ void do_page_up(void) { int i; - check_statusblank(); - #ifndef DISABLE_WRAPPING wrap_reset(); #endif @@ -103,8 +97,6 @@ void do_page_down(void) { int i; - check_statusblank(); - #ifndef DISABLE_WRAPPING wrap_reset(); #endif @@ -149,8 +141,6 @@ void do_para_begin(bool allow_update) const filestruct *current_save = openfile->current; const size_t pww_save = openfile->placewewant; - check_statusblank(); - if (openfile->current != openfile->fileage) { do { openfile->current = openfile->current->prev; @@ -183,8 +173,6 @@ void do_para_end(bool allow_update) const filestruct *const current_save = openfile->current; const size_t pww_save = openfile->placewewant; - check_statusblank(); - while (openfile->current != openfile->filebot && !inpar(openfile->current)) openfile->current = openfile->current->next; @@ -233,8 +221,6 @@ bool do_next_word(bool allow_punct, bool allow_update) assert(openfile->current != NULL && openfile->current->data != NULL); - check_statusblank(); - char_mb = charalloc(mb_cur_max()); /* Move forward until we find the character after the last letter of @@ -331,8 +317,6 @@ bool do_prev_word(bool allow_punct, bool allow_update) assert(openfile->current != NULL && openfile->current->data != NULL); - check_statusblank(); - char_mb = charalloc(mb_cur_max()); /* Move backward until we find the character before the first letter @@ -460,8 +444,6 @@ void do_home(void) { size_t pww_save = openfile->placewewant; - check_statusblank(); - #ifndef NANO_TINY if (ISSET(SMART_HOME)) { size_t current_x_save = openfile->current_x; @@ -490,8 +472,6 @@ void do_end(void) { size_t pww_save = openfile->placewewant; - check_statusblank(); - openfile->current_x = strlen(openfile->current->data); openfile->placewewant = xplustabs(); @@ -502,8 +482,6 @@ void do_end(void) /* Move up one line. */ void do_up(void) { - check_statusblank(); - #ifndef DISABLE_WRAPPING wrap_reset(); #endif @@ -542,8 +520,6 @@ void do_up(void) /* Scroll up one line without scrolling the cursor. */ void do_scroll_up(void) { - check_statusblank(); - #ifndef DISABLE_WRAPPING wrap_reset(); #endif @@ -567,8 +543,6 @@ void do_scroll_up(void) /* Move down one line. */ void do_down(void) { - check_statusblank(); - #ifndef DISABLE_WRAPPING wrap_reset(); #endif @@ -607,8 +581,6 @@ void do_down(void) /* Scroll down one line without scrolling the cursor. */ void do_scroll_down(void) { - check_statusblank(); - #ifndef DISABLE_WRAPPING wrap_reset(); #endif @@ -634,8 +606,6 @@ void do_left(void) { size_t pww_save = openfile->placewewant; - check_statusblank(); - if (openfile->current_x > 0) openfile->current_x = move_mbleft(openfile->current->data, openfile->current_x); @@ -655,8 +625,6 @@ void do_right(void) { size_t pww_save = openfile->placewewant; - check_statusblank(); - assert(openfile->current_x <= strlen(openfile->current->data)); if (openfile->current->data[openfile->current_x] != '\0') diff --git a/src/text.c b/src/text.c index e8d98657..6cad7805 100644 --- a/src/text.c +++ b/src/text.c @@ -215,8 +215,6 @@ void do_indent_marked(ssize_t cols) assert(openfile->current != NULL && openfile->current->data != NULL); - check_statusblank(); - /* If the mark isn't on, indicate it on the statusbar and get * out. */ if (!openfile->mark_set) { diff --git a/src/winio.c b/src/winio.c index 412da23f..2381b6f8 100644 --- a/src/winio.c +++ b/src/winio.c @@ -316,6 +316,11 @@ int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key) * we get a recognized value or sequence. */ while ((kbinput = parse_kbinput(win, meta_key, func_key)) == ERR); + /* If we didn't read from the statusbar prompt, blank the statusbar + * if we need to. */ + if (win != bottomwin) + check_statusblank(); + return kbinput; } @@ -2153,13 +2158,13 @@ void statusbar(const char *msg, ...) /* If we're doing quick statusbar blanking, and constant cursor * position display is off, blank the statusbar after only one - * keystroke. Otherwise, blank it after twenty-five keystrokes, - * as Pico does. */ + * keystroke. Otherwise, blank it after twenty-six keystrokes, as + * Pico does. */ statusblank = #ifndef NANO_TINY ISSET(QUICK_BLANK) && !ISSET(CONST_UPDATE) ? 1 : #endif - 25; + 26; } /* Display the shortcut list in s on the last two rows of the bottom -- 2.39.5