vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit bd41922674fc565a12f589b9e8c55ffad6db67fe parent 2eeeb91a6e2452afd86d7ff7e3305d142716a127 Author: Marc André Tanner <mat@brain-dump.org> Date: Mon, 10 Jul 2017 18:14:40 +0200 vis: remove change list This was completely broken since d03eac0cb2fac7305b3ee38ba6e3741765c8812c and even before never really worked as one would expect. If anything it should be implemented like the jump list using marks. Diffstat:
| M | config.def.h | | | 2 | -- |
| M | main.c | | | 12 | ------------ |
| M | vis-core.h | | | 7 | ------- |
| M | vis-motions.c | | | 42 | ------------------------------------------ |
4 files changed, 0 insertions(+), 63 deletions(-)
diff --git a/config.def.h b/config.def.h @@ -241,8 +241,6 @@ static const KeyBinding bindings_normal[] = { { "<F1>", ALIAS(":help<Enter>") }, { "ga", ACTION(UNICODE_INFO) }, { "g8", ACTION(UTF8_INFO) }, - { "g,", ACTION(CHANGELIST_NEXT) }, - { "g;", ACTION(CHANGELIST_PREV) }, { "g-", ACTION(EARLIER) }, { "g+", ACTION(LATER) }, { "gn", ALIAS("vgn") }, diff --git a/main.c b/main.c @@ -215,8 +215,6 @@ enum { VIS_ACTION_JUMPLIST_PREV, VIS_ACTION_JUMPLIST_NEXT, VIS_ACTION_JUMPLIST_SAVE, - VIS_ACTION_CHANGELIST_PREV, - VIS_ACTION_CHANGELIST_NEXT, VIS_ACTION_UNDO, VIS_ACTION_REDO, VIS_ACTION_EARLIER, @@ -669,16 +667,6 @@ static const KeyAction vis_action[] = { VIS_HELP("Save current selections in jump list") jumplist, { .i = 0 } }, - [VIS_ACTION_CHANGELIST_PREV] = { - "vis-changelist-prev", - VIS_HELP("Go to older cursor position in change list") - movement, { .i = VIS_MOVE_CHANGELIST_PREV } - }, - [VIS_ACTION_CHANGELIST_NEXT] = { - "vis-changelist-next", - VIS_HELP("Go to newer cursor position in change list") - movement, { .i = VIS_MOVE_CHANGELIST_NEXT } - }, [VIS_ACTION_UNDO] = { "vis-undo", VIS_HELP("Undo last change") diff --git a/vis-core.h b/vis-core.h @@ -153,19 +153,12 @@ struct File { /* shared state among windows displaying the same file */ File *next, *prev; }; -typedef struct { - time_t state; /* state of the text, used to invalidate change list */ - size_t index; /* #number of changes */ - size_t pos; /* where the current change occured */ -} ChangeList; - struct Win { Vis *vis; /* editor instance to which this window belongs to */ UiWin *ui; /* ui object handling visual appearance of this window */ File *file; /* file being displayed in this window */ View *view; /* currently displayed part of underlying text */ MarkList jumplist; /* LRU jump management */ - ChangeList changelist; /* state for iterating through least recently changes */ Mode modes[VIS_MODE_INVALID]; /* overlay mods used for per window key bindings */ Win *parent; /* window which was active when showing the command prompt */ Mode *parent_mode; /* mode which was active when showing the command prompt */ diff --git a/vis-motions.c b/vis-motions.c @@ -171,40 +171,6 @@ static size_t view_lines_bottom(Vis *vis, View *view) { return view_screenline_goto(vis->win->view, h - vis_count_get_default(vis, 0)); } -static size_t window_changelist_next(Vis *vis, Win *win, size_t pos) { - ChangeList *cl = &win->changelist; - Text *txt = win->file->text; - time_t state = text_state(txt); - if (cl->state != state) - cl->index = 0; - else if (cl->index > 0 && pos == cl->pos) - cl->index--; - size_t newpos = pos; - if (newpos == EPOS) - cl->index++; - else - cl->pos = newpos; - cl->state = state; - return cl->pos; -} - -static size_t window_changelist_prev(Vis *vis, Win *win, size_t pos) { - ChangeList *cl = &win->changelist; - Text *txt = win->file->text; - time_t state = text_state(txt); - if (cl->state != state) - cl->index = 0; - else if (pos == cl->pos) - win->changelist.index++; - size_t newpos = pos; - if (newpos == EPOS) - cl->index--; - else - cl->pos = newpos; - cl->state = state; - return cl->pos; -} - static size_t window_nop(Vis *vis, Win *win, size_t pos) { return pos; } @@ -586,14 +552,6 @@ const Movement vis_motions[] = { .view = view_lines_bottom, .type = LINEWISE|JUMP|IDEMPOTENT, }, - [VIS_MOVE_CHANGELIST_NEXT] = { - .win = window_changelist_next, - .type = INCLUSIVE, - }, - [VIS_MOVE_CHANGELIST_PREV] = { - .win = window_changelist_prev, - .type = INCLUSIVE, - }, [VIS_MOVE_NOP] = { .win = window_nop, .type = IDEMPOTENT,