Skip to content

Commit d25f003

Browse files
committed
patch 9.0.0011: reading beyond the end of the line with put command
Problem: Reading beyond the end of the line with put command. Solution: Adjust the end mark position.
1 parent b0375d4 commit d25f003

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

Diff for: src/register.c

+2
Original file line numberDiff line numberDiff line change
@@ -1918,6 +1918,8 @@ do_put(
19181918
vim_memset(ptr, ' ', (size_t)spaces);
19191919
ptr += spaces;
19201920
}
1921+
else
1922+
totlen -= spaces; // didn't use these spaces
19211923
}
19221924

19231925
// may insert some spaces after the new text

Diff for: src/testdir/test_put.vim

+12
Original file line numberDiff line numberDiff line change
@@ -219,5 +219,17 @@ func Test_put_empty_register()
219219
bwipe!
220220
endfunc
221221

222+
" this was putting the end mark after the end of the line
223+
func Test_put_visual_mode()
224+
edit! SomeNewBuffer
225+
set selection=exclusive
226+
exe "norm o\t"
227+
m0
228+
sil! norm pp
229+
230+
bwipe!
231+
set selection&
232+
endfunc
233+
222234

223235
" vim: shiftwidth=2 sts=2 expandtab

Diff for: src/version.c

+2
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,8 @@ static char *(features[]) =
735735

736736
static int included_patches[] =
737737
{ /* Add new patch number below this line */
738+
/**/
739+
11,
738740
/**/
739741
10,
740742
/**/

0 commit comments

Comments
 (0)