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-d3aeb78583b8
diff --git a/nano.c b/nano.c
index 2acb52e..435648b 100644
--- a/nano.c
+++ b/nano.c
@@ -502,19 +502,24 @@
current = new;
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) {
edit_update(current);
-
- /* FIXME - figure out why the hell this is needed =) */
- reset_cursor();
- } else
+ reset_cursor();
+ } else {
current_y++;
+ edit_refresh();
+ update_cursor();
+ }
totlines++;
set_modified();
- update_cursor();
- edit_refresh();
placewewant = xplustabs();
return 1;
}
@@ -1018,7 +1023,6 @@
* This is Chris' very ugly spell function. Someone please make this
* better =-)
*/
-
int do_spell(void)
{
#ifdef NANO_SMALL
@@ -1226,11 +1230,7 @@
#endif /* HAVE_WRESIZE */
#endif /* HAVE_NCURSES_H */
- editbot = edittop;
-
- for (i = 0; (i <= editwinrows - 1) && (editbot->next != NULL)
- && (editbot->next != filebot); i++)
- editbot = editbot->next;
+ fix_editbot();
if (current_y > editwinrows - 1) {
edit_update(editbot);
@@ -1428,17 +1428,11 @@
edit_update(current);
center_cursor();
} else {
- int i = 0;
-
- editbot = edittop;
- for (i = 0; (i <= editwinrows - 1) && (editbot->next != NULL)
- && (editbot->next != filebot); i++)
- editbot = editbot->next;
+ fix_editbot();
}
edit_refresh();
- edit_refresh(); /* XXX FIXME XXX */
statusbar("Justify Complete");
return 1;
#else