aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
Diffstat (limited to 'vis.c')
-rw-r--r--vis.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/vis.c b/vis.c
index 7d6d348..19ca0dc 100644
--- a/vis.c
+++ b/vis.c
@@ -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() {