diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2015-01-06 21:28:39 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2015-01-06 22:15:55 +0100 |
| commit | d3b3e218edcaa950477645a9add92c83cd0543b9 (patch) | |
| tree | 0362222761e8770b241ba4d1ced8dd144bbcfaa9 /editor.c | |
| parent | 876b8f94649c9ec405375cf687b55a65e2e666ec (diff) | |
| download | vis-d3b3e218edcaa950477645a9add92c83cd0543b9.tar.gz vis-d3b3e218edcaa950477645a9add92c83cd0543b9.tar.xz | |
Rudimentary change list (accessible via g; and g,)
Diffstat (limited to 'editor.c')
| -rw-r--r-- | editor.c | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -172,6 +172,34 @@ void editor_window_jumplist_invalidate(EditorWin *win) { ringbuf_invalidate(win->jumplist); } +size_t editor_window_changelist_prev(EditorWin *win) { + size_t pos = window_cursor_get(win->win); + if (pos != win->changelist.pos) + win->changelist.index = 0; + else + win->changelist.index++; + size_t newpos = text_history_get(win->text, win->changelist.index); + if (newpos == EPOS) + win->changelist.index--; + else + win->changelist.pos = newpos; + return win->changelist.pos; +} + +size_t editor_window_changelist_next(EditorWin *win) { + size_t pos = window_cursor_get(win->win); + if (pos != win->changelist.pos) + win->changelist.index = 0; + else if (win->changelist.index > 0) + win->changelist.index--; + size_t newpos = text_history_get(win->text, win->changelist.index); + if (newpos == EPOS) + win->changelist.index++; + else + win->changelist.pos = newpos; + return win->changelist.pos; +} + void editor_resize(Editor *ed, int width, int height) { ed->width = width; ed->height = height; |
