add -r flag to reverse scrolling behavior.

from peter canning.
This commit is contained in:
rsc 2005-01-10 00:21:13 +00:00
parent 5eead98e71
commit d8c78a8d56
2 changed files with 11 additions and 0 deletions

View file

@ -27,6 +27,7 @@ char wdir[512] = ".";
Reffont *reffonts[2]; Reffont *reffonts[2];
int snarffd = -1; int snarffd = -1;
int mainpid; int mainpid;
int swapscrollbuttons = FALSE;
enum{ enum{
NSnarf = 1000 /* less than 1024, I/O buffer size */ NSnarf = 1000 /* less than 1024, I/O buffer size */
@ -102,6 +103,9 @@ threadmain(int argc, char *argv[])
if(loadfile == nil) if(loadfile == nil)
goto Usage; goto Usage;
break; break;
case 'r':
swapscrollbuttons = TRUE;
break;
case 'W': case 'W':
winsize = ARGF(); winsize = ARGF();
if(winsize == nil) if(winsize == nil)
@ -562,6 +566,12 @@ mousethread(void *v)
barttext = t; barttext = t;
if(t->what==Body && ptinrect(m.xy, t->scrollr)){ if(t->what==Body && ptinrect(m.xy, t->scrollr)){
if(but){ if(but){
if(swapscrollbuttons){
if(but == 1)
but = 3;
else if(but == 3)
but = 1;
}
winlock(w, 'M'); winlock(w, 'M');
t->eq0 = ~0; t->eq0 = ~0;
textscroll(t, but); textscroll(t, but);

View file

@ -515,6 +515,7 @@ Text *mousetext; /* global because Text.close needs to clear it */
Text *typetext; /* global because Text.close needs to clear it */ Text *typetext; /* global because Text.close needs to clear it */
Text *barttext; /* shared between mousetask and keyboardthread */ Text *barttext; /* shared between mousetask and keyboardthread */
int bartflag; int bartflag;
int swapscrollbuttons;
Window *activewin; Window *activewin;
Column *activecol; Column *activecol;
Buffer snarfbuf; Buffer snarfbuf;