From b6aa42864efec2843c9ab42ec3d092b482d95edc Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Sun, 14 Mar 2004 01:42:17 +0000 Subject: [PATCH] add DB's similar simplification of do_prev_word() too git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1693 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 2 ++ src/nano.c | 31 ++++--------------------------- 2 files changed, 6 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index 909038cb..3ffc950a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -69,6 +69,8 @@ CVS code - do_next_word() - Simplify and remove references to editbot so as to avoid a segfault. (David Benbennick) + do_prev_word() + - Simplify and remove references to edittop. (David Benbennick) do_int_speller(), do_alt_speller(), do_spell() - Modify to write only the current selection from a file to the temporary file used for spell checking when the mark is on, diff --git a/src/nano.c b/src/nano.c index 43847e8b..01a69bf2 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1205,8 +1205,6 @@ int do_next_word(void) /* The same thing for backwards. */ int do_prev_word(void) { - filestruct *old = current; - assert(current != NULL && current->data != NULL); /* Skip letters in this word first. */ @@ -1234,31 +1232,10 @@ int do_prev_word(void) placewewant = xplustabs(); - if (current->lineno <= edittop->lineno) { - /* If we're on the first line, don't center the screen. */ - if (current->lineno == fileage->lineno) - edit_refresh(); - else - edit_update(current, CENTER); - } - else { - /* If we've jumped lines, refresh the old line. We can't just - use current->prev here, because we may have skipped over some - blank lines, in which case the previous line is the wrong - one. */ - if (current != old) { - update_line(old, 0); - /* If the mark was set, then the lines between old and - current have to be updated too. */ - if (ISSET(MARK_ISSET)) { - while (old->prev != current) { - old = old->prev; - update_line(old, 0); - } - } - } - update_line(current, current_x); - } + /* Refresh the screen. If current has run off the top, this call + * puts it at the center line. */ + edit_refresh(); + return 0; } #endif /* !NANO_SMALL */ -- 2.39.5