aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-11-09 13:52:17 +0100
committerMarc André Tanner <mat@brain-dump.org>2016-11-09 14:57:27 +0100
commitff45c36bab3952bb633dd0b8e6c4c90dab9f7e2a (patch)
tree2bc5013b5e454e476a876e478737161a976ce40a /vis.c
parentb05cd28c904994188be55e7bcecf98ef0077b6ba (diff)
downloadvis-ff45c36bab3952bb633dd0b8e6c4c90dab9f7e2a.tar.gz
vis-ff45c36bab3952bb633dd0b8e6c4c90dab9f7e2a.tar.xz
vis: perform undo snapshotting more rarerly
Do not take snapshots after every operation in insert/replace mode. As an example up until now we would take a snapshot after every <Backspace>/<Delete> press, hence when undoing changes each character would be restored individually. The same applies for <C-w> and related actions. From now on we only snaphost when: - transitioning from insert/replace mode to normal mode (but not when switching to operator pending mode) - an operation takes place from normal mode - an idle time expires in normal/replace mode
Diffstat (limited to 'vis.c')
-rw-r--r--vis.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/vis.c b/vis.c
index d48e857..7edc2cd 100644
--- a/vis.c
+++ b/vis.c
@@ -718,7 +718,9 @@ void vis_do(Vis *vis) {
} else if (vis->mode->visual) {
vis_mode_switch(vis, VIS_MODE_NORMAL);
}
- text_snapshot(txt);
+
+ if (vis->mode == &vis_modes[VIS_MODE_NORMAL])
+ text_snapshot(txt);
vis_draw(vis);
}