From 6df6386c3af1420d9b0d676d5b9da660ab6f99d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Fri, 12 Sep 2014 11:29:28 +0200 Subject: Restore cursor position after an undo/redo --- text.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'text.h') diff --git a/text.h b/text.h index bedd16b..2cec7b1 100644 --- a/text.h +++ b/text.h @@ -33,8 +33,10 @@ bool text_insert(Text*, size_t pos, const char *data); bool text_insert_raw(Text*, size_t pos, const char *data, size_t len); bool text_delete(Text*, size_t pos, size_t len); void text_snapshot(Text*); -bool text_undo(Text*); -bool text_redo(Text*); +/* undo/redos to the last snapshoted state. returns the position where + * the change occured or (size_t)-1 if nothing could be undo/redo. */ +size_t text_undo(Text*); +size_t text_redo(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