From 2456dd2a8561c9a0f424884906b1275882a4da4c Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 22 Mar 2015 13:23:42 +0000 Subject: [PATCH] Not centering the current line when smooth scrolling is used. This fixes Savannah bug #42654. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5149 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 2 ++ src/winio.c | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7c86e3a1..7fd4872e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,8 @@ one byte but one character (possibly multibyte). Fixes Savannah bug #42175, reported by myself, and the finding of ghosts seen in https://lists.gnu.org/archive/html/nano-devel/2015-03/msg00055.html. + * src/winio.c (edit_redraw): Do not center the current line when + smooth scrolling is used. This fixes Savannah bug #42654. 2015-03-21 Benno Schulenberg * src/text.c (do_alt_speller): Remove some leftovers. diff --git a/src/winio.c b/src/winio.c index c578640c..3dbc1d05 100644 --- a/src/winio.c +++ b/src/winio.c @@ -3160,10 +3160,11 @@ void edit_redraw(filestruct *old_current, size_t pww_save) } #endif /* !NANO_TINY */ - /* Put edittop in range of current, get the difference in lines - * between the original edittop and the current edittop, and - * then restore the original edittop. */ - edit_update(CENTER); + /* Make sure the current line is on the screen. */ + if (ISSET(SMOOTH_SCROLL)) + edit_update(NONE); + else + edit_update(CENTER); /* Update old_current if we're not on the same page as * before. */ @@ -3229,8 +3230,7 @@ void edit_refresh(void) (long)openfile->current->lineno, (long)openfile->edittop->lineno, maxrows); #endif - /* Put the top line of the edit window in range of the current - * line. */ + /* Make sure the current line is on the screen. */ edit_update(CENTER); } -- 2.39.5