From c37fd32f2023a5d52b38b769e3d48d1f435fe2fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Mon, 10 Jul 2017 18:14:40 +0200 Subject: [PATCH] vis: remove change list This was completely broken since 71eab6d5d72145f17ab3d4c87945ac12176ae8e9 and even before never really worked as one would expect. If anything it should be implemented like the jump list using marks. --- config.def.h | 2 -- main.c | 12 ------------ vis-core.h | 7 ------- vis-motions.c | 42 ------------------------------------------ 4 files changed, 63 deletions(-) diff --git a/config.def.h b/config.def.h index b210ef37a..39a3d33e3 100644 --- a/config.def.h +++ b/config.def.h @@ -241,8 +241,6 @@ static const KeyBinding bindings_normal[] = { { "", ALIAS(":help") }, { "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 index 8db470ded..5c5399aec 100644 --- 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 index cb384a44e..a4ebac12a 100644 --- 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 index 6a668c5e0..5aa0e8713 100644 --- 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,