shithub: orca

Download patch

ref: e0f8528e10df8849cdfc14ead966698b15b941be
parent: 25c87e74e1c2bc2cafcd7267f67aaa804e690f0b
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Mon Feb 24 12:11:01 EST 2020

plan9: don't clear manual command buffer

--- a/plan9.c
+++ b/plan9.c
@@ -447,9 +447,13 @@
 static void
 command(char *s, void (*snapshot)(void))
 {
+	char tmp[256];
 	char *a;
 	int x, y;
 
+	snprint(tmp, sizeof(tmp), "%s", s);
+	s = tmp;
+
 	if (s[0] == ',') {
 		snapshot();
 		cur = ZP;
@@ -1161,6 +1165,7 @@
 	Mouse m;
 	Point p;
 	char tmp[256];
+	char cmd[256];
 	int oldw, oldh, w, h, n, oldbuttons;
 	long seed;
 	bool complete;
@@ -1296,6 +1301,7 @@
 	move.x = 1;
 	move.y = 1;
 	oldbuttons = 0;
+	cmd[0] = 0;
 
 	netdial(nil, nil);
 	midiopen(nil);
@@ -1524,9 +1530,8 @@
 				mode = mode != Mappend ? Mappend : Minsert;
 				break;
 			case 0x0b: /* C-k */
-				tmp[0] = 0;
-				if (enter("command:", tmp, sizeof(tmp), nil, &kctl, nil) > 0)
-					command(tmp, snapshot);
+				if (enter("command:", cmd, sizeof(cmd), nil, &kctl, nil) > 0)
+					command(cmd, snapshot);
 				break;
 			case Kesc:
 				if (mode == Mslide || mode != Minsert)