From 28481439c06780e2c56d3c2b47711785bcaa25a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Fri, 27 Nov 2015 13:26:42 +0100 Subject: vis: improve creation of new cursors on line above/below Use view cell matrix data to create the cursors on more appropriate positions. Closes #108 --- main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index b0ec8d9..185aa94 100644 --- a/main.c +++ b/main.c @@ -1110,15 +1110,15 @@ static const char *repeat(Vis *vis, const char *keys, const Arg *arg) { static const char *cursors_new(Vis *vis, const char *keys, const Arg *arg) { View *view = vis_view(vis); - Text *txt = vis_text(vis); size_t pos = view_cursor_get(view); - if (arg->i > 0) - pos = text_line_down(txt, pos); - else if (arg->i < 0) - pos = text_line_up(txt, pos); Cursor *cursor = view_cursors_new(view); - if (cursor) + if (cursor) { view_cursors_to(cursor, pos); + if (arg->i > 0) + view_line_down(cursor); + else if (arg->i < 0) + view_line_up(cursor); + } return keys; } -- cgit v1.2.3