Skip to content

Commit

Permalink
vis: remove change list
Browse files Browse the repository at this point in the history
This was completely broken since 71eab6d
and even before never really worked as one would expect.

If anything it should be implemented like the jump list using marks.
  • Loading branch information
martanne committed Jul 10, 2017
1 parent f9e2b88 commit c37fd32
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 63 deletions.
2 changes: 0 additions & 2 deletions config.def.h
Original file line number Diff line number Diff line change
Expand Up @@ -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") },
Expand Down
12 changes: 0 additions & 12 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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")
Expand Down
7 changes: 0 additions & 7 deletions vis-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
42 changes: 0 additions & 42 deletions vis-motions.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit c37fd32

Please sign in to comment.