From af43549eb3a6add4c9ae5ac86f30fc2bd0325ac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sat, 27 Jun 2015 15:19:10 +0200 Subject: 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 --- text.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'text.h') 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 +#include #include #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); -- cgit v1.2.3