vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit a417631fba3871a583e6ecc607836fa22ddaeaf4
parent cf5168e060d14b7d715d5afefcf3a35845e8a527
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Wed, 21 Oct 2015 23:34:25 +0200

vis: rename motion type

Diffstat:
Meditor.h | 2+-
Mvis.c | 18+++++++++---------
2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/editor.h b/editor.h @@ -83,7 +83,7 @@ typedef struct { typedef struct { size_t (*cmd)(const Arg*); /* a custom movement based on user input from vis.c */ - size_t (*view)(Cursor*); /* a movement based on current window content from view.h */ + size_t (*cur)(Cursor*); /* a movement based on current window content from view.h */ size_t (*txt)(Text*, size_t pos); /* a movement form text-motions.h */ size_t (*file)(Vis*, File*, size_t pos); size_t (*vis)(Vis*, Text*, size_t pos); diff --git a/vis.c b/vis.c @@ -187,13 +187,13 @@ static size_t view_lines_middle(const Arg *arg); static size_t view_lines_bottom(const Arg *arg); static Movement moves[] = { - [MOVE_LINE_UP] = { .view = view_line_up, .type = LINEWISE }, - [MOVE_LINE_DOWN] = { .view = view_line_down, .type = LINEWISE }, - [MOVE_SCREEN_LINE_UP] = { .view = view_screenline_up, }, - [MOVE_SCREEN_LINE_DOWN] = { .view = view_screenline_down, }, - [MOVE_SCREEN_LINE_BEGIN] = { .view = view_screenline_begin, .type = CHARWISE }, - [MOVE_SCREEN_LINE_MIDDLE] = { .view = view_screenline_middle, .type = CHARWISE }, - [MOVE_SCREEN_LINE_END] = { .view = view_screenline_end, .type = CHARWISE|INCLUSIVE }, + [MOVE_LINE_UP] = { .cur = view_line_up, .type = LINEWISE }, + [MOVE_LINE_DOWN] = { .cur = view_line_down, .type = LINEWISE }, + [MOVE_SCREEN_LINE_UP] = { .cur = view_screenline_up, }, + [MOVE_SCREEN_LINE_DOWN] = { .cur = view_screenline_down, }, + [MOVE_SCREEN_LINE_BEGIN] = { .cur = view_screenline_begin, .type = CHARWISE }, + [MOVE_SCREEN_LINE_MIDDLE] = { .cur = view_screenline_middle, .type = CHARWISE }, + [MOVE_SCREEN_LINE_END] = { .cur = view_screenline_end, .type = CHARWISE|INCLUSIVE }, [MOVE_LINE_PREV] = { .txt = text_line_prev, }, [MOVE_LINE_BEGIN] = { .txt = text_line_begin, }, [MOVE_LINE_START] = { .txt = text_line_start, }, @@ -1481,8 +1481,8 @@ static void action_do(Action *a) { for (int i = 0; i < a->count; i++) { if (a->movement->txt) pos = a->movement->txt(txt, pos); - else if (a->movement->view) - pos = a->movement->view(cursor); + else if (a->movement->cur) + pos = a->movement->cur(cursor); else if (a->movement->file) pos = a->movement->file(vis, vis->win->file, pos); else if (a->movement->vis)