Commit 47fcfe5d authored by Chris Allegretta's avatar Chris Allegretta
Browse files

- Fix cursor position being saved when escaping out of nanogetstr with keys...

- Fix cursor position being saved when escaping out of nanogetstr with keys like ^Y and ^V.  New arg resetpos to nanogetstr(), added static int resetpos in statusq() (bug found by DLR)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1399 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
parent 8a85aa0b
Showing with 14 additions and 4 deletions
+14 -4
...@@ -8,6 +8,10 @@ CVS Code - ...@@ -8,6 +8,10 @@ CVS Code -
- Fix subexpression replacement to work consistently. - Fix subexpression replacement to work consistently.
Affects search.c:replace_regexp() and Affects search.c:replace_regexp() and
utils.c:strstrwrapper() (David Benbennick). utils.c:strstrwrapper() (David Benbennick).
- Fix cursor position being saved when escaping out
of nanogetstr with keys like ^Y and ^V. New arg
resetpos to nanogetstr(), added static int
resetpos in statusq() (bug found by DLR).
- cut.c: - cut.c:
do_cut_text() do_cut_text()
- Fix incorrect cursor location when cutting long lines - Fix incorrect cursor location when cutting long lines
......
...@@ -425,7 +425,7 @@ int nanogetstr(int allowtabs, const char *buf, const char *def, ...@@ -425,7 +425,7 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
#ifndef DISABLE_TABCOMP #ifndef DISABLE_TABCOMP
, int *list , int *list
#endif #endif
); , int resetpos);
void set_modified(void); void set_modified(void);
void titlebar(const char *path); void titlebar(const char *path);
void bottombars(const shortcut *s); void bottombars(const shortcut *s);
......
...@@ -194,7 +194,7 @@ int nanogetstr(int allowtabs, const char *buf, const char *def, ...@@ -194,7 +194,7 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
#ifndef DISABLE_TABCOMP #ifndef DISABLE_TABCOMP
, int *list , int *list
#endif #endif
) , int resetpos)
{ {
int kbinput; int kbinput;
static int x = -1; static int x = -1;
...@@ -218,7 +218,7 @@ int nanogetstr(int allowtabs, const char *buf, const char *def, ...@@ -218,7 +218,7 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
it would be past the end of the string as it is. Otherwise, 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 leave it alone. This is so the cursor position stays at the same
place if a prompt-changing toggle is pressed. */ place if a prompt-changing toggle is pressed. */
if (x == -1 || x > xend) if (x == -1 || x > xend || resetpos)
x = xend; x = xend;
answer = (char *)nrealloc(answer, xend + 1); answer = (char *)nrealloc(answer, xend + 1);
...@@ -1175,6 +1175,8 @@ int statusq(int tabs, const shortcut *s, const char *def, ...@@ -1175,6 +1175,8 @@ int statusq(int tabs, const shortcut *s, const char *def,
#ifndef DISABLE_TABCOMP #ifndef DISABLE_TABCOMP
int list = 0; int list = 0;
#endif #endif
static int resetpos = 0; /* Do we need to scrap the cursor position
on the statusbar? */
bottombars(s); bottombars(s);
...@@ -1191,18 +1193,22 @@ int statusq(int tabs, const shortcut *s, const char *def, ...@@ -1191,18 +1193,22 @@ int statusq(int tabs, const shortcut *s, const char *def,
#ifndef DISABLE_TABCOMP #ifndef DISABLE_TABCOMP
, &list , &list
#endif #endif
); , resetpos);
free(foo); free(foo);
resetpos = 0;
switch (ret) { switch (ret) {
case NANO_FIRSTLINE_KEY: case NANO_FIRSTLINE_KEY:
do_first_line(); do_first_line();
resetpos = 1;
break; break;
case NANO_LASTLINE_KEY: case NANO_LASTLINE_KEY:
do_last_line(); do_last_line();
resetpos = 1;
break; break;
case NANO_CANCEL_KEY: case NANO_CANCEL_KEY:
ret = -1; ret = -1;
resetpos = 1;
break; break;
default: default:
blank_statusbar(); blank_statusbar();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment