Skip to content

Commit

Permalink
vis: fix command malfunction triggered by special cursor position
Browse files Browse the repository at this point in the history
At the command prompt, commands were not recognized properly when the
cursor was placed on a delimiting character (:, ?, /) while pressing
enter.

Fix martanne#653
  • Loading branch information
CasperVector authored and martanne committed Jan 3, 2018
1 parent 4af2de4 commit e0b1a90
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions vis-prompt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e0b1a90

Please sign in to comment.