summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--chat.h1
-rw-r--r--handle.c5
-rw-r--r--ui.c32
3 files changed, 22 insertions, 16 deletions
diff --git a/chat.h b/chat.h
index 93d3ae9..a4d1366 100644
--- a/chat.h
+++ b/chat.h
@@ -111,6 +111,7 @@ void uiHide(void);
 void uiExit(void);
 void uiDraw(void);
 void uiRead(void);
+void uiPrompt(void);
 
 void uiViewTag(struct Tag tag);
 void uiViewNum(int num);
diff --git a/handle.c b/handle.c
index 938315b..05e94e4 100644
--- a/handle.c
+++ b/handle.c
@@ -315,7 +315,10 @@ static void handleNick(char *prefix, char *params) {
 	char *prev, *user, *next;
 	shift(prefix, &prev, &user, NULL, params, 1, 0, &next);
 
-	if (isSelf(prev, user)) selfNick(next);
+	if (isSelf(prev, user)) {
+		selfNick(next);
+		uiPrompt();
+	}
 
 	struct Tag tag;
 	while (TagNone.id != (tag = tabTag(prev)).id) {
diff --git a/ui.c b/ui.c
index 0e22fd8..93542dd 100644
--- a/ui.c
+++ b/ui.c
@@ -329,7 +329,8 @@ static void uiView(struct View *view) {
 	if (ui.view) ui.view->mark = true;
 	viewUnmark(view);
 	ui.view = view;
-	uiRead();
+	uiStatus();
+	uiPrompt();
 }
 
 void uiViewTag(struct Tag tag) {
@@ -504,23 +505,10 @@ static bool isCommand(struct Tag tag, const wchar_t *input) {
 	return !extra || (space && extra > space);
 }
 
-void uiRead(void) {
-	uiShow();
-
-	int ret;
-	wint_t ch;
-	while (ERR != (ret = wget_wch(ui.input, &ch))) {
-		if (ret == KEY_CODE_YES) {
-			keyCode(ch);
-		} else {
-			keyChar(ch);
-		}
-	}
-
+void uiPrompt(void) {
 	const wchar_t *input = editHead();
 
 	// TODO: Avoid reformatting these on every read.
-	// FIXME: Reformat when nick changes. Wouldn't FRP be nice?
 	wchar_t *prompt = NULL;
 	int len = 0;
 	if (isAction(ui.view->tag, input) && editTail() >= &input[4]) {
@@ -552,3 +540,17 @@ void uiRead(void) {
 	wclrtoeol(ui.input);
 	wmove(ui.input, 0, x);
 }
+
+void uiRead(void) {
+	uiShow();
+	int ret;
+	wint_t ch;
+	while (ERR != (ret = wget_wch(ui.input, &ch))) {
+		if (ret == KEY_CODE_YES) {
+			keyCode(ch);
+		} else {
+			keyChar(ch);
+		}
+	}
+	uiPrompt();
+}
colspan='3' class='logmsg'> Oops, didn't see this. 2019-09-05Decode entities in titlesJune McEnroe 2019-09-05Print title as soon as it's availableJune McEnroe 2019-09-05Use CURL_PREFIX to set flagsJune McEnroe 2019-09-05Add titleJune McEnroe 2019-09-04Add Avorter n'est pas tuerJune McEnroe 2019-08-29Unset executable on shell scriptsJune McEnroe 2019-08-29Add long-missing setopt to bin.7June McEnroe 2019-08-29Add editJune McEnroe