To: vim_dev@googlegroups.com Subject: Patch 7.4.1491 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1491 Problem: Visual-block shift breaks multi-byte characters. Solution: Compute column differently. (Yasuhiro Matsumoto) Add a test. Files: src/ops.c, src/testdir/test_visual.vim, src/testdir/Make_all.mak *** ../vim-7.4.1490/src/ops.c 2016-01-30 19:39:45.281838574 +0100 --- src/ops.c 2016-03-05 17:13:01.555097191 +0100 *************** *** 410,416 **** { #ifdef FEAT_MBYTE if (has_mbyte) ! bd.textstart += (*mb_ptr2len)(bd.textstart); else #endif ++bd.textstart; --- 410,424 ---- { #ifdef FEAT_MBYTE if (has_mbyte) ! { ! if ((*mb_ptr2len)(bd.textstart) == 1) ! ++bd.textstart; ! else ! { ! ws_vcol = 0; ! bd.startspaces = 0; ! } ! } else #endif ++bd.textstart; *** ../vim-7.4.1490/src/testdir/test_visual.vim 2016-03-05 17:24:48.907733298 +0100 --- src/testdir/test_visual.vim 2016-03-05 17:21:52.697566126 +0100 *************** *** 0 **** --- 1,19 ---- + " Tests for Visual mode + if !has('multi_byte') + finish + endif + set encoding=utf-8 + scriptencoding utf-8 + + if !has('visual') + finish + endif + + func Test_block_shift_multibyte() + split + call setline(1, ['xヹxxx', 'ヹxxx']) + exe "normal 1G0l\jl>" + call assert_equal('x ヹxxx', getline(1)) + call assert_equal(' ヹxxx', getline(2)) + q! + endfunc *** ../vim-7.4.1490/src/testdir/Make_all.mak 2016-03-04 22:12:07.448524475 +0100 --- src/testdir/Make_all.mak 2016-03-05 17:21:09.194019169 +0100 *************** *** 184,189 **** --- 184,190 ---- test_syntax.res \ test_viminfo.res \ test_viml.res \ + test_visual.res \ test_alot.res *** ../vim-7.4.1490/src/version.c 2016-03-04 23:08:21.908818684 +0100 --- src/version.c 2016-03-05 17:22:31.389163192 +0100 *************** *** 745,746 **** --- 745,748 ---- { /* Add new patch number below this line */ + /**/ + 1491, /**/ -- "You're fired." (1980) "You're laid off." (1985) "You're downsized." (1990) "You're rightsized." (1992) (Scott Adams - The Dilbert principle) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///