summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--input.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/input.c b/input.c
index 9bf29ac..4d34420 100644
--- a/input.c
+++ b/input.c
@@ -172,21 +172,31 @@ void input(struct Tag tag, char *input) {
 		return;
 	}
 
-	char *command = strsep(&input, " ");
+	char *word = strsep(&input, " ");
 	if (input && !input[0]) input = NULL;
-	for (size_t i = 0; i < COMMANDS_LEN; ++i) {
-		if (strcasecmp(command, COMMANDS[i].command)) continue;
-		COMMANDS[i].handler(tag, input);
-		return;
-	}
 
 	char *trail;
-	strtol(&command[1], &trail, 0);
+	strtol(&word[1], &trail, 0);
 	if (!trail[0]) {
-		inputView(tag, &command[1]);
+		inputView(tag, &word[1]);
+		return;
+	}
+
+	const char *command = word;
+	const char *uniq = tabNext(TAG_NONE, command);
+	if (uniq && uniq == tabNext(TAG_NONE, command)) {
+		command = uniq;
+		tabAccept();
 	} else {
-		uiFmt(TAG_STATUS, UI_WARM, "%s isn't a recognized command", command);
+		tabReject();
+	}
+
+	for (size_t i = 0; i < COMMANDS_LEN; ++i) {
+		if (strcasecmp(command, COMMANDS[i].command)) continue;
+		COMMANDS[i].handler(tag, input);
+		return;
 	}
+	uiFmt(TAG_STATUS, UI_WARM, "%s isn't a recognized command", command);
 }
 
 void inputTab(void) {
onfig?h=somasis/tokipona&id=252428f97aa6a8f4e5b612757ce96d2d0d37e2f3&follow=1'>Add chroot targetJune McEnroe 2020-02-11Exit focus and paste modes on err exitJune McEnroe 2020-02-11Add startup GPLv3 note and URLJune McEnroe 2020-02-11Make sure -D_GNU_SOURCE ends up in CFLAGS on LinuxJune McEnroe 2020-02-11Add note about setting PKG_CONFIG_PATHJune McEnroe 2020-02-11Rename query ID on nick changeJune McEnroe 2020-02-11Call completeClear when closing a windowJune McEnroe 2020-02-11Don't insert color codes for non-mentionsJune McEnroe 2020-02-11Take first two words in colorMentionsJune McEnroe 2020-02-11Use time_t for save signatureJune McEnroe 2020-02-11Set self.nick to * initiallyJune McEnroe 2020-02-11Define ColorCap instead of hardcoding 100June McEnroe 2020-02-11Move hash to top of chat.hJune McEnroe 2020-02-11Move base64 out of chat.hJune McEnroe 2020-02-11Move XDG_SUBDIR out of chat.hJune McEnroe 2020-02-11Fix whois idle unit calculationJune McEnroe 2020-02-11Cast towupper to wchar_tJune McEnroe 2020-02-11Cast set but unused variables to voidJune McEnroe 2020-02-11Declare strlcatJune McEnroe 2020-02-11Check if VDSUSP existsJune McEnroe 2020-02-11Fix completeReplace iterationJune McEnroe 2020-02-11Use pkg(8) to configure on FreeBSDJune McEnroe 2020-02-11Remove legacy codeJune McEnroe 2020-02-11Add INSTALLING section to READMEJune McEnroe