sandy

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

commit 3bd2dae1437ea1f33697501b737332e69f35a52a
parent 7a95c0be1ff384985bc118ee8bfcfdf99a1ef61c
Author: Rafael Garcia <rafael.garcia.gallego@gmail.com>
Date:   Sun, 29 May 2011 17:49:22 +0200

Tiny optimization for scrolling up a huge number of lines.
Diffstat:
sandy.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sandy.c b/sandy.c @@ -1216,8 +1216,9 @@ i_update(void) { scrollok(textwin, TRUE); /* Here I scroll */ for(selection=FALSE, l=fstline, iline=1; l && scrline->prev && l != scrline; iline++, l=l->next) { if(l==fcur.l) { /* Can't have fcur.l before scrline, move scrline up */ + i=0; while(l!=scrline) { - if(VLINES(scrline) > 1) { /* Scrolled through a picky line */ + if(VLINES(scrline) > 1 || ++i > LINES2) { /* Scrolled by a picky line or through the whole view, skip */ statusflags|=S_DirtyScr; scrline=l; break; @@ -1233,8 +1234,8 @@ 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 */ while(irow+vlines>LINES2 && scrline->next) { /* Can't have fcur.l after screen end, move scrline down */ - statusflags|=S_DirtyDown; /* lines with vlines>1 require this */ wscrl(textwin, VLINES(scrline)); irow -= VLINES(scrline); if(scrline==fsel.l) selection=!selection; /* We just scrolled past the selection point */