Skip to content

Commit f8eb9c5

Browse files
committed
patch 8.0.0140
Problem: Pasting inserted text in Visual mode does not work properly. (Matthew Malcomson) Solution: Stop Visual mode before stuffing the inserted text. (Christian Brabandt, from neovim #5709)
1 parent 5e1e6d2 commit f8eb9c5

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

src/ops.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3351,6 +3351,8 @@ do_put(
33513351
*/
33523352
if (regname == '.')
33533353
{
3354+
if (VIsual_active)
3355+
stuffcharReadbuff(VIsual_mode);
33543356
(void)stuff_inserted((dir == FORWARD ? (count == -1 ? 'o' : 'a') :
33553357
(count == -1 ? 'O' : 'i')), count, FALSE);
33563358
/* Putting the text is done later, so can't really move the cursor to

src/testdir/test_visual.vim

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
1-
" Tests for Visual mode. Uses double-wide character.
2-
if !has('multi_byte')
3-
finish
4-
endif
5-
1+
" Tests for various Visual mode.
62
if !has('visual')
73
finish
84
endif
95

106
func Test_block_shift_multibyte()
7+
" Uses double-wide character.
8+
if !has('multi_byte')
9+
return
10+
endif
1111
split
1212
call setline(1, ['xヹxxx', 'ヹxxx'])
1313
exe "normal 1G0l\<C-V>jl>"
1414
call assert_equal('x ヹxxx', getline(1))
1515
call assert_equal(' ヹxxx', getline(2))
1616
q!
1717
endfunc
18+
19+
func Test_dotregister_paste()
20+
new
21+
exe "norm! ihello world\<esc>"
22+
norm! 0ve".p
23+
call assert_equal('hello world world', getline(1))
24+
q!
25+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
140,
767769
/**/
768770
139,
769771
/**/

0 commit comments

Comments
 (0)