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:
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;
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)