diff options
author | Florian Walch <florian@fwalch.com> | 2015-01-03 16:01:17 +0100 |
---|---|---|
committer | Florian Walch <florian@fwalch.com> | 2015-01-03 16:08:51 +0100 |
commit | ceb54c55ad779b08caf7fbb55fb3460d90352a52 (patch) | |
tree | 99e5a34c92bd17252908026523ef038078e02fdc /src | |
parent | d61111530541f74df89c010e5edfb633a412dc72 (diff) | |
download | rneovim-ceb54c55ad779b08caf7fbb55fb3460d90352a52.tar.gz rneovim-ceb54c55ad779b08caf7fbb55fb3460d90352a52.tar.bz2 rneovim-ceb54c55ad779b08caf7fbb55fb3460d90352a52.zip |
vim-patch:7.4.559
Problem: Appending a block in the middle of a tab does not work correctly
when virtualedit is set.
Solution: Decrement spaces and count, don't reset them. (James McCoy)
https://code.google.com/p/vim/source/detail?r=v7-4-559
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ops.c | 12 | ||||
-rw-r--r-- | src/nvim/testdir/test39.in | 9 | ||||
-rw-r--r-- | src/nvim/testdir/test39.ok | bin | 514 -> 584 bytes | |||
-rw-r--r-- | src/nvim/version.c | 2 |
4 files changed, 13 insertions, 10 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 9b33b6732c..3cefc9f623 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -515,17 +515,17 @@ static void block_insert(oparg_T *oap, char_u *s, int b_insert, struct block_def } if (has_mbyte && spaces > 0) { + int off; + // Avoid starting halfway a multi-byte character. if (b_insert) { - int off = (*mb_head_off)(oldp, oldp + offset + spaces); - spaces -= off; - count -= off; + off = (*mb_head_off)(oldp, oldp + offset + spaces); } else { - int off = (*mb_off_next)(oldp, oldp + offset); + off = (*mb_off_next)(oldp, oldp + offset); offset += off; - spaces = 0; - count = 0; } + spaces -= off; + count -= off; } newp = (char_u *) xmalloc((size_t)(STRLEN(oldp) + s_len + count + 1)); diff --git a/src/nvim/testdir/test39.in b/src/nvim/testdir/test39.in index 7d1c672522..18da1b245a 100644 --- a/src/nvim/testdir/test39.in +++ b/src/nvim/testdir/test39.in @@ -38,11 +38,14 @@ G$khhhhhkkcmno /^C23$/ :exe ":norm! l\<C-V>j$hhAab\<Esc>" :.,/^$/w >> test.out -:" Test for Visual block insert when virtualedit=all -:set ve=all +:" Test for Visual block insert when virtualedit=all and utf-8 encoding +:set ve=all enc=utf-8 :/\t\tline :exe ":norm! 07l\<C-V>jjIx\<Esc>" -:set ve= +:.,/^$/w >> test.out +:" Test for Visual block append when virtualedit=all +:exe ":norm! 012l\<C-v>jjAx\<Esc>" +:set ve= enc=latin1 :.,/^$/w >> test.out :" gUe must uppercase a whole word, also when ß changes to SS Gothe youtußeuu endYpk0wgUe diff --git a/src/nvim/testdir/test39.ok b/src/nvim/testdir/test39.ok Binary files differindex d8e901563a..5c517e2223 100644 --- a/src/nvim/testdir/test39.ok +++ b/src/nvim/testdir/test39.ok diff --git a/src/nvim/version.c b/src/nvim/version.c index c1fe19bb9c..561ba008e1 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -179,7 +179,7 @@ static char *(features[]) = { static int included_patches[] = { //560 NA - //559, + 559, //558 NA //557 NA //556 NA |