commit a6eb8480eab4ac521e4e5e6aa97a385f0aeb8232
parent 76f9485b0259ddd81374d8a4fe2b9d4ded57348d
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date: Tue, 10 Jan 2006 07:51:49 +0000
really fix the previous display problem with searches that move the
cursor offscreen and from a page other than the first one onto a
different page by reverting the erroneous change to edit_scroll() and
adding the proper fix to edit_redraw()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3263 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
2 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -23,13 +23,13 @@ CVS code -
set errno to EINVAL as well as return -1 if they fail. This
matches the manual page. (DLR)
- winio.c:
- edit_scroll()
- - Redraw the lines before and after the scrolled region even if
- the scrolled region was only one line. This fixes a display
- problem that occurs after doing a search that scrolls the
- screen down one line and leaves the cursor on the last line of
- the screen, in which case we need to update the line after the
- scrolled region. (DLR)
+ edit_redraw()
+ - If either current or old_current is offscreen, we're not on
+ the first page, and/or we're not on the same page as before,
+ update old_current before scrolling the edit window. This
+ fixes a potential display problem when a search moves the
+ cursor offscreen and onto a different page. (DLR, found by
+ Mike Frysinger)
- doc/nano.1:
- Better display the default values for quotestr. (DLR)
- doc/nanorc.5:
diff --git a/src/winio.c b/src/winio.c
@@ -2702,9 +2702,12 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
1 >= openfile->filebot->lineno))
nlines = editwinrows;
- /* If the lines before and after the scrolled region are visible in
- * the edit window, we need to draw them too. */
- nlines += 2;
+ /* If the scrolled region contains only one line, and the line
+ * before it is visible in the edit window, we need to draw it too.
+ * If the scrolled region contains more than one line, and the lines
+ * before and after the scrolled region are visible in the edit
+ * window, we need to draw them too. */
+ nlines += (nlines == 1) ? 1 : 2;
if (nlines > editwinrows)
nlines = editwinrows;
@@ -2769,6 +2772,11 @@ void edit_redraw(const filestruct *old_current, size_t old_pww)
openfile->edittop = old_edittop;
+ /* Update old_current if we're not on the first page and/or
+ * we're not on the same page as before. */
+ if (do_redraw)
+ update_line(old_current, 0);
+
/* Scroll the edit window up or down until edittop is in range
* of current. */
if (nlines < 0)