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);
d: show full date in tooltip if longer ago than max_relativeJohn Keeping 2015-08-13ui-shared: use common function in print_rel_date()John Keeping 2015-08-13ui-shared: extract date formatting to a functionJohn Keeping 2015-08-13filter: don't use dlsym unnecessarilyJohn Keeping 2015-08-13ui-tree: use "sane" isgraph()John Keeping 2015-08-13cgit.h: move stdbool.h from ui-shared.hJohn Keeping 2015-08-13cache.c: fix header orderJohn Keeping 2015-08-13configfile.c: don't include system headers directlyJohn Keeping 2015-08-13Remove redundant includesJohn Keeping 2015-08-13Makefile: include Git's config.mak.unameJohn Keeping 2015-08-13tests: allow shell to be overriddenJohn Keeping 2015-08-13redirect: cleanlinessJason A. Donenfeld 2015-08-13redirect: be more careful for different cgi setupsJason A. Donenfeld 2015-08-12ui-log: fix double countingJohn Keeping 2015-08-12log: allow users to follow a fileJohn Keeping 2015-08-12shared: make cgit_diff_tree_cb publicJohn Keeping 2015-08-12t0110: Chain together using &&Jason A. Donenfeld 2015-08-12about: always ensure page has a trailing slashJason A. Donenfeld 2015-08-12filters: apply HTML escapingLazaros Koromilas 2015-08-12git: update to v2.5.0Christian Hesse 2015-08-12Fix processing of repo.hide and repo.ignoreDaniel Reichelt