about summary refs log tree commit diff
path: root/command.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-06-17 18:43:26 -0400
committerJune McEnroe <june@causal.agency>2021-06-17 18:52:47 -0400
commit0d888b88d0d8e4853e0d23e00b3183a7b60ab877 (patch)
tree42c2cb300ce6439a9d00e0293e2acb1c1a5abc38 /command.c
parentClean up if restricted && logEnable, pipe creation (diff)
downloadcatgirl-0d888b88d0d8e4853e0d23e00b3183a7b60ab877.tar.gz
catgirl-0d888b88d0d8e4853e0d23e00b3183a7b60ab877.zip
Match windows by substring in /window
This could just iterate over idNames instead, but using complete
means more recently used windows will match first.
Diffstat (limited to '')
-rw-r--r--command.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/command.c b/command.c
index b345e11..84cb68f 100644
--- a/command.c
+++ b/command.c
@@ -379,7 +379,17 @@ static void commandWindow(uint id, char *params) {
 		uiShowNum(strtoul(params, NULL, 10));
 	} else {
 		id = idFind(params);
-		if (id) uiShowID(id);
+		if (id) {
+			uiShowID(id);
+			return;
+		}
+		for (const char *match; (match = completeSubstr(None, params));) {
+			id = idFind(match);
+			if (!id) continue;
+			completeAccept();
+			uiShowID(id);
+			break;
+		}
 	}
 }