summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--format.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/format.c b/format.c
index 8120165..a2aaf4b 100644
--- a/format.c
+++ b/format.c
@@ -97,13 +97,16 @@ bool formatParse(struct Format *format, const wchar_t *split) {
 	}
 
 	const wchar_t *init = format->str;
-	switch (format->str[0]) {
-		break; case IRCBold:      format->str++; format->bold ^= true;
-		break; case IRCItalic:    format->str++; format->italic ^= true;
-		break; case IRCUnderline: format->str++; format->underline ^= true;
-		break; case IRCReverse:   format->str++; format->reverse ^= true;
-		break; case IRCColor:     format->str++; parseColor(format);
-		break; case IRCReset:     format->str++; formatReset(format);
+	for (bool done = false; !done;) {
+		switch (format->str[0]) {
+			break; case IRCBold:      format->str++; format->bold ^= true;
+			break; case IRCItalic:    format->str++; format->italic ^= true;
+			break; case IRCUnderline: format->str++; format->underline ^= true;
+			break; case IRCReverse:   format->str++; format->reverse ^= true;
+			break; case IRCColor:     format->str++; parseColor(format);
+			break; case IRCReset:     format->str++; formatReset(format);
+			break; default:           done = true;
+		}
 	}
 	format->split = (split >= init && split <= format->str);
 
@@ -170,8 +173,10 @@ int main() {
 	assert(testColor(L"\00399,99a", IRCDefault, IRCDefault, 6));
 
 	assert(testSplits(L"ab"));
+	assert(testSplits(L"\002"));
 	assert(testSplits(L"\002ab"));
 	assert(testSplits(L"a\002b"));
+	assert(testSplits(L"\002\003"));
 	assert(testSplits(L"a\002\003b"));
 	assert(testSplits(L"a\0031b"));
 	assert(testSplits(L"a\00312b"));
b6f31d9aea9b166e&follow=1'>Fail target when any test binary failsJune McEnroe 2018-09-14Run tests in default targetJune McEnroe 2018-09-14Add termEvent testsJune McEnroe 2018-09-14Check width of entire next word including codesJune McEnroe 2018-09-14Remove word handling from formatParseJune McEnroe 2018-09-14Apply consecutive formatting codes at onceJune McEnroe 2018-09-14Add tests for formatParseJune McEnroe 2018-09-13Preview with nick in input windowJune McEnroe 2018-09-13Never send PRIVMSG to TagStatus or TagVerboseJune McEnroe 2018-09-13Move color selection to format.cJune McEnroe 2018-09-13Fix len for format->split at end of stringJune McEnroe 2018-09-13Avoid uninitialized x in uiReadJune McEnroe 2018-09-13Add IRCDefault to colors enumJune McEnroe 2018-09-13Return a format->split even at the end of the stringJune McEnroe 2018-09-13Fix weird tab-complete after commaJune McEnroe 2018-09-13Rewrite UI againJune McEnroe 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 McEnroeass='logsubject'>Avoid calling getopt_long again after it returns -1June McEnroe On GNU, calling getopt_long again will reset optind back to the first non-option argument, which would cause an infinite loop of reading the same configurtion file forever. 2019-11-08Only change AWAY status for registered clientsJune McEnroe Turns out I did eventually fix this, because I may want to implement "passive clients" for logging or notification stuff, which wouldn't affect AWAY status either. 2019-11-07Just write the example normallyJune McEnroe 2019-11-07Include path in readlinkat errorJune McEnroe 2019-11-07Call clientConsume before clientRecvJune McEnroe This might reduce the frequency of a client getting its own message back because it was behind in the ring when it sent it. 2019-11-06Use -l:filename in Linux.mkJune McEnroe 2019-11-06Fix compat.h for #defined strlcpyJune McEnroe 2019-11-06Allow unsetting LIBRESSL_PREFIXJune McEnroe 2019-11-06Document calico service configurationJune McEnroe 2019-11-06Document SASL EXTERNAL configuration in more detailJune McEnroe 2019-11-06Document pounce service configurationJune McEnroe 2019-11-06Mention Darwin and GNU/Linux in READMEJune McEnroe 2019-11-06Assume LibreSSL from brew on DarwinJune McEnroe 2019-11-06Remove -DNO_EXPLICIT_BZERO from Darwin.mkJune McEnroe 2019-11-06Don't install rc scripts or dirs on LinuxJune McEnroe