nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 4b5b66a806d196a291231ed3dbf6bd94e8861d70
parent aa1ae0a1441964079df63247405858506e1d2c93
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Mon, 11 Apr 2016 20:40:21 +0200

screen: avoid redrawing a line twice

The old_current line needs to be redrawn only if it differs from current,
and if it wasn't drawn already by the iteration for when the mark is on.

Also make the conditions involving horizontal scrolling more precise.

Diffstat:
Msrc/winio.c | 12+++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/winio.c b/src/winio.c @@ -2983,11 +2983,17 @@ void edit_redraw(filestruct *old_current) } #endif /* !NANO_TINY */ - /* Update old_current and current if we've changed page. */ - if (need_screen_update(0) || need_screen_update(was_pww)) { + /* Update old_current only if it differs from current, and if not + * already done above, and if it was horizontally scrolled. */ + if (old_current != openfile->current && !openfile->mark_set && + get_page_start(was_pww) > 0) update_line(old_current, 0); + + /* Update current if we've changed page, or if it differs from + * old_current and needs to be horizontally scrolled. */ + if (need_screen_update(was_pww) || (old_current != openfile->current && + get_page_start(openfile->placewewant) > 0)) update_line(openfile->current, openfile->current_x); - } } /* Refresh the screen without changing the position of lines. Use this