summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm>2019-05-29 20:05:14 +0000
committernicm <nicm>2019-05-29 20:05:14 +0000
commit7dced376737ef685e09fd5a49161ca2bf423e91b (patch)
tree6f8d776bf67584d497386832b172132cd8703dbf
parentc17edd594e8088d2355102a8ca58f4b256c59397 (diff)
Use VIS_CSTYLE for the arguments and add the missing escapes it can
generate to the parser.
-rw-r--r--arguments.c2
-rw-r--r--cmd-parse.y15
-rw-r--r--tty-term.c2
-rw-r--r--window-buffer.c2
4 files changed, 18 insertions, 3 deletions
diff --git a/arguments.c b/arguments.c
index 54bc3593..8e049aab 100644
--- a/arguments.c
+++ b/arguments.c
@@ -218,7 +218,7 @@ args_escape(const char *s)
return (escaped);
}
- flags = VIS_OCTAL|VIS_TAB|VIS_NL;
+ flags = VIS_OCTAL|VIS_CSTYLE|VIS_TAB|VIS_NL;
if (s[strcspn(s, quoted)] != '\0')
flags |= VIS_DQ;
utf8_stravis(&escaped, s, flags);
diff --git a/cmd-parse.y b/cmd-parse.y
index a235fde1..a623caa5 100644
--- a/cmd-parse.y
+++ b/cmd-parse.y
@@ -1118,9 +1118,24 @@ yylex_token_escape(char **buf, size_t *len)
switch (ch) {
case EOF:
return (0);
+ case 'a':
+ ch = '\a';
+ break;
+ case 'b':
+ ch = '\b';
+ break;
case 'e':
ch = '\033';
break;
+ case 'f':
+ ch = '\f';
+ break;
+ case 's':
+ ch = ' ';
+ break;
+ case 'v':
+ ch = '\v';
+ break;
case 'r':
ch = '\r';
break;
diff --git a/tty-term.c b/tty-term.c
index 45934afa..83bfcdc1 100644
--- a/tty-term.c
+++ b/tty-term.c
@@ -685,7 +685,7 @@ tty_term_describe(struct tty_term *term, enum tty_code_code code)
break;
case TTYCODE_STRING:
strnvis(out, term->codes[code].value.string, sizeof out,
- VIS_OCTAL|VIS_TAB|VIS_NL);
+ VIS_OCTAL|VIS_CSTYLE|VIS_TAB|VIS_NL);
xsnprintf(s, sizeof s, "%4u: %s: (string) %s",
code, tty_term_codes[code].name,
out);
diff --git a/window-buffer.c b/window-buffer.c
index 79dacf97..983b1680 100644
--- a/window-buffer.c
+++ b/window-buffer.c
@@ -246,7 +246,7 @@ window_buffer_draw(__unused void *modedata, void *itemdata,
at = 0;
while (end != pdata + psize && *end != '\n') {
if ((sizeof line) - at > 5) {
- cp = vis(line + at, *end, VIS_TAB|VIS_OCTAL, 0);
+ cp = vis(line + at, *end, VIS_OCTAL|VIS_TAB, 0);
at = cp - line;
}
end++;