From b36a1347022965fdbe1b61298dc6a05be2d2a34d Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Wed, 12 Sep 2018 22:55:02 -0400 Subject: Use formatParse split to position input cursor --- format.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'format.c') diff --git a/format.c b/format.c index 800388b..30b287e 100644 --- a/format.c +++ b/format.c @@ -64,10 +64,11 @@ static const wchar_t Stops[] = { L'\0', }; -bool formatParse(struct Format *format, const wchar_t *stop) { +bool formatParse(struct Format *format, const wchar_t *split) { format->str += format->len; if (!format->str[0]) return false; + 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; @@ -76,14 +77,15 @@ bool formatParse(struct Format *format, const wchar_t *stop) { break; case IRCColor: format->str++; parseColor(format); break; case IRCReset: format->str++; formatReset(format); } + format->split = (split >= init && split <= format->str); if (format->str[0] == L' ') { format->len = 1 + wcscspn(&format->str[1], Stops); } else { format->len = wcscspn(format->str, Stops); } - if (stop && stop > format->str && stop < &format->str[format->len]) { - format->len = stop - format->str; + if (split > format->str && split < &format->str[format->len]) { + format->len = split - format->str; } return true; } -- cgit 1.4.1 method='get' action='/src/log/www/causal.agency/torus.pty'>
path: root/www/causal.agency/torus.pty (unfollow)
Commit message (Expand)Author
2020-12-30Print octal for 8 bits in bitJune McEnroe
2020-12-30Add unary & to bitJune McEnroe
2020-12-30Support unary + in orderJune McEnroe
2020-12-30Add postfix $ operator to bitJune McEnroe
2020-12-29Add make lexerJune McEnroe
2020-12-29Clean up C lexerJune McEnroe
2020-12-29Clean up hilex code somewhatJune McEnroe
2020-12-29Match lex/yacc %% %{ %} lines as MacroJune McEnroe
2020-12-29Match top-level C definitions as IdentifierTagJune McEnroe
2020-12-29Match C type declarations as IdentifierTagJune McEnroe
2020-12-29Match function-like macro definitions as IdentifierTagJune McEnroe
2020-12-29Reconfigure C macro start conditionsJune McEnroe
2020-12-29Document HTML class namesJune McEnroe
2020-12-29Rename Tag class to IdentifierTagJune McEnroe
2020-12-29Change HTML class from hi to hilexJune McEnroe
2020-12-29Add hilex HTML outputJune McEnroe