Skip to content

Commit

Permalink
text: remove text_history_get function
Browse files Browse the repository at this point in the history
As currently implemented this does not properly integrate with
multiple cursor support. The functionality should be provided
in a layer higher up.

The jumplist and changelist need to be redesigned, for now they
are broken.
  • Loading branch information
martanne committed May 3, 2017
1 parent 3c32147 commit 71eab6d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 17 deletions.
12 changes: 0 additions & 12 deletions text.c
Original file line number Diff line number Diff line change
Expand Up @@ -1675,15 +1675,3 @@ size_t text_mark_get(Text *txt, Mark mark) {

return EPOS;
}

size_t text_history_get(Text *txt, size_t index) {
for (Revision *rev = txt->current_revision ? txt->current_revision : txt->history; rev; rev = rev->prev) {
if (index-- == 0) {
Change *c = rev->change;
while (c && c->next)
c = c->next;
return c ? c->pos : EPOS;
}
}
return EPOS;
}
3 changes: 0 additions & 3 deletions text.h
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,4 @@ ssize_t text_write_range(Text*, Filerange*, int fd);
bool text_mmaped(Text*, const char *ptr);
/** @} */

/* get position of change denoted by index, where 0 indicates the most recent */
size_t text_history_get(Text*, size_t index);

#endif
4 changes: 2 additions & 2 deletions vis-motions.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ static size_t window_changelist_next(Vis *vis, Win *win, size_t pos) {
cl->index = 0;
else if (cl->index > 0 && pos == cl->pos)
cl->index--;
size_t newpos = text_history_get(txt, cl->index);
size_t newpos = pos;
if (newpos == EPOS)
cl->index++;
else
Expand All @@ -204,7 +204,7 @@ static size_t window_changelist_prev(Vis *vis, Win *win, size_t pos) {
cl->index = 0;
else if (pos == cl->pos)
win->changelist.index++;
size_t newpos = text_history_get(txt, cl->index);
size_t newpos = pos;
if (newpos == EPOS)
cl->index--;
else
Expand Down

0 comments on commit 71eab6d

Please sign in to comment.