diff options
| author | Casper Ti. Vector <CasperVector@gmail.com> | 2018-01-03 13:31:43 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2018-01-03 13:42:19 +0100 |
| commit | e0b1a90ea831c4ebc184c3636ae9494a7675d82b (patch) | |
| tree | 48292ceb1b81d9435c20edfab343deeb38f19fb6 | |
| parent | 4af2de4fb0483d388c7a6e3d43d8a5b8bf78042e (diff) | |
| download | vis-e0b1a90ea831c4ebc184c3636ae9494a7675d82b.tar.gz vis-e0b1a90ea831c4ebc184c3636ae9494a7675d82b.tar.xz | |
vis: fix command malfunction triggered by special cursor position
At the command prompt, commands were not recognized properly when the
cursor was placed on a delimiting character (:, ?, /) while pressing
enter.
Fix #653
| -rw-r--r-- | vis-prompt.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/vis-prompt.c b/vis-prompt.c index d3e9b8e..2a71441 100644 --- a/vis-prompt.c +++ b/vis-prompt.c @@ -65,11 +65,8 @@ static const char *prompt_enter(Vis *vis, const char *keys, const Arg *arg) { pattern = "^(/|\\?)"; if (pattern && regex && text_regex_compile(regex, pattern, REG_EXTENDED|REG_NEWLINE) == 0) { char c; - size_t prev; - if (text_byte_get(txt, pos, &c) && (c == ':' || c == '/' || c == '?')) - prev = pos; - else - prev = text_search_backward(txt, pos, regex); + size_t end = text_line_end(txt, pos); + size_t prev = text_search_backward(txt, end, regex); if (prev > pos) prev = EPOS; size_t next = text_search_forward(txt, pos, regex); |
