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
This commit is contained in:
David Lawrence Ramsey 2006-01-10 07:51:49 +00:00
parent 76f9485b02
commit a6eb8480ea
2 changed files with 18 additions and 10 deletions

View File

@ -23,13 +23,13 @@ CVS code -
set errno to EINVAL as well as return -1 if they fail. This set errno to EINVAL as well as return -1 if they fail. This
matches the manual page. (DLR) matches the manual page. (DLR)
- winio.c: - winio.c:
edit_scroll() edit_redraw()
- Redraw the lines before and after the scrolled region even if - If either current or old_current is offscreen, we're not on
the scrolled region was only one line. This fixes a display the first page, and/or we're not on the same page as before,
problem that occurs after doing a search that scrolls the update old_current before scrolling the edit window. This
screen down one line and leaves the cursor on the last line of fixes a potential display problem when a search moves the
the screen, in which case we need to update the line after the cursor offscreen and onto a different page. (DLR, found by
scrolled region. (DLR) Mike Frysinger)
- doc/nano.1: - doc/nano.1:
- Better display the default values for quotestr. (DLR) - Better display the default values for quotestr. (DLR)
- doc/nanorc.5: - doc/nanorc.5:

View File

@ -2702,9 +2702,12 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
1 >= openfile->filebot->lineno)) 1 >= openfile->filebot->lineno))
nlines = editwinrows; nlines = editwinrows;
/* If the lines before and after the scrolled region are visible in /* If the scrolled region contains only one line, and the line
* the edit window, we need to draw them too. */ * before it is visible in the edit window, we need to draw it too.
nlines += 2; * 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) if (nlines > editwinrows)
nlines = editwinrows; nlines = editwinrows;
@ -2769,6 +2772,11 @@ void edit_redraw(const filestruct *old_current, size_t old_pww)
openfile->edittop = old_edittop; 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 /* Scroll the edit window up or down until edittop is in range
* of current. */ * of current. */
if (nlines < 0) if (nlines < 0)