diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2015-01-02 21:18:05 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2015-01-02 21:32:13 +0100 |
| commit | b55fd4416267295bba5f09762a94b93e37640525 (patch) | |
| tree | dfd7dcf9d471709fe402a16e82cc33361dabb3a6 /config.def.h | |
| parent | c44f18b0c4fff5122c683c108cd831ece1c46049 (diff) | |
| download | vis-b55fd4416267295bba5f09762a94b93e37640525.tar.gz vis-b55fd4416267295bba5f09762a94b93e37640525.tar.xz | |
Make last insertion/replacement repeatable with '.'
Diffstat (limited to 'config.def.h')
| -rw-r--r-- | config.def.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/config.def.h b/config.def.h index 58af491..05bfabd 100644 --- a/config.def.h +++ b/config.def.h @@ -567,6 +567,14 @@ static void vis_mode_insert_idle(void) { } static void vis_mode_insert_input(const char *str, size_t len) { + static size_t oldpos = EPOS; + size_t pos = window_cursor_get(vis->win->win); + if (pos != oldpos) + buffer_truncate(&buffer_repeat); + buffer_append(&buffer_repeat, str, len); + oldpos = pos + len; + action_reset(&action_prev); + action_prev.op = &ops[OP_REPEAT_INSERT]; editor_insert_key(vis, str, len); } @@ -581,6 +589,14 @@ static void vis_mode_replace_leave(Mode *old) { } static void vis_mode_replace_input(const char *str, size_t len) { + static size_t oldpos = EPOS; + size_t pos = window_cursor_get(vis->win->win); + if (pos != oldpos) + buffer_truncate(&buffer_repeat); + buffer_append(&buffer_repeat, str, len); + oldpos = pos + len; + action_reset(&action_prev); + action_prev.op = &ops[OP_REPEAT_REPLACE]; editor_replace_key(vis, str, len); } |
