aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2015-01-02 15:49:20 +0100
committerMarc André Tanner <mat@brain-dump.org>2015-01-02 21:20:09 +0100
commitc44f18b0c4fff5122c683c108cd831ece1c46049 (patch)
treeea9f318cbd067b1aca835b5597c1e2859d22750f
parent11461b6fd50c1b1cd1e0a0c981d1b6b0c8bbc07e (diff)
downloadvis-c44f18b0c4fff5122c683c108cd831ece1c46049.tar.gz
vis-c44f18b0c4fff5122c683c108cd831ece1c46049.tar.xz
Rip out insertion repeating infrastructure
-rw-r--r--config.def.h3
-rw-r--r--text.c13
-rw-r--r--text.h2
-rw-r--r--vis.c10
4 files changed, 0 insertions, 28 deletions
diff --git a/config.def.h b/config.def.h
index 3d5500f..58af491 100644
--- a/config.def.h
+++ b/config.def.h
@@ -568,9 +568,6 @@ static void vis_mode_insert_idle(void) {
static void vis_mode_insert_input(const char *str, size_t len) {
editor_insert_key(vis, str, len);
- /* make sure we can repeat the last insert */
- action_reset(&action_prev);
- action_prev.op = &ops[OP_REPEAT_INSERT];
}
static KeyBinding vis_mode_replace[] = {
diff --git a/text.c b/text.c
index cc438ed..7cf30a5 100644
--- a/text.c
+++ b/text.c
@@ -108,7 +108,6 @@ struct Text {
Buffer *buffers; /* all buffers which have been allocated to hold insertion data */
Piece *pieces; /* all pieces which have been allocated, used to free them */
Piece *cache; /* most recently modified piece */
- Piece *last_insertion; /* most recently inserted piece */
int piece_count; /* number of pieces allocated, only used for debuging purposes */
Piece begin, end; /* sentinel nodes which always exists but don't hold any data */
Action *redo, *undo; /* two stacks holding all actions performed to the file */
@@ -394,8 +393,6 @@ static void piece_free(Piece *p) {
p->text->pieces = p->global_next;
if (p->text->cache == p)
p->text->cache = NULL;
- if (p->text->last_insertion == p)
- p->text->last_insertion = NULL;
free(p);
}
@@ -556,7 +553,6 @@ bool text_insert(Text *txt, size_t pos, const char *data, size_t len) {
span_init(&c->old, p, p);
}
- txt->last_insertion = new;
cache_piece(txt, new);
span_swap(txt, &c->old, &c->new);
return true;
@@ -875,15 +871,6 @@ void text_snapshot(Text *txt) {
txt->cache = NULL;
}
-size_t text_last_insertion(Text *txt, const char **content) {
- if (!txt->last_insertion) {
- *content = NULL;
- return 0;
- }
- *content = txt->last_insertion->data;
- return txt->last_insertion->len;
-}
-
void text_free(Text *txt) {
if (!txt)
return;
diff --git a/text.h b/text.h
index df6167c..5156d84 100644
--- a/text.h
+++ b/text.h
@@ -50,8 +50,6 @@ void text_snapshot(Text*);
size_t text_undo(Text*);
size_t text_redo(Text*);
-size_t text_last_insertion(Text*, const char **content);
-
size_t text_pos_by_lineno(Text*, size_t lineno);
size_t text_lineno_by_pos(Text*, size_t pos);
diff --git a/vis.c b/vis.c
index 7501d3e..8542f63 100644
--- a/vis.c
+++ b/vis.c
@@ -164,7 +164,6 @@ 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);
static void op_join(OperatorContext *c);
/* these can be passed as int argument to operator(&(const Arg){ .i = OP_*}) */
@@ -176,7 +175,6 @@ enum {
OP_SHIFT_RIGHT,
OP_SHIFT_LEFT,
OP_CASE_CHANGE,
- OP_REPEAT_INSERT,
OP_JOIN,
};
@@ -188,7 +186,6 @@ 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 },
[OP_JOIN] = { op_join },
};
@@ -645,13 +642,6 @@ 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);
-}
-
static void op_join(OperatorContext *c) {
Text *txt = vis->win->text;
size_t pos = text_line_begin(txt, c->range.end), prev_pos;