diff options
| -rw-r--r-- | vis-modes.c | 14 | ||||
| -rw-r--r-- | vis.c | 4 |
2 files changed, 11 insertions, 7 deletions
diff --git a/vis-modes.c b/vis-modes.c index a10d214..7008161 100644 --- a/vis-modes.c +++ b/vis-modes.c @@ -132,10 +132,11 @@ static void vis_mode_insert_enter(Vis *vis, Mode *old) { } static void vis_mode_insert_leave(Vis *vis, Mode *new) { - /* make sure we can recover the current state after an editing operation */ - text_snapshot(vis->win->file->text); - if (new == mode_get(vis, VIS_MODE_NORMAL)) + if (new == mode_get(vis, VIS_MODE_NORMAL)) { + /* make sure we can recover the current state after an editing operation */ + text_snapshot(vis->win->file->text); macro_operator_stop(vis); + } } static void vis_mode_insert_idle(Vis *vis) { @@ -161,10 +162,11 @@ static void vis_mode_replace_enter(Vis *vis, Mode *old) { } static void vis_mode_replace_leave(Vis *vis, Mode *new) { - /* make sure we can recover the current state after an editing operation */ - text_snapshot(vis->win->file->text); - if (new == mode_get(vis, VIS_MODE_NORMAL)) + if (new == mode_get(vis, VIS_MODE_NORMAL)) { + /* make sure we can recover the current state after an editing operation */ + text_snapshot(vis->win->file->text); macro_operator_stop(vis); + } } static void vis_mode_replace_input(Vis *vis, const char *str, size_t len) { @@ -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); } |
