From ff587fb25a56656a9a426a5086b47a5cf891092b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Tue, 13 Jan 2015 19:41:56 +0100 Subject: Add new logical linewise movements The column position is currently not correctly preserved when there are lines with multibyte characters involved spanning multiple screen lines. In general this might still be a bit fragile. --- vis.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'vis.c') diff --git a/vis.c b/vis.c index 8845209..e32835e 100644 --- a/vis.c +++ b/vis.c @@ -202,6 +202,8 @@ static Operator ops[] = { /* these can be passed as int argument to movement(&(const Arg){ .i = MOVE_* }) */ enum { + MOVE_LINE_DOWN, + MOVE_LINE_UP, MOVE_SCREEN_LINE_UP, MOVE_SCREEN_LINE_DOWN, MOVE_SCREEN_LINE_BEGIN, @@ -281,6 +283,8 @@ static size_t window_lines_middle(const Arg *arg); static size_t window_lines_bottom(const Arg *arg); static Movement moves[] = { + [MOVE_LINE_UP] = { .win = window_line_up }, + [MOVE_LINE_DOWN] = { .win = window_line_down }, [MOVE_SCREEN_LINE_UP] = { .win = window_screenline_up }, [MOVE_SCREEN_LINE_DOWN] = { .win = window_screenline_down }, [MOVE_SCREEN_LINE_BEGIN] = { .win = window_screenline_begin, .type = CHARWISE }, @@ -380,6 +384,8 @@ static TextObject textobjs[] = { /* if some movements are forced to be linewise, they are translated to text objects */ static TextObject *moves_linewise[] = { + [MOVE_LINE_UP] = &textobjs[TEXT_OBJ_LINE_UP], + [MOVE_LINE_DOWN] = &textobjs[TEXT_OBJ_LINE_DOWN], [MOVE_SCREEN_LINE_UP] = &textobjs[TEXT_OBJ_LINE_UP], [MOVE_SCREEN_LINE_DOWN] = &textobjs[TEXT_OBJ_LINE_DOWN], }; -- cgit v1.2.3