vis

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

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

commit bda080c5baad07f80eb34e34c00a7512cfa5396c
parent 30ec27d256e20962c955d4004d20bcbeb1c9e66c
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Wed, 12 Oct 2016 13:20:02 +0200

Only complete up to cursor position

Diffstat:
Mmain.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/main.c b/main.c @@ -2106,9 +2106,11 @@ static const char *open_file_under_cursor(Vis *vis, const char *keys, const Arg static char *get_completion_prefix(Vis *vis, Filerange (*text_object)(Text *, size_t)) { View *view = vis_view(vis); Text *txt = vis_text(vis); - - Filerange r = text_object(txt, view_cursor_get(view)-1); + size_t pos = view_cursor_get(view); + Filerange r = text_object(txt, pos-1); r = text_range_inner(txt, &r); + if (r.end > pos) + r.end = pos; size_t size = text_range_size(&r); if (size == 0) { vis_info_show(vis, "No valid prefix found for completion");