From 25ba078b62ada6276217ca35b12b8dabf3a2b439 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sat, 13 Sep 2014 18:39:01 +0200 Subject: 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 --- window.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'window.c') 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; +} -- cgit v1.2.3