screen: don't redraw the current line unnecessarily
When moving the cursor up or down one line, redraw the new current line only when the target column (placewewant) is beyond the screen, or when the mark is on. (This still redraws the current and prior lines unnecessarily when they are in fact shorter than the screen is wide and the mark is off, but we'll let that pass for now.) Also, when softwrap is on, we don't have have to redraw the current and prior lines at all (when the mark is off): they are in full view, there is nothing to show or hide.master
parent
9d7930328b
commit
e393a6c345
29
src/move.c
29
src/move.c
|
@ -401,13 +401,11 @@ void do_up(
|
||||||
#endif
|
#endif
|
||||||
editwinrows / 2 + 1);
|
editwinrows / 2 + 1);
|
||||||
|
|
||||||
/* If we're below the first line of the edit window, update the
|
/* If we're not on the first line of the edit window, and the target
|
||||||
* line we were on before and the line we're on now. The former
|
* column is beyond the screen or the mark is on, redraw the prior
|
||||||
* needs to be redrawn if we're not on the first page, and the
|
* and current lines. */
|
||||||
* latter needs to be drawn unconditionally. */
|
if (openfile->current_y > 0 && need_screen_update(0)) {
|
||||||
if (openfile->current_y > 0) {
|
update_line(openfile->current->next, 0);
|
||||||
if (need_screen_update(0))
|
|
||||||
update_line(openfile->current->next, 0);
|
|
||||||
update_line(openfile->current, openfile->current_x);
|
update_line(openfile->current, openfile->current_x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -498,17 +496,12 @@ void do_down(
|
||||||
if (ISSET(SOFTWRAP))
|
if (ISSET(SOFTWRAP))
|
||||||
edit_refresh_needed = TRUE;
|
edit_refresh_needed = TRUE;
|
||||||
}
|
}
|
||||||
/* If we're above the last line of the edit window, update the line
|
|
||||||
* we were on before and the line we're on now. The former needs to
|
/* If we're not on the last line of the edit window, and the target
|
||||||
* be redrawn if we're not on the first page, and the latter needs
|
* column is beyond the screen or the mark is on, redraw the prior
|
||||||
* to be drawn unconditionally. */
|
* and current lines. */
|
||||||
if (openfile->current_y < editwinrows - 1
|
if (openfile->current_y < editwinrows - 1 && need_screen_update(0)) {
|
||||||
#ifndef NANO_TINY
|
update_line(openfile->current->prev, 0);
|
||||||
|| ISSET(SOFTWRAP)
|
|
||||||
#endif
|
|
||||||
) {
|
|
||||||
if (need_screen_update(0))
|
|
||||||
update_line(openfile->current->prev, 0);
|
|
||||||
update_line(openfile->current, openfile->current_x);
|
update_line(openfile->current, openfile->current_x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue