vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 0db1b0a1ad44874d314359ae8ff591c7474e13f0
parent 07645201edf539e66e6d33c4c09acb4070b2e380
Author: Casper Ti. Vector <CasperVector@gmail.com>
Date:   Wed,  3 Jan 2018 13:31:43 +0100

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

Diffstat:
Mvis-prompt.c | 7++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git 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);