- 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
master
Chris Allegretta 2003-02-13 03:03:49 +00:00
parent bcc8688a3b
commit 65f075d3a1
6 changed files with 18 additions and 10 deletions

View File

@ -19,6 +19,11 @@ CVS code
- Remove do_preserve_msg, as using -p still gives Pico-style - Remove do_preserve_msg, as using -p still gives Pico-style
string behavior, so an annoying message every invocation is string behavior, so an annoying message every invocation is
probably unneeded (all cheer). 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: - files.c:
cwd_tab_completion() cwd_tab_completion()
- Memory leak fix (David Benbennick). - Memory leak fix (David Benbennick).

1
TODO
View File

@ -25,6 +25,7 @@ For version 1.4:
- Make "To line" (^W^T) and "Read from Command" (^R^X) re-enter their - 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 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). (^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: Old requests:

View File

@ -506,6 +506,7 @@ int do_insertfile(int loading_file)
if (tmp != NULL) { if (tmp != NULL) {
free(answer); free(answer);
answer = tmp; answer = tmp;
resetstatuspos = 1;
} else } else
goto start_again; goto start_again;
} }

View File

@ -69,6 +69,8 @@ char *quotestr = NULL; /* Quote string. The default value is
set in main(). */ set in main(). */
#endif #endif
int resetstatuspos; /* Hack for resetting the status bar
cursor position */
char *answer = NULL; /* Answer str to many questions */ char *answer = NULL; /* Answer str to many questions */
int totlines = 0; /* Total number of lines in the file */ int totlines = 0; /* Total number of lines in the file */
long totsize = 0; /* Total number of bytes in the file */ long totsize = 0; /* Total number of bytes in the file */

View File

@ -65,6 +65,7 @@ extern char *full_operating_dir;
extern char *alt_speller; extern char *alt_speller;
#endif #endif
extern int resetstatuspos;
extern struct stat fileinfo; extern struct stat fileinfo;
extern filestruct *current, *fileage, *edittop, *editbot, *filebot; extern filestruct *current, *fileage, *edittop, *editbot, *filebot;
extern filestruct *cutbuffer; extern filestruct *cutbuffer;
@ -437,7 +438,7 @@ int nanogetstr(int allowtabs, 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(char *path); void titlebar(char *path);
void bottombars(const shortcut *s); void bottombars(const shortcut *s);

16
winio.c
View File

@ -194,7 +194,7 @@ int nanogetstr(int allowtabs, 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, 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 || resetpos) if (x == -1 || x > xend || resetstatuspos)
x = xend; x = xend;
answer = (char *)nrealloc(answer, xend + 1); answer = (char *)nrealloc(answer, xend + 1);
@ -1162,8 +1162,6 @@ 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);
@ -1180,22 +1178,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; resetstatuspos = 0;
switch (ret) { switch (ret) {
case NANO_FIRSTLINE_KEY: case NANO_FIRSTLINE_KEY:
do_first_line(); do_first_line();
resetpos = 1; resetstatuspos = 1;
break; break;
case NANO_LASTLINE_KEY: case NANO_LASTLINE_KEY:
do_last_line(); do_last_line();
resetpos = 1; resetstatuspos = 1;
break; break;
case NANO_CANCEL_KEY: case NANO_CANCEL_KEY:
ret = -1; ret = -1;
resetpos = 1; resetstatuspos = 1;
break; break;
} }
blank_statusbar(); blank_statusbar();