aboutsummaryrefslogtreecommitdiff
path: root/window.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2014-09-13 18:39:01 +0200
committerMarc André Tanner <mat@brain-dump.org>2014-09-13 18:39:01 +0200
commit25ba078b62ada6276217ca35b12b8dabf3a2b439 (patch)
treeb5a25e3a1882c5eb36c7b2330fee27d7cd0847a9 /window.c
parent1ae7600bdc302da4647d5910bea8f2437646fb70 (diff)
downloadvis-25ba078b62ada6276217ca35b12b8dabf3a2b439.tar.gz
vis-25ba078b62ada6276217ca35b12b8dabf3a2b439.tar.xz
Add movements 'H', 'M', 'L'
H moves to the n-th window line from top M moves to the middle window line L moves to the n-th window line from bottom
Diffstat (limited to 'window.c')
-rw-r--r--window.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/window.c b/window.c
index e9ab2d5..166d257 100644
--- a/window.c
+++ b/window.c
@@ -749,3 +749,10 @@ void window_cursor_watch(Win *win, void (*cursor_moved)(Win*, void *), void *dat
win->cursor_moved = cursor_moved;
win->cursor_moved_data = data;
}
+
+size_t window_line_goto(Win *win, int n) {
+ size_t pos = win->start;
+ for (Line *line = win->topline; --n > 0 && line != win->lastline; line = line->next)
+ pos += line->len;
+ return pos;
+}