aboutsummaryrefslogtreecommitdiff
path: root/editor.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2014-07-16 14:30:42 +0200
committerMarc André Tanner <mat@brain-dump.org>2014-07-16 14:30:42 +0200
commitc4351c9a00a4f7d96c1058d339d5f68270c25254 (patch)
tree104a4bdf9c855d309c72bd0fc321792a18aa7651 /editor.c
parent615bbd7da9c3fe634cb9c37d867a208df048d047 (diff)
downloadvis-c4351c9a00a4f7d96c1058d339d5f68270c25254.tar.gz
vis-c4351c9a00a4f7d96c1058d339d5f68270c25254.tar.xz
Implement replacement/overwrite
Diffstat (limited to 'editor.c')
-rw-r--r--editor.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/editor.c b/editor.c
index f3e1197..8033f23 100644
--- a/editor.c
+++ b/editor.c
@@ -414,6 +414,14 @@ bool editor_delete(Editor *ed, size_t pos, size_t len) {
return true;
}
+bool editor_replace(Editor *ed, size_t pos, char *c) {
+ // TODO argument validation: pos etc.
+ size_t len = strlen(c);
+ editor_delete(ed, pos, len);
+ editor_insert(ed, pos, c);
+ return true;
+}
+
void editor_snapshot(Editor *ed) {
ed->current_action = NULL;
}