From: David Lawrence Ramsey Date: Tue, 5 Oct 2004 02:29:52 +0000 (+0000) Subject: make resetstatuspos static to just statusq() X-Git-Tag: v1.3.5~154 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=4dd723a095ede4eb5167edaff98ea81cfd2fddf5;p=nano.git make resetstatuspos static to just statusq() git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1966 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index 3160a5c6..c9719a9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -161,6 +161,9 @@ CVS code - - Refresh the screen when Ctrl-L is pressed at the statusbar prompt, as Pico does. (DLR) - Always return the key pressed by the user. (DLR) + - Take new parameter reset_x, containing the value of + resetstatuspos, so that resetstatuspos can be a static + variable for just statusq(). (DLR) statusq() - Rework slightly to reset the cursor position when the user hits Enter as well as Cancel. This means that resetstatuspos diff --git a/src/proto.h b/src/proto.h index d2e623e7..c94077e4 100644 --- a/src/proto.h +++ b/src/proto.h @@ -555,7 +555,7 @@ int nanogetstr(int allowtabs, const char *buf, const char *def, #ifndef NANO_SMALL historyheadtype *history_list, #endif - const shortcut *s + const shortcut *s, bool reset_x #ifndef DISABLE_TABCOMP , bool *list #endif diff --git a/src/winio.c b/src/winio.c index fd76353a..9823433b 100644 --- a/src/winio.c +++ b/src/winio.c @@ -33,9 +33,6 @@ static int statusblank = 0; /* Number of keystrokes left after * we call statusbar(), before we * actually blank the statusbar. */ -static bool resetstatuspos = FALSE; - /* Should we reset the statusbar cursor - * position? */ /* Control character compatibility: * @@ -1762,7 +1759,7 @@ int nanogetstr(int allowtabs, const char *buf, const char *def, #ifndef NANO_SMALL historyheadtype *history_list, #endif - const shortcut *s + const shortcut *s, bool reset_x #ifndef DISABLE_TABCOMP , bool *list #endif @@ -1795,11 +1792,12 @@ int nanogetstr(int allowtabs, const char *buf, const char *def, #endif xend = strlen(def); - /* Only put x at the end of the string if it's uninitialized or if - it would be past the end of the string as it is. Otherwise, - leave it alone. This is so the cursor position stays at the same - place if a prompt-changing toggle is pressed. */ - if (x == -1 || x > xend || resetstatuspos) + /* Only put x at the end of the string if it's uninitialized, if it + would be past the end of the string as it is, or if reset_x is + TRUE. Otherwise, leave it alone. This is so the cursor position + stays at the same place if a prompt-changing toggle is + pressed. */ + if (x == -1 || x > xend || reset_x) x = xend; answer = charealloc(answer, xend + 1); @@ -2989,6 +2987,7 @@ int statusq(int allowtabs, const shortcut *s, const char *def, va_list ap; char *foo = charalloc(COLS - 3); int ret; + static bool resetstatuspos = FALSE; #ifndef DISABLE_TABCOMP bool list = FALSE; #endif @@ -3004,7 +3003,7 @@ int statusq(int allowtabs, const shortcut *s, const char *def, #ifndef NANO_SMALL which_history, #endif - s + s, resetstatuspos #ifndef DISABLE_TABCOMP , &list #endif