sandy

text editor
git clone git://git.suckless.org/sandy
Log | Files | Refs | README | LICENSE

commit d99eb5c370ea4ea9011a92f30a342560be982696
parent 71675713956f4cdb684d9760ff115aeaa5071cf0
Author: Rafael Garcia <rafael.garcia.gallego@gmail.com>
Date:   Tue, 31 May 2011 22:38:29 +0200

Slight optimization to avoid scrolling through lines when moving through a large chuck of text downwards (e.g. go to file end).
Diffstat:
sandy.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sandy.c b/sandy.c @@ -1249,9 +1249,10 @@ i_update(void) { for(irow=0, l=scrline; l; l=l->next, irow+=vlines) { vlines=VLINES(l); if(fcur.l==l) { - statusflags|=S_DirtyDown; /* lines with vlines>1 require this */ + if(irow+vlines>2*LINES2) statusflags|=S_DirtyScr; + else statusflags|=S_DirtyDown; /* lines with vlines>1 require this */ while(irow+vlines>LINES2 && scrline->next) { /* Can't have fcur.l after screen end, move scrline down */ - wscrl(textwin, VLINES(scrline)); + if(!(statusflags&S_DirtyScr)) wscrl(textwin, VLINES(scrline)); irow -= VLINES(scrline); if(scrline==fsel.l) selection=!selection; /* We just scrolled past the selection point */ scrline=scrline->next;