about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--chat.h9
-rw-r--r--ui.c11
2 files changed, 12 insertions, 8 deletions
diff --git a/chat.h b/chat.h
index cd8798c..89d5797 100644
--- a/chat.h
+++ b/chat.h
@@ -105,6 +105,15 @@ static inline size_t styleParse(struct Style *style, const char **str) {
 	return strcspn(*str, (const char[]) { B, C, O, R, I, U, '\0' });
 }
 
+static inline void styleStrip(struct Cat *cat, const char *str) {
+	struct Style style = StyleDefault;
+	while (*str) {
+		size_t len = styleParse(&style, &str);
+		catf(cat, "%.*s", (int)len, str);
+		str += len;
+	}
+}
+
 enum { None, Debug, Network, IDCap = 256 };
 extern char *idNames[IDCap];
 extern enum Color idColors[IDCap];
diff --git a/ui.c b/ui.c
index 22ec02e..e2b832e 100644
--- a/ui.c
+++ b/ui.c
@@ -534,16 +534,11 @@ struct Util uiNotifyUtil;
 static void notify(uint id, const char *str) {
 	if (!uiNotifyUtil.argc) return;
 
+	char buf[1024] = "";
+	styleStrip(&(struct Cat) { buf, sizeof(buf), 0 }, str);
+
 	struct Util util = uiNotifyUtil;
 	utilPush(&util, idNames[id]);
-	char buf[1024] = "";
-	struct Cat cat = { buf, sizeof(buf), 0 };
-	while (*str) {
-		struct Style style = StyleDefault;
-		size_t len = styleParse(&style, &str);
-		catf(&cat, "%.*s", (int)len, str);
-		str += len;
-	}
 	utilPush(&util, buf);
 
 	pid_t pid = fork();
nohover-highlight'> 2013-06-07Switch to my own fork of base16-vimJune McEnroe 2013-05-24Indent compojure correctlyJune McEnroe 2013-05-23Remove vim-clojure-staticJune McEnroe 2013-05-23Replace VimClojure with vim-clojure-staticJune McEnroe 2013-05-18Do not run gitgutter eagerlyJune McEnroe 2013-05-15Remove tabularJune McEnroe 2013-05-15Use long names for all settingsJune McEnroe 2013-05-15Add vim-gitgutterJune McEnroe 2013-04-23Remove unused pluginsJune McEnroe 2013-04-23Switch to base16-default colorschemeJune McEnroe 2013-03-26Replace nerdcommenter with vim-commentaryJune McEnroe 2013-03-24Add paredit.vimJune McEnroe 2013-03-14Update base16-vimJune McEnroe It's still crap 2013-03-12Hide mode from below statuslineJune McEnroe 2013-03-12Switch to powerlineJune McEnroe Which I'm not going to bother configuring because it thinks it's all fancy and for other things that aren't Vim so it stores its config file in ~/.config which I keep in a different repo and I only want to use it for Vim so fuck you, Powerline. </rant> 2013-03-12Remove vim-powerlineJune McEnroe 2013-02-03Update base16 and refheapJune McEnroe 2013-02-03Ignore plugin/private.vimJune McEnroe 2012-09-29Disable GUI dialogsJune McEnroe