mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 01:34:25 +00:00 
			
		
		
		
	vim-patch:7.4.408
Problem: Visual block insert breaks a multi-byte character. Solution: Calculate the position properly. (Yasuhiro Matsumoto) https://code.google.com/p/vim/source/detail?r=v7-4-408
This commit is contained in:
		@@ -512,6 +512,20 @@ static void block_insert(oparg_T *oap, char_u *s, int b_insert, struct block_def
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (has_mbyte && spaces > 0) {
 | 
			
		||||
      // Avoid starting halfway a multi-byte character.
 | 
			
		||||
      if (b_insert) {
 | 
			
		||||
        int off = (*mb_head_off)(oldp, oldp + offset + spaces);
 | 
			
		||||
        spaces -= off;
 | 
			
		||||
        count -= off;
 | 
			
		||||
      } else {
 | 
			
		||||
        int off = (*mb_off_next)(oldp, oldp + offset);
 | 
			
		||||
        offset += off;
 | 
			
		||||
        spaces = 0;
 | 
			
		||||
        count = 0;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    newp = (char_u *) xmalloc((size_t)(STRLEN(oldp) + s_len + count + 1));
 | 
			
		||||
 | 
			
		||||
    /* copy up to shifted part */
 | 
			
		||||
 
 | 
			
		||||
@@ -35,7 +35,8 @@ SCRIPTS := test_autoformat_join.out                                    \
 | 
			
		||||
           test_listlbr.out test_listlbr_utf8.out                      \
 | 
			
		||||
           test_changelist.out                                         \
 | 
			
		||||
           test_breakindent.out                                        \
 | 
			
		||||
           test_insertcount.out
 | 
			
		||||
           test_insertcount.out                                        \
 | 
			
		||||
           test_utf8.out
 | 
			
		||||
 | 
			
		||||
SCRIPTS_GUI := test16.out
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										18
									
								
								src/nvim/testdir/test_utf8.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								src/nvim/testdir/test_utf8.in
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
Tests for Unicode manipulations
 | 
			
		||||
 | 
			
		||||
STARTTEST
 | 
			
		||||
:so small.vim
 | 
			
		||||
:set encoding=utf-8
 | 
			
		||||
:" Visual block Insert adjusts for multi-byte char
 | 
			
		||||
:new
 | 
			
		||||
:call setline(1, ["aaa", "あああ", "bbb"])
 | 
			
		||||
:exe ":norm! gg0l\<C-V>jjIx\<Esc>"
 | 
			
		||||
:let r = getline(1, '$')
 | 
			
		||||
:
 | 
			
		||||
:bwipeout!
 | 
			
		||||
:$put=r
 | 
			
		||||
:call garbagecollect(1)
 | 
			
		||||
:/^start:/,$wq! test.out
 | 
			
		||||
ENDTEST
 | 
			
		||||
 | 
			
		||||
start:
 | 
			
		||||
							
								
								
									
										4
									
								
								src/nvim/testdir/test_utf8.ok
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								src/nvim/testdir/test_utf8.ok
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
start:
 | 
			
		||||
axaa
 | 
			
		||||
xあああ
 | 
			
		||||
bxbb
 | 
			
		||||
@@ -224,7 +224,7 @@ static int included_patches[] = {
 | 
			
		||||
  411,
 | 
			
		||||
  410,
 | 
			
		||||
  //409 NA
 | 
			
		||||
  //408,
 | 
			
		||||
  408,
 | 
			
		||||
  407,
 | 
			
		||||
  //406,
 | 
			
		||||
  405,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user