summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--chat.c14
-rw-r--r--ui.c22
2 files changed, 35 insertions, 1 deletions
diff --git a/chat.c b/chat.c
index 75cca62..ceaf1b5 100644
--- a/chat.c
+++ b/chat.c
@@ -76,7 +76,19 @@ int main(int argc, char *argv[]) {
 	ircConfig(insecure, cert, priv);
 
 	uiInit();
-	uiFormat(Network, Cold, NULL, C "3Trave" U "ling" U C "0,3.." C "0,4.");
+	uiFormat(Network, Cold, NULL, C "3Trave" U "ling" U C "0,3.." C "0,4." R);
+	uiFormat(
+		Network, Cold, NULL,
+		"Jackdaws love my big sphinx of quartz. "
+		"The quick brown fox jumps over the lazy dog. "
+		"Jackdaws love my big sphinx of quartz. "
+		"Jackdaws love my big sphinx of quartz. "
+		"Jackdaws love my big sphinx of quartz. "
+		"The quick brown fox jumps over the lazy dog. "
+		"The quick brown fox jumps over the lazy dog. "
+		"Jackdaws love my big sphinx of quartz. "
+		"Jackdaws love my big sphinx of quartz. "
+	);
 	uiDraw();
 	
 	int irc = ircConnect(host, port);
diff --git a/ui.c b/ui.c
index 83c4bc7..7ce0257 100644
--- a/ui.c
+++ b/ui.c
@@ -209,11 +209,33 @@ static void styleParse(struct Style *style, const char **str, size_t *len) {
 	*len = strcspn(*str, "\2\3\17\26\35\37");
 }
 
+static int wordWidth(const char *str) {
+	size_t len = strcspn(str, " ");
+	// TODO: wcswidth.
+	return len;
+}
+
 static void styleAdd(WINDOW *win, const char *str) {
+	int _, x, width;
+	getmaxyx(win, _, width);
+
 	size_t len;
 	struct Style style = Reset;
 	while (*str) {
+		if (*str == ' ') {
+			const char *word = &str[strspn(str, " ")];
+			getyx(win, _, x);
+			if (width - x - 1 < wordWidth(word)) {
+				waddch(win, '\n');
+				str = word;
+			}
+		}
+
 		styleParse(&style, &str, &len);
+		size_t sp = strspn(str, " ");
+		sp += strcspn(&str[sp], " ");
+		if (sp < len) len = sp;
+
 		wattr_set(
 			win,
 			style.attr | colorAttr(mapColor(style.fg)),
+0200'>2013-04-27t0001: validate Git -rcN version numbers correctlyJohn Keeping 2013-04-27git: update to 1.8.2.2John Keeping 2013-04-17scan-tree: fix regression in section-from-path=-1John Keeping 2013-04-15t0001: ignore ".dirty" suffix on Git versionJohn Keeping 2013-04-15tests: set TEST_OUTPUT_DIRECTORY to the CGit test directoryJohn Keeping 2013-04-15t0109: test more URLsJohn Keeping 2013-04-10cgitrc.5.txt: Specify when scan-path must be defined before.Jason A. Donenfeld 2013-04-10ui-snapshot.c: Prepend "V" when guessing ref namesLukas Fleischer 2013-04-10t0107: Skip ZIP tests if unzip(1) isn't availableLukas Fleischer 2013-04-10tests/: Do not use `sed -i`Lukas Fleischer 2013-04-10Add branch-sort and repo.branch-sort options.Jason A. Donenfeld 2013-04-10t0109: chain operations with &&John Keeping 2013-04-10cgit.c: Do not restore unset environment variablesLukas Fleischer 2013-04-09t0107: Use `tar -z` for gzip'ed archivesLukas Fleischer