diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2017-01-13 17:02:38 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2017-01-13 17:02:38 +0100 |
| commit | 53638e37fea793ce4bda93094b7103a716613181 (patch) | |
| tree | 67a0bf98cc99ed257f74d272f90290be8620ba49 /sam.c | |
| parent | 104df30ff09cb14e2806f3089dde4ade62d29604 (diff) | |
| download | vis-53638e37fea793ce4bda93094b7103a716613181.tar.gz vis-53638e37fea793ce4bda93094b7103a716613181.tar.xz | |
sam: allow empty text specifiers
Before the i, a, c commands would fail when given an empty text //.
Diffstat (limited to 'sam.c')
| -rw-r--r-- | sam.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -572,8 +572,11 @@ static char *parse_delimited(const char **s, int type) { static char *parse_text(const char **s) { skip_spaces(s); - if (**s != '\n') - return parse_delimited(s, CMD_TEXT); + if (**s != '\n') { + const char *before = *s; + char *text = parse_delimited(s, CMD_TEXT); + return (!text && *s != before) ? strdup("") : text; + } Buffer buf; buffer_init(&buf); |
