diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2014-09-13 18:39:01 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2014-09-13 18:39:01 +0200 |
| commit | 25ba078b62ada6276217ca35b12b8dabf3a2b439 (patch) | |
| tree | b5a25e3a1882c5eb36c7b2330fee27d7cd0847a9 /window.c | |
| parent | 1ae7600bdc302da4647d5910bea8f2437646fb70 (diff) | |
| download | vis-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.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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; +} |
