ref: 3c055af447aad7a54e75eed8087e97873ef5da9f
parent: db6156d82b9cd2db2248d448955a9848e89c2e23
	author: cinap_lenrek <cinap_lenrek@felloff.net>
	date: Thu Sep 27 11:24:41 EDT 2018
	
vt: implement word select
--- a/sys/src/cmd/vt/main.c
+++ b/sys/src/cmd/vt/main.c
@@ -1002,6 +1002,23 @@
 		snarffp = Bopen("/dev/snarf",OREAD);}
+int
+isalnum(Rune c)
+{+ /*
+ * Hard to get absolutely right. Use what we know about ASCII
+ * and assume anything above the Latin control characters is
+ * potentially an alphanumeric.
+ */
+ if(c <= ' ')
+ return 0;
+ if(0x7F<=c && c<=0xA0)
+ return 0;
+	if(utfrune("!\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~", c))+ return 0;
+ return 1;
+}
+
void
unselect(void)
 {@@ -1029,6 +1046,14 @@
 	if(q.y > ymax){q.y = ymax;
if(!blocksel) q.x = xmax+1;
+ }
+	if(line && eqpt(p, q)){+ while(p.x > 0 && isalnum(*onscreenr(p.x-1, p.y)))
+ p.x--;
+ while(q.x <= xmax && isalnum(*onscreenr(q.x, q.y)))
+ q.x++;
+ if(p.x != q.x)
+ line = 0;
}
if(p.x < 0 || line)
p.x = 0;
--
⑨