nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 4dd723a095ede4eb5167edaff98ea81cfd2fddf5
parent d532f197b0997aaa9e09072264d4175d94529850
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date:   Tue,  5 Oct 2004 02:29:52 +0000

make resetstatuspos static to just statusq()


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1966 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

Diffstat:
MChangeLog | 3+++
Msrc/proto.h | 2+-
Msrc/winio.c | 19+++++++++----------
3 files changed, 13 insertions(+), 11 deletions(-)

diff --git 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 @@ -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 @@ -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