git: 9front

Download patch

ref: 335f1909bb77f78490b7e7ef934b3c9db97d2ffc
parent: e2921d3e39aeffee42f008624d0353835121b975
author: qwx <qwx@sciops.net>
date: Sun Mar 22 20:24:16 EDT 2026

samterm: don't treat chords as the start of a double click (thanks hiro)

same as for rio, clicking too fast after a paste chord was often
selecting text in error instead.  here we can't cancel so we just
age the previous click timer.

--- a/sys/src/cmd/samterm/main.c
+++ b/sys/src/cmd/samterm/main.c
@@ -31,7 +31,7 @@
 void
 threadmain(int argc, char *argv[])
 {
-	int i, got, nclick, scr, chord;
+	int i, got, nclick, scr, chord, noTt;
 	Text *t;
 	Rectangle r;
 	Flayer *nwhich;
@@ -55,6 +55,7 @@
 	outTs(Tversion, VERSION);
 	startnewfile(Tstartcmdfile, &cmd);
 
+	noTt = 0;
 	got = 0;
 	chord = 0;
 	for(;;got = waitforio()){
@@ -91,6 +92,9 @@
 				t = (Text *)which->user1;
 				if(!t->lock){
 					int w = which-t->l;
+					/* fire doubleclick timer */
+					if(chord&6)
+						noTt = 1;
 					if(chord&2){
 						cut(t, w, 1, 1);
 						chord &= ~2;
@@ -110,6 +114,10 @@
 						extendsel(which);
 					else{
 						t = which->user1;
+						if(noTt == 1){
+							which->click -= Clicktime;
+							noTt =0;
+						}
 						nclick = flselect(which);
 						if(nclick > 0){
 							if(nclick > 1)
--