- 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
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).

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
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:

View File

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

View File

@ -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 */

View File

@ -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);

16
winio.c
View File

@ -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();