shithub: fork

Download patch

ref: a3b4afa26a867f7df6bf2f1fd863200588beeef1
parent: 7b8aea75acf2613d137c20570a2b0b6679b5d0c6
author: qwx <qwx@sciops.net>
date: Sat May 24 12:06:09 EDT 2025

bof: bring up to date

--- a/sys/src/cmd/bof/wind.c
+++ b/sys/src/cmd/bof/wind.c
@@ -1089,9 +1089,24 @@
 static void
 wstretchsel(Window *w, uint pt, uint *q0, uint *q1, int mode)
 {
-	int c, i;
+	int c, i, rc, lc;
 	Rune *r, *l, *p;
 	uint q;
+
+	if(mode){
+		lc = *q0 > 0     ? w->r[*q0-1] : '\n';
+		rc = *q1 < w->nr ? w->r[*q1]   : '\n';
+		for(i=0; left[i]; i++){
+			l = left[i];
+			r = right[i];
+			p = strrune(l, lc);
+			if(p && r[p-l] == rc){
+				*q0 -= *q0 > 0 && lc != '\n';
+				*q1 += *q1 < w->nr;
+				return;
+			}
+		}
+	}
 
 	*q0 = pt;
 	*q1 = pt;
--