summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ui.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/ui.c b/ui.c
index a78d5c8..ebae222 100644
--- a/ui.c
+++ b/ui.c
@@ -689,7 +689,7 @@ static void windowList(const struct Window *window) {
 	}
 }
 
-static void inputAdd(struct Style *style, const char *str) {
+static void inputAdd(struct Style reset, struct Style *style, const char *str) {
 	while (*str) {
 		const char *code = str;
 		size_t len = styleParse(style, &str);
@@ -705,6 +705,7 @@ static void inputAdd(struct Style *style, const char *str) {
 		}
 		if (str - code > 1) waddnstr(input, &code[1], str - &code[1]);
 		if (str[0] == '\n') {
+			*style = reset;
 			str++;
 			len--;
 		}
@@ -716,10 +717,13 @@ static void inputAdd(struct Style *style, const char *str) {
 	}
 }
 
-static char *inputStop(struct Style *style, const char *str, char *stop) {
+static char *inputStop(
+	struct Style reset, struct Style *style,
+	const char *str, char *stop
+) {
 	char ch = *stop;
 	*stop = '\0';
-	inputAdd(style, str);
+	inputAdd(reset, style, str);
 	*stop = ch;
 	return stop;
 }
@@ -777,18 +781,18 @@ static void inputUpdate(void) {
 	const char *ptr = skip;
 	struct Style style = styleInput;
 	if (split && split < pos) {
-		ptr = inputStop(&style, ptr, &buf[split]);
+		ptr = inputStop(styleInput, &style, ptr, &buf[split]);
 		style = styleInput;
 		style.bg = Red;
 	}
-	ptr = inputStop(&style, ptr, &buf[pos]);
+	ptr = inputStop(styleInput, &style, ptr, &buf[pos]);
 	getyx(input, y, x);
 	if (split && split >= pos) {
-		ptr = inputStop(&style, ptr, &buf[split]);
+		ptr = inputStop(styleInput, &style, ptr, &buf[split]);
 		style = styleInput;
 		style.bg = Red;
 	}
-	inputAdd(&style, ptr);
+	inputAdd(styleInput, &style, ptr);
 	wclrtoeol(input);
 	wmove(input, y, x);
 }
n title='2018-09-12 22:56:11 -0400'>2018-09-12Add note about C-oJune McEnroe 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 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