9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] vt: fix scrolling over ssh, add mouse scrolling
@ 2021-06-24  4:00 ori
  2021-06-24  7:28 ` igor
  2021-06-26  6:04 ` unobe
  0 siblings, 2 replies; 5+ messages in thread
From: ori @ 2021-06-24  4:00 UTC (permalink / raw)
  To: 9front

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-26 15:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-24  4:00 [9front] vt: fix scrolling over ssh, add mouse scrolling ori
2021-06-24  7:28 ` igor
2021-06-24 13:34   ` ori
2021-06-24 14:22     ` igor
2021-06-26  6:04 ` unobe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).