nano

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

commit 045d130cfabef696dc4f3c9d46d2fd2c9177600a
parent 31b159c1b306311e2b7ec9d74683524ef33f17b9
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date:   Thu, 26 May 2005 05:27:19 +0000

really fix one of the last fixes


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

Diffstat:
Msrc/winio.c | 18+++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/winio.c b/src/winio.c @@ -2441,7 +2441,7 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *curranswer, { int kbinput; bool meta_key, func_key, s_or_t, ran_func, finished; - size_t answer_len = strlen(curranswer); + size_t curranswer_len = strlen(curranswer); #ifndef DISABLE_TABCOMP bool tabbed = FALSE; /* Whether we've pressed Tab more than once consecutively. */ @@ -2455,16 +2455,16 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *curranswer, * any. */ #endif + answer = mallocstrcpy(answer, curranswer); + /* Only put statusbar_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 resetstatuspos 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 (statusbar_x == (size_t)-1 || statusbar_x > answer_len || + * uninitialized, if it would be past the end of curranswer, or if + * resetstatuspos 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 (statusbar_x == (size_t)-1 || statusbar_x > curranswer_len || resetstatuspos) - statusbar_x = answer_len; - - answer = mallocstrcpy(answer, curranswer); + statusbar_x = curranswer_len; currshortcut = s;