From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 11165 invoked from network); 24 Jun 2021 04:33:46 -0000 Received: from 1ess.inri.net (216.126.196.35) by inbox.vuxu.org with ESMTPUTF8; 24 Jun 2021 04:33:46 -0000 Received: from mimir.eigenstate.org ([206.124.132.107]) by 1ess; Thu Jun 24 00:27:51 -0400 2021 Received: from abbatoir.myfiosgateway.com (pool-74-108-56-225.nycmny.fios.verizon.net [74.108.56.225]) by mimir.eigenstate.org (OpenSMTPD) with ESMTPSA id 5368f6bb (TLSv1.2:ECDHE-RSA-AES256-SHA:256:NO) for <9front@9front.org>; Wed, 23 Jun 2021 21:00:59 -0700 (PDT) Message-ID: <16E08562D70F59B59716B917E13062F4@eigenstate.org> To: 9front@9front.org Date: Thu, 24 Jun 2021 00:00:57 -0400 From: ori@eigenstate.org MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: virtual markup DOM manager Subject: [9front] vt: fix scrolling over ssh, add mouse scrolling Reply-To: 9front@9front.org Precedence: bulk Testing requested. We were setting 'resize_flag = 1' in backup(), which was causing resized() to get called, which was causing us to call exportsize(), which was eventually singalling sshd, which forwarded the signal over to the process on the other end of the ssh pipe. This was causing a SIGINT to get sent, which was screwing up the scrolling. I'm not sure why we were setting resize_flag=1 in the code: we were always doing something like it since the code first got into 9front -- eresized(0) initially, moving to setting the flag when moving to libevent. Things seem to work without it, so removing it doesn't seem to have broken anything. --- a/sys/src/cmd/vt/cons.h +++ b/sys/src/cmd/vt/cons.h @@ -54,7 +54,7 @@ extern int number(Rune *, int *); extern void shift(int,int,int,int); extern void scroll(int,int,int,int); -extern int backup(int); +extern void backup(int); extern void sendnchars(int, char *); extern Point pt(int, int); extern Point pos(Point); --- a/sys/src/cmd/vt/main.c +++ b/sys/src/cmd/vt/main.c @@ -133,9 +133,7 @@ Rune kbdchar; -#define button1() ((mc->buttons & 07)==1) -#define button2() ((mc->buttons & 07)==2) -#define button3() ((mc->buttons & 07)==4) +#define button(num) (mc->buttons == (1<<((num)-1))) Mousectl *mc; Keyboardctl *kc; @@ -210,6 +208,7 @@ { if(hostpid > 0) postnote(PNGROUP, hostpid, "interrupt"); + } void @@ -834,10 +833,14 @@ flushimage(display, 1); switch(alt(a)){ case AMOUSE: - if(button1() || chording) + if(button(1) || chording) selecting(); - else if(button2() || button3()) + else if(button(2) || button(3)) readmenu(); + else if(button(4)) + backup(backc+1); + else if(button(5)) + backup(backc-1); else if(resize_flag == 0) goto Next; break; @@ -1128,7 +1131,7 @@ select(p, q, mode); drawscreen(); readmouse(mc); - } while(button1()); + } while(button(1)); } if(mc->buttons != chording){ switch(mc->buttons & 0x7){ @@ -1167,7 +1170,7 @@ Point p; p = pos(mc->xy); - if(button3()) { + if(button(3)) { menu3.item[1] = ttystate[cs->raw].crnl ? "cr" : "crnl"; menu3.item[2] = ttystate[cs->raw].nlcr ? "nl" : "nlcr"; menu3.item[3] = cs->raw ? "cooked" : "raw"; @@ -1201,13 +1204,11 @@ switch(menuhit(2, mc, &menu2, nil)) { case Mbackup: /* back up */ - if(backup(backc+1)) - backc++; + backup(backc+1); return; case Mforward: /* move forward */ - if(backc > 0) - backup(--backc); + backup(backc-1); return; case Mreset: /* reset */ @@ -1237,7 +1238,7 @@ } } -int +void backup(int count) { Rune *cp; @@ -1244,8 +1245,8 @@ int left, n; unselect(); - - resize_flag = 1; + if(count < 0) + return; if(count == 0 && !pagemode) { n = ymax; nbacklines = HISTSIZ; /* make sure we scroll to the very end */ @@ -1270,7 +1271,8 @@ if(cp >= &hist[HISTSIZ]) cp = hist; backp = cp; - return left; + if(left) + backc = count; } Point