diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2014-09-28 11:11:07 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2014-09-28 11:11:07 +0200 |
| commit | ddf8647a5393e049f514a39764aebd8893ce00b9 (patch) | |
| tree | 0539941bd5ce776f89af000e8579ae833b90f8c5 /vis.c | |
| parent | d954d51a4ce4d6fa13e9312fb72afa0f666a3378 (diff) | |
| download | vis-ddf8647a5393e049f514a39764aebd8893ce00b9.tar.gz vis-ddf8647a5393e049f514a39764aebd8893ce00b9.tar.xz | |
Make '.' repeat last insertion
Diffstat (limited to 'vis.c')
| -rw-r--r-- | vis.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -160,6 +160,7 @@ static void op_delete(OperatorContext *c); static void op_shift_right(OperatorContext *c); static void op_shift_left(OperatorContext *c); static void op_case_change(OperatorContext *c); +static void op_repeat_insert(OperatorContext *c); /* these can be passed as int argument to operator(&(const Arg){ .i = OP_*}) */ enum { @@ -170,6 +171,7 @@ enum { OP_SHIFT_RIGHT, OP_SHIFT_LEFT, OP_CASE_CHANGE, + OP_REPEAT_INSERT, }; static Operator ops[] = { @@ -180,6 +182,7 @@ static Operator ops[] = { [OP_SHIFT_RIGHT] = { op_shift_right }, [OP_SHIFT_LEFT] = { op_shift_left }, [OP_CASE_CHANGE] = { op_case_change }, + [OP_REPEAT_INSERT] = { op_repeat_insert }, }; #define PAGE INT_MAX @@ -620,6 +623,13 @@ static void op_case_change(OperatorContext *c) { free(buf); } +static void op_repeat_insert(OperatorContext *c) { + const char *content; + size_t len = text_last_insertion(vis->win->text, &content); + editor_insert(vis, c->pos, content, len); + window_cursor_to(vis->win->win, c->pos + len); +} + /** movement implementations of type: size_t (*move)(const Arg*) */ static char *get_word_under_cursor() { |
