aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/edit.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-04-28 19:05:07 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-05-03 13:16:37 -0400
commitcf9887c838d6b38648d25bb82d6ee569549a5c63 (patch)
tree3de12c5e4d5976e13d6375f174bfbb8906bab7d6 /src/nvim/edit.c
parenta576bf6196a66a0542af82c51e77e51d90a80c67 (diff)
downloadrneovim-cf9887c838d6b38648d25bb82d6ee569549a5c63.tar.gz
rneovim-cf9887c838d6b38648d25bb82d6ee569549a5c63.tar.bz2
rneovim-cf9887c838d6b38648d25bb82d6ee569549a5c63.zip
vim-patch:8.2.0649: undo problem whn an InsertLeave autocommand resets undo
Problem: Undo problem whn an InsertLeave autocommand resets undo. (Kutsan Kaplan) Solution: Do not create a new undo block when leaving Insert mode. https://github.com/vim/vim/commit/db93495d276642f63f80471fbcb900b9aa1e9e42
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r--src/nvim/edit.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index a4c4bf4ce8..ea38221dc7 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -9129,7 +9129,8 @@ static int ins_apply_autocmds(event_T event)
// If u_savesub() was called then we are not prepared to start
// a new line. Call u_save() with no contents to fix that.
- if (tick != buf_get_changedtick(curbuf)) {
+ // Except when leaving Insert mode.
+ if (event != EVENT_INSERTLEAVE && tick != buf_get_changedtick(curbuf)) {
u_save(curwin->w_cursor.lnum, (linenr_T)(curwin->w_cursor.lnum + 1));
}