aboutsummaryrefslogtreecommitdiff
path: root/text.h
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2014-09-12 11:29:28 +0200
committerMarc André Tanner <mat@brain-dump.org>2014-09-12 11:29:28 +0200
commit6df6386c3af1420d9b0d676d5b9da660ab6f99d4 (patch)
treee9b717be17c69d090b9cd1d2fda6841620407819 /text.h
parentbc8ad2d9e83096685dac4a7af3b1080b012eb24d (diff)
downloadvis-6df6386c3af1420d9b0d676d5b9da660ab6f99d4.tar.gz
vis-6df6386c3af1420d9b0d676d5b9da660ab6f99d4.tar.xz
Restore cursor position after an undo/redo
Diffstat (limited to 'text.h')
-rw-r--r--text.h6
1 files changed, 4 insertions, 2 deletions
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);