From f8f35b7f8b8730dd5904912323c058006323d3b1 Mon Sep 17 00:00:00 2001
From: Alcor <alcor@tilde.club>
Date: Tue, 12 May 2026 20:06:27 +0200
Subject: [PATCH 06/19] only attempt partial matches on commands if the first
 character is /

This avoids completing e.g. N to NickServ or C to CTCPServ when input in the server buffer by accident
---
 command.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/command.c b/command.c
index 35e1d63..351c4fe 100644
--- a/command.c
+++ b/command.c
@@ -699,11 +699,13 @@ void command(uint id, char *input) {
 		return;
 	}
 
-	struct Cursor curs = {0};
 	const char *cmd = strsep(&input, " ");
-	const char *unique = completePrefix(&curs, None, cmd);
-	if (unique && !completePrefix(&curs, None, cmd)) {
-		cmd = unique;
+	if (*cmd == '/') {
+		struct Cursor curs = {0};
+		const char *unique = completePrefix(&curs, None, cmd);
+		if (unique && !completePrefix(&curs, None, cmd)) {
+			cmd = unique;
+		}
 	}
 
 	const struct Handler *handler = bsearch(
-- 
2.47.3

