diff options
author | Bram Moolenaar <bram@vim.org> | 2013-06-15 17:54:43 +0200 |
---|---|---|
committer | Bram Moolenaar <bram@vim.org> | 2013-06-15 17:54:43 +0200 |
commit | ad9e8faeec2e3b4f0f0e68e0fa5b0eb43259c167 (patch) | |
tree | d3c8a788b41387f4711bf6eb6111468979e85a62 | |
parent | ad2486f7754d4ec6c800c0ba029faaa9c7297fb6 (diff) | |
download | vim-ad9e8faeec2e3b4f0f0e68e0fa5b0eb43259c167.tar.gz |
Problem: When calling setline() from Insert mode, using CTRL-R =, undo does
not work properly. (Israel Chauca)
Solution: Sync undo after evaluating the expression. (Christian Brabandt)
-rw-r--r-- | src/edit.c | 9 | ||||
-rw-r--r-- | src/testdir/test61.in | 10 | ||||
-rw-r--r-- | src/testdir/test61.ok | 3 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 20 insertions, 4 deletions
@@ -8126,10 +8126,8 @@ ins_reg() --no_mapping; #ifdef FEAT_EVAL - /* - * Don't call u_sync() while getting the expression, - * evaluating it or giving an error message for it! - */ + /* Don't call u_sync() while typing the expression or giving an error + * message for it. Only call it explicitly. */ ++no_u_sync; if (regname == '=') { @@ -8142,6 +8140,9 @@ ins_reg() if (im_on) im_set_active(TRUE); # endif + if (regname == '=') + /* sync undo, so the effect of e.g., setline() can be undone */ + u_sync(TRUE); } if (regname == NUL || !valid_yank_reg(regname, FALSE)) { diff --git a/src/testdir/test61.in b/src/testdir/test61.in index 88831636..2602e975 100644 --- a/src/testdir/test61.in +++ b/src/testdir/test61.in @@ -84,6 +84,16 @@ ggO---:0put c ggO---:0put b ggO---:0put a ggO---:w >>test.out +:so small.vim +:set nocp +:enew! +oa +:set ul=100 +ob +:set ul=100 +o1a2=setline('.','1234') + +uu:%w >>test.out :qa! ENDTEST diff --git a/src/testdir/test61.ok b/src/testdir/test61.ok index 6e25e3bf..0e3a5250 100644 --- a/src/testdir/test61.ok +++ b/src/testdir/test61.ok @@ -41,3 +41,6 @@ one one one two two three + +a +b diff --git a/src/version.c b/src/version.c index 9e98379f..bb9edce1 100644 --- a/src/version.c +++ b/src/version.c @@ -729,6 +729,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1200, +/**/ 1199, /**/ 1198, |