diff options
author | Patrick <patrick@bitscope.com> | 2016-07-12 11:27:56 +1000 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-07-18 11:39:40 -0400 |
commit | 8c1fb99d2d4058d2cc1decbfed89b1f73b38cef6 (patch) | |
tree | 007c237b4a9c0a2b0dd602f184bf835481668b0b /src/nvim/ops.c | |
parent | 7563972fd9d89fcce4bab183694ab16efef122c0 (diff) | |
download | rneovim-8c1fb99d2d4058d2cc1decbfed89b1f73b38cef6.tar.gz rneovim-8c1fb99d2d4058d2cc1decbfed89b1f73b38cef6.tar.bz2 rneovim-8c1fb99d2d4058d2cc1decbfed89b1f73b38cef6.zip |
vim-patch:7.4.1491 #5048
Problem: Visual-block shift breaks multi-byte characters.
Solution: Compute column differently. (Yasuhiro Matsumoto) Add a test.
https://github.com/vim/vim/commit/20b4f463f4ab50fa9bcc9838aa94101fa5698125
Diffstat (limited to 'src/nvim/ops.c')
-rw-r--r-- | src/nvim/ops.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 25b3b85497..e8a79fa820 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -339,10 +339,16 @@ static void shift_block(oparg_T *oap, int amount) total += bd.pre_whitesp; /* all virtual WS up to & incl a split TAB */ ws_vcol = bd.start_vcol - bd.pre_whitesp; if (bd.startspaces) { - if (has_mbyte) - bd.textstart += (*mb_ptr2len)(bd.textstart); - else - ++bd.textstart; + if (has_mbyte) { + if ((*mb_ptr2len)(bd.textstart) == 1) { + bd.textstart++; + } else { + ws_vcol = 0; + bd.startspaces = 0; + } + } else { + bd.textstart++; + } } for (; ascii_iswhite(*bd.textstart); ) { // TODO: is passing bd.textstart for start of the line OK? |