about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ui.c58
1 files changed, 33 insertions, 25 deletions
diff --git a/ui.c b/ui.c
index 9f0bb88..96f722a 100644
--- a/ui.c
+++ b/ui.c
@@ -474,36 +474,44 @@ static void inputAdd(struct Style *style, const char *str) {
 }
 
 static void inputUpdate(void) {
-	wmove(input, 0, 0);
-	wattr_set(
-		input,
-		colorAttr(mapColor(self.color)),
-		colorPair(mapColor(self.color), -1),
-		NULL
-	);
+	size_t id = windows.active->id;
+	const char *nick = self.nick;
 	const char *head = editHead();
 	const char *skip = NULL;
-	if (self.nick) {
-		size_t id = windows.active->id;
-		if (NULL != (skip = commandIsPrivmsg(id, head))) {
-			waddch(input, '<');
-			waddstr(input, self.nick);
-			waddstr(input, "> ");
-		} else if (NULL != (skip = commandIsNotice(id, head))) {
-			waddch(input, '-');
-			waddstr(input, self.nick);
-			waddstr(input, "- ");
-		} else if (NULL != (skip = commandIsAction(id, head))) {
-			waddstr(input, "* ");
-			waddstr(input, self.nick);
-			waddch(input, ' ');
-		}
+	const char *pre = "";
+	const char *suf = " ";
+	struct Style style = { .fg = self.color, .bg = Default };
+	if (NULL != (skip = commandIsPrivmsg(id, head))) {
+		pre = "<";
+		suf = "> ";
+	} else if (NULL != (skip = commandIsNotice(id, head))) {
+		pre = "-";
+		suf = "- ";
+	} else if (NULL != (skip = commandIsAction(id, head))) {
+		style.attr |= A_ITALIC;
+		pre = "* ";
+	} else if (id == Debug) {
+		skip = head;
+		style.fg = Gray;
+		pre = "<<";
+		nick = NULL;
 	}
-	if (skip) head = skip;
 
 	int y, x;
-	struct Style style = Reset;
-	inputAdd(&style, head);
+	wmove(input, 0, 0);
+	if (skip) {
+		wattr_set(
+			input,
+			style.attr | colorAttr(mapColor(style.fg)),
+			colorPair(mapColor(style.fg), mapColor(style.bg)),
+			NULL
+		);
+		waddstr(input, pre);
+		if (nick) waddstr(input, nick);
+		waddstr(input, suf);
+	}
+	style.fg = Default;
+	inputAdd(&style, (skip ? skip : head));
 	getyx(input, y, x);
 	inputAdd(&style, editTail());
 	wclrtoeol(input);
&id=8a8eab89ff079b4a11ab9108b0a3f02fe6a638b1&follow=1'>Fix weird tab-complete after commaJune McEnroe I have no idea why I did this. 2018-09-13Rewrite UI againJune McEnroe The persistent topic is gone and the status line is now at the top. The status formatting still needs to be reworked. I also want to try showing the nick in the input window so it really looks like your next message. 2018-09-12Add note about C-oJune McEnroe Why are there so few well usable ctrl key bindings? 2018-09-12Use formatParse split to position input cursorJune McEnroe 2018-09-12Factor out IRC formatting parsingJune McEnroe 2018-09-11Add /help equivalent to /manJune McEnroe 2018-09-11Don't render every PM as a pingJune McEnroe 2018-09-11Add urlOpenMatchJune McEnroe 2018-09-10Depend on man.sh for chroot.tar targetJune McEnroe 2018-09-10Set LESSSECURE=1 in man.shJune McEnroe Ridiculous. 2018-09-10Add /man commandJune McEnroe 2018-09-10Install man page in chrootJune McEnroe 2018-09-10Install man pageJune McEnroe 2018-09-10Split keys into subsections and document colorsJune McEnroe 2018-09-10Add "blank" lines to chatte.1June McEnroe 2018-09-10Document key bindings in chatte.1June McEnroe 2018-09-08Document slash commands in chatte.1June McEnroe