commit 031a58bd8c7d1361a45a3fce29153b287897238b
parent 6fdf124570308d98a24afec8601ee49bc1949a62
Author: hhvn <dev@hhvn.uk>
Date: Sun, 28 Nov 2021 22:28:36 +0000
ui.c: check for remaining chars in single char stylings
Diffstat:
M | ui.c | | | 36 | ++++++++++++++++++++++++------------ |
1 file changed, 24 insertions(+), 12 deletions(-)
diff --git a/ui.c b/ui.c
@@ -915,24 +915,36 @@ ui_format(char *format, struct History *hist) {
break;
case 'i':
case 'I':
- ret[rc++] = 9; /* ^I */
- format = strchr(format, '}') + 1;
- continue;
+ if (*(tmp+1) == '\0') {
+ ret[rc++] = 9; /* ^I */
+ format = strchr(format, '}') + 1;
+ continue;
+ }
+ break;
case 'o':
case 'O':
- ret[rc++] = 15; /* ^O */
- format = strchr(format, '}') + 1;
- continue;
+ if (*(tmp+1) == '\0') {
+ ret[rc++] = 15; /* ^O */
+ format = strchr(format, '}') + 1;
+ continue;
+ }
+ break;
case 'r':
case 'R':
- ret[rc++] = 18; /* ^R */
- format = strchr(format, '}') + 1;
- continue;
+ if (*(tmp+1) == '\0') {
+ ret[rc++] = 18; /* ^R */
+ format = strchr(format, '}') + 1;
+ continue;
+ }
+ break;
case 'u':
case 'U':
- ret[rc++] = 21; /* ^U */
- format = strchr(format, '}') + 1;
- continue;
+ if (*(tmp+1) == '\0') {
+ ret[rc++] = 21; /* ^U */
+ format = strchr(format, '}') + 1;
+ continue;
+ }
+ break;
}
}