aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2015-01-13 19:41:56 +0100
committerMarc André Tanner <mat@brain-dump.org>2015-01-13 23:01:09 +0100
commitff587fb25a56656a9a426a5086b47a5cf891092b (patch)
tree911915a3d8ecca9f48effe889bd069776d0f2472 /vis.c
parentcad4ad2c4e9de198ca78958b4db79886ffb81c56 (diff)
downloadvis-ff587fb25a56656a9a426a5086b47a5cf891092b.tar.gz
vis-ff587fb25a56656a9a426a5086b47a5cf891092b.tar.xz
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.
Diffstat (limited to 'vis.c')
-rw-r--r--vis.c6
1 files changed, 6 insertions, 0 deletions
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],
};