about summary refs log tree commit diff
path: root/ui.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-04 20:46:16 -0500
committerJune McEnroe <june@causal.agency>2020-02-04 20:46:16 -0500
commit55757243f48da0f0c6d2382ffe57d364c7b803c9 (patch)
tree24fb2f153839ecb919d4541e2e4d3c6fd066d559 /ui.c
parentAlign join messages after nick (diff)
downloadcatgirl-55757243f48da0f0c6d2382ffe57d364c7b803c9.tar.gz
catgirl-55757243f48da0f0c6d2382ffe57d364c7b803c9.zip
Call inputUpdate when switching windows
Because changing windows (to <network> or <debug>) will affect the
prompt.
Diffstat (limited to 'ui.c')
-rw-r--r--ui.c44
1 files changed, 23 insertions, 21 deletions
diff --git a/ui.c b/ui.c
index 568df8d..172120b 100644
--- a/ui.c
+++ b/ui.c
@@ -325,27 +325,6 @@ static void unmark(void) {
 	statusUpdate();
 }
 
-static void windowShow(struct Window *window) {
-	touchwin(window->pad);
-	windows.other = windows.active;
-	windows.active = window;
-	windows.other->mark = true;
-	unmark();
-}
-
-void uiShowID(size_t id) {
-	windowShow(windowFor(id));
-}
-
-void uiShowNum(size_t num) {
-	struct Window *window = windows.head;
-	for (size_t i = 0; i < num; ++i) {
-		window = window->next;
-		if (!window) return;
-	}
-	windowShow(window);
-}
-
 static int wordWidth(const char *str) {
 	size_t len = strcspn(str, " ");
 	int width = 0;
@@ -462,6 +441,7 @@ static void inputUpdate(void) {
 		NULL
 	);
 	if (self.nick) {
+		// TODO: Check if input is command or action.
 		waddch(input, '<');
 		waddstr(input, self.nick);
 		waddstr(input, "> ");
@@ -476,6 +456,28 @@ static void inputUpdate(void) {
 	wmove(input, y, x);
 }
 
+static void windowShow(struct Window *window) {
+	touchwin(window->pad);
+	windows.other = windows.active;
+	windows.active = window;
+	windows.other->mark = true;
+	inputUpdate();
+	unmark();
+}
+
+void uiShowID(size_t id) {
+	windowShow(windowFor(id));
+}
+
+void uiShowNum(size_t num) {
+	struct Window *window = windows.head;
+	for (size_t i = 0; i < num; ++i) {
+		window = window->next;
+		if (!window) return;
+	}
+	windowShow(window);
+}
+
 static void keyCode(int code) {
 	switch (code) {
 		break; case KEY_RESIZE:; // TODO