in edit_redraw(), fix problem where not all lines would be updated

properly if we'd scrolled off the screen and the mark was on


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3568 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2006-05-26 03:04:24 +00:00
parent 964722a281
commit d5228b3d82
2 changed files with 37 additions and 1 deletions

View File

@ -304,6 +304,9 @@ CVS code -
well as single-line ones. This avoids a segfault when trying
to color e.g. "start="$" end="$"". (DLR, found by Trevor
Caira)
edit_redraw()
- Fix problem where not all lines would be updated properly if
we'd scrolled off the screen and the mark was on. (DLR)
do_credits()
- Update the last copyright notice to include 2006. (DLR)
- configure.ac:

View File

@ -2807,7 +2807,7 @@ void edit_redraw(const filestruct *old_current, size_t old_pww)
{
bool do_redraw = need_vertical_update(0) ||
need_vertical_update(old_pww);
const filestruct *foo;
const filestruct *foo = NULL;
/* If either old_current or current is offscreen, scroll the edit
* window until it's onscreen and get out. */
@ -2819,6 +2819,26 @@ void edit_redraw(const filestruct *old_current, size_t old_pww)
filestruct *old_edittop = openfile->edittop;
ssize_t nlines;
#ifndef NANO_TINY
/* If the mark is on, update all the lines between old_current
* and the old last line of the edit window. */
if (openfile->mark_set) {
ssize_t old_last_lineno = (old_edittop->lineno +
editwinrows <= openfile->filebot->lineno) ?
old_edittop->lineno + editwinrows :
openfile->filebot->lineno;
foo = old_current;
while (foo->lineno != old_last_lineno) {
update_line(foo, 0);
foo = (foo->lineno > old_last_lineno) ? foo->prev :
foo->next;
}
}
#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. */
@ -2844,6 +2864,19 @@ void edit_redraw(const filestruct *old_current, size_t old_pww)
else
edit_scroll(DOWN, nlines);
#ifndef NANO_TINY
/* If the mark is on, update all the lines between the old last
* line of the edit window and current. */
if (openfile->mark_set) {
while (foo != openfile->current) {
update_line(foo, 0);
foo = (foo->lineno > openfile->current->lineno) ?
foo->prev : foo->next;
}
}
#endif /* !NANO_TINY */
return;
}