aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2015-01-04 22:25:09 +0100
committerMarc André Tanner <mat@brain-dump.org>2015-01-04 22:31:50 +0100
commitc8d9e1d3d9f947f511e2ab395fae2d2710454c3e (patch)
treed6681348de0408468917bf7347c1c32093604dfb /vis.c
parentc6953f92be304c637ecb64a8ef363c151ec0f409 (diff)
downloadvis-c8d9e1d3d9f947f511e2ab395fae2d2710454c3e.tar.gz
vis-c8d9e1d3d9f947f511e2ab395fae2d2710454c3e.tar.xz
Support relative line jumps :+nn / :-nn
Diffstat (limited to 'vis.c')
-rw-r--r--vis.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/vis.c b/vis.c
index 6ef4964..f495f6d 100644
--- a/vis.c
+++ b/vis.c
@@ -1658,6 +1658,16 @@ static Filepos parse_pos(char **cmd) {
}
text_regex_free(regex);
break;
+ case '+':
+ case '-':
+ {
+ CursorPos curspos = window_cursor_getpos(win);
+ long long line = curspos.line + strtoll(*cmd, cmd, 10);
+ if (line < 0)
+ line = 0;
+ pos = text_pos_by_lineno(txt, line);
+ break;
+ }
default:
if ('0' <= **cmd && **cmd <= '9')
pos = text_pos_by_lineno(txt, strtoul(*cmd, cmd, 10));