shithub: riscv

Download patch

ref: 4ec97f73ee2326209bc56730562e82f2e6fe2c0a
parent: e0bfd148e29346f9fb824ea0c6ac86b5870836ce
author: Sigrid <ftrvxmtrx@gmail.com>
date: Thu Feb 4 05:57:37 EST 2021

libdraw: enter/eenter: fix ^W removing the text on the right side of the tick

--- a/sys/src/libdraw/eenter.c
+++ b/sys/src/libdraw/eenter.c
@@ -152,13 +152,15 @@
 				continue;
 			}
 			if(k == Ketb){
+				l = tick;
 				while(tick > 0){
 					tick--;
 					if(tick == 0 ||
-					   strchr(" !\"#$%&'()*+,-./:;<=>?@`[\\]^{|}~", buf[tick-1]))
+						strchr(" !\"#$%&'()*+,-./:;<=>?@`[\\]^{|}~", buf[tick-1]))
 						break;
 				}
-				buf[n = tick] = 0;
+				memmove(buf+tick, buf+l, n-l);
+				buf[n -= l-tick] = 0;
 				break;
 			}
 			if(k == Kbs){
--- a/sys/src/libdraw/enter.c
+++ b/sys/src/libdraw/enter.c
@@ -160,13 +160,15 @@
 				continue;
 			}
 			if(k == Ketb){
+				l = tick;
 				while(tick > 0){
 					tick--;
 					if(tick == 0 ||
-					   strchr(" !\"#$%&'()*+,-./:;<=>?@`[\\]^{|}~", buf[tick-1]))
+						strchr(" !\"#$%&'()*+,-./:;<=>?@`[\\]^{|}~", buf[tick-1]))
 						break;
 				}
-				buf[n = tick] = 0;
+				memmove(buf+tick, buf+l, n-l);
+				buf[n -= l-tick] = 0;
 				break;
 			}
 			if(k == Kbs){