aboutsummaryrefslogtreecommitdiff
path: root/text.h
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2015-06-27 15:19:10 +0200
committerMarc André Tanner <mat@brain-dump.org>2015-06-27 15:19:10 +0200
commitaf43549eb3a6add4c9ae5ac86f30fc2bd0325ac6 (patch)
treee8ae9061e00db9d9c8fa2cbce39e488c8857dd3d /text.h
parent13caec50e0974961f31c2b03ad3ba64e0042f6e1 (diff)
downloadvis-af43549eb3a6add4c9ae5ac86f30fc2bd0325ac6.tar.gz
vis-af43549eb3a6add4c9ae5ac86f30fc2bd0325ac6.tar.xz
Make :earlier and :later accept arguments similar to vim
Currently the following arguments are accepted: {count} Go to older text state {count} times. {N}s Go to older text state about {N} seconds before. {N}m Go to older text state about {N} minutes before. {N}h Go to older text state about {N} hours before. {N}d Go to older text state about {N} days before
Diffstat (limited to 'text.h')
-rw-r--r--text.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/text.h b/text.h
index f5091c5..e015abb 100644
--- a/text.h
+++ b/text.h
@@ -2,6 +2,7 @@
#define TEXT_H
#include <stdbool.h>
+#include <time.h>
#include <sys/types.h>
#define EPOS ((size_t)-1) /* invalid position */
@@ -49,8 +50,13 @@ void text_snapshot(Text*);
* the change occured or EPOS if nothing could be undo/redo. */
size_t text_undo(Text*);
size_t text_redo(Text*);
-size_t text_earlier(Text*);
-size_t text_later(Text*);
+/* move chronlogically to the count earlier/later revision */
+size_t text_earlier(Text*, int count);
+size_t text_later(Text*, int count);
+/* restore the text to the state closest to the time given */
+size_t text_restore(Text*, time_t);
+/* get creation time of current state */
+time_t text_state(Text*);
size_t text_pos_by_lineno(Text*, size_t lineno);
size_t text_lineno_by_pos(Text*, size_t pos);