From: Chris Allegretta Date: Thu, 13 Feb 2003 03:03:49 +0000 (+0000) Subject: - Change resetpos function to be global (now called resetstatuspos. Fixes annoying... X-Git-Tag: v1.1.99pre3~9 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=65f075d3a1c98ea4d5ff4e76de8156234660fc63;p=nano.git - Change resetpos function to be global (now called resetstatuspos. Fixes annoying but small odd problem with cursor placement when inserting a file. This needs to be done better in 1.3 (originally by David Lawrence Ramsey) Added this issue to TODO git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1459 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index 969d8e78..e5bcc07a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,6 +19,11 @@ CVS code - Remove do_preserve_msg, as using -p still gives Pico-style string behavior, so an annoying message every invocation is probably unneeded (all cheer). + - Change resetpos function to be global (now called + resetstatuspos. Fixes annoying but small odd problem with + cursor placement when inserting a file. This needs to be done + better in 1.3 (originally by David Lawrence Ramsey). + Added this issue to TODO. - files.c: cwd_tab_completion() - Memory leak fix (David Benbennick). diff --git a/TODO b/TODO index 63ba5c1d..f7108053 100644 --- a/TODO +++ b/TODO @@ -25,6 +25,7 @@ For version 1.4: - Make "To line" (^W^T) and "Read from Command" (^R^X) re-enter their parent menu when their keystroke is entered a second time (^W^T^T and (^R^X^X)(requires figuring out when to keep cursor pos and when not to). +- Fix resetstatuspos global which we shouldn't have. Old requests: diff --git a/files.c b/files.c index 9db26dee..6436c7af 100644 --- a/files.c +++ b/files.c @@ -506,6 +506,7 @@ int do_insertfile(int loading_file) if (tmp != NULL) { free(answer); answer = tmp; + resetstatuspos = 1; } else goto start_again; } diff --git a/global.c b/global.c index 4f8e8074..35949778 100644 --- a/global.c +++ b/global.c @@ -69,6 +69,8 @@ char *quotestr = NULL; /* Quote string. The default value is set in main(). */ #endif +int resetstatuspos; /* Hack for resetting the status bar + cursor position */ char *answer = NULL; /* Answer str to many questions */ int totlines = 0; /* Total number of lines in the file */ long totsize = 0; /* Total number of bytes in the file */ diff --git a/proto.h b/proto.h index 4e05653f..aecaa660 100644 --- a/proto.h +++ b/proto.h @@ -65,6 +65,7 @@ extern char *full_operating_dir; extern char *alt_speller; #endif +extern int resetstatuspos; extern struct stat fileinfo; extern filestruct *current, *fileage, *edittop, *editbot, *filebot; extern filestruct *cutbuffer; @@ -437,7 +438,7 @@ int nanogetstr(int allowtabs, char *buf, const char *def, #ifndef DISABLE_TABCOMP , int *list #endif - , int resetpos); + ); void set_modified(void); void titlebar(char *path); void bottombars(const shortcut *s); diff --git a/winio.c b/winio.c index 15eca548..5ffc4c0b 100644 --- a/winio.c +++ b/winio.c @@ -194,7 +194,7 @@ int nanogetstr(int allowtabs, char *buf, const char *def, #ifndef DISABLE_TABCOMP , int *list #endif - , int resetpos) + ) { int kbinput; static int x = -1; @@ -218,7 +218,7 @@ int nanogetstr(int allowtabs, char *buf, const char *def, 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 || resetpos) + if (x == -1 || x > xend || resetstatuspos) x = xend; answer = (char *)nrealloc(answer, xend + 1); @@ -1162,8 +1162,6 @@ int statusq(int tabs, const shortcut *s, const char *def, #ifndef DISABLE_TABCOMP int list = 0; #endif - static int resetpos = 0; /* Do we need to scrap the cursor position - on the statusbar? */ bottombars(s); @@ -1180,22 +1178,22 @@ int statusq(int tabs, const shortcut *s, const char *def, #ifndef DISABLE_TABCOMP , &list #endif - , resetpos); + ); free(foo); - resetpos = 0; + resetstatuspos = 0; switch (ret) { case NANO_FIRSTLINE_KEY: do_first_line(); - resetpos = 1; + resetstatuspos = 1; break; case NANO_LASTLINE_KEY: do_last_line(); - resetpos = 1; + resetstatuspos = 1; break; case NANO_CANCEL_KEY: ret = -1; - resetpos = 1; + resetstatuspos = 1; break; } blank_statusbar();