Fixed 2 FIXMEs in nano.c:
do_enter: the reset_cursor was needed. code cleaned up a bit with a comment explaining the situation there. do_justify: the second edit_refresh exposed a bug in how we were updateing editbot when we needed to rebuild it. This functionality has been moved into winio.c:fix_editbot, and all places that were doing so that I could find have been updated. (files.c: do_insertfile, nano.c: handle_sigwinch and do_justify) git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@64 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
48fd2cb833
commit
dd53ec2a87
5
files.c
5
files.c
|
@ -252,10 +252,7 @@ int do_insertfile(void)
|
||||||
set_modified();
|
set_modified();
|
||||||
|
|
||||||
/* Here we want to rebuild the edit window */
|
/* Here we want to rebuild the edit window */
|
||||||
for (i = 0, editbot = edittop;
|
fix_editbot();
|
||||||
i <= editwinrows - 1
|
|
||||||
&& i <= totlines
|
|
||||||
&& editbot->next != NULL; editbot = editbot->next, i++);
|
|
||||||
|
|
||||||
/* If we've gone off the bottom, recenter, otherwise just redraw */
|
/* If we've gone off the bottom, recenter, otherwise just redraw */
|
||||||
if (current->lineno > editbot->lineno)
|
if (current->lineno > editbot->lineno)
|
||||||
|
|
30
nano.c
30
nano.c
|
@ -502,19 +502,24 @@ int do_enter(filestruct * inptr)
|
||||||
current = new;
|
current = new;
|
||||||
align(¤t->data);
|
align(¤t->data);
|
||||||
|
|
||||||
|
/* The logic here is as follows:
|
||||||
|
* -> If we are at the bottom of the buffer, we want to recenter
|
||||||
|
* (read: rebuild) the screen and forcably move the cursor.
|
||||||
|
* -> otherwise, we want simply to redraw the screen and update
|
||||||
|
* where we think the cursor is.
|
||||||
|
*/
|
||||||
if (current_y == editwinrows - 1) {
|
if (current_y == editwinrows - 1) {
|
||||||
edit_update(current);
|
edit_update(current);
|
||||||
|
|
||||||
/* FIXME - figure out why the hell this is needed =) */
|
|
||||||
reset_cursor();
|
reset_cursor();
|
||||||
} else
|
} else {
|
||||||
current_y++;
|
current_y++;
|
||||||
|
edit_refresh();
|
||||||
|
update_cursor();
|
||||||
|
}
|
||||||
|
|
||||||
totlines++;
|
totlines++;
|
||||||
set_modified();
|
set_modified();
|
||||||
|
|
||||||
update_cursor();
|
|
||||||
edit_refresh();
|
|
||||||
placewewant = xplustabs();
|
placewewant = xplustabs();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1018,7 +1023,6 @@ void exit_spell(char *tmpfilename, char *foo)
|
||||||
* This is Chris' very ugly spell function. Someone please make this
|
* This is Chris' very ugly spell function. Someone please make this
|
||||||
* better =-)
|
* better =-)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int do_spell(void)
|
int do_spell(void)
|
||||||
{
|
{
|
||||||
#ifdef NANO_SMALL
|
#ifdef NANO_SMALL
|
||||||
|
@ -1226,11 +1230,7 @@ void handle_sigwinch(int s)
|
||||||
#endif /* HAVE_WRESIZE */
|
#endif /* HAVE_WRESIZE */
|
||||||
#endif /* HAVE_NCURSES_H */
|
#endif /* HAVE_NCURSES_H */
|
||||||
|
|
||||||
editbot = edittop;
|
fix_editbot();
|
||||||
|
|
||||||
for (i = 0; (i <= editwinrows - 1) && (editbot->next != NULL)
|
|
||||||
&& (editbot->next != filebot); i++)
|
|
||||||
editbot = editbot->next;
|
|
||||||
|
|
||||||
if (current_y > editwinrows - 1) {
|
if (current_y > editwinrows - 1) {
|
||||||
edit_update(editbot);
|
edit_update(editbot);
|
||||||
|
@ -1428,17 +1428,11 @@ int do_justify(void)
|
||||||
edit_update(current);
|
edit_update(current);
|
||||||
center_cursor();
|
center_cursor();
|
||||||
} else {
|
} else {
|
||||||
int i = 0;
|
fix_editbot();
|
||||||
|
|
||||||
editbot = edittop;
|
|
||||||
for (i = 0; (i <= editwinrows - 1) && (editbot->next != NULL)
|
|
||||||
&& (editbot->next != filebot); i++)
|
|
||||||
editbot = editbot->next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
edit_refresh();
|
edit_refresh();
|
||||||
edit_refresh(); /* XXX FIXME XXX */
|
|
||||||
statusbar("Justify Complete");
|
statusbar("Justify Complete");
|
||||||
return 1;
|
return 1;
|
||||||
#else
|
#else
|
||||||
|
|
1
proto.h
1
proto.h
|
@ -86,6 +86,7 @@ void dump_buffer_reverse(filestruct * inptr);
|
||||||
void reset_cursor(void);
|
void reset_cursor(void);
|
||||||
void check_statblank(void);
|
void check_statblank(void);
|
||||||
void update_line(filestruct * fileptr, int index);
|
void update_line(filestruct * fileptr, int index);
|
||||||
|
void fix_editbot(void);
|
||||||
void statusbar(char *msg, ...);
|
void statusbar(char *msg, ...);
|
||||||
void titlebar(void);
|
void titlebar(void);
|
||||||
void previous_line(void);
|
void previous_line(void);
|
||||||
|
|
9
winio.c
9
winio.c
|
@ -1257,3 +1257,12 @@ void dump_buffer_reverse(filestruct * inptr)
|
||||||
}
|
}
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Fix editbot based on the assumption that edittop is correct */
|
||||||
|
void fix_editbot(void) {
|
||||||
|
int i;
|
||||||
|
editbot = edittop;
|
||||||
|
for(i = 0; (i <= editwinrows - 1) && (editbot->next != NULL)
|
||||||
|
&& (editbot != filebot); i++, editbot = editbot->next);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue