mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 21:48:35 +00:00
vim-patch:8.2.4219: reading before the start of the line
Problem: Reading before the start of the line.
Solution: Check boundary before trying to read the character.
44db8213d3
This commit is contained in:
@@ -2801,7 +2801,7 @@ static void yank_copy_line(yankreg_T *reg, struct block_def *bd, size_t y_idx,
|
|||||||
if (exclude_trailing_space) {
|
if (exclude_trailing_space) {
|
||||||
int s = bd->textlen + bd->endspaces;
|
int s = bd->textlen + bd->endspaces;
|
||||||
|
|
||||||
while (ascii_iswhite(*(bd->textstart + s - 1)) && s > 0) {
|
while (s > 0 && ascii_iswhite(*(bd->textstart + s - 1))) {
|
||||||
s = s - utf_head_off(bd->textstart, bd->textstart + s - 1) - 1;
|
s = s - utf_head_off(bd->textstart, bd->textstart + s - 1) - 1;
|
||||||
pnew--;
|
pnew--;
|
||||||
}
|
}
|
||||||
|
@@ -1103,6 +1103,13 @@ func Test_visual_put_blockedit_zy_and_zp()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_visual_block_yank_zy()
|
||||||
|
new
|
||||||
|
" this was reading before the start of the line
|
||||||
|
exe "norm o\<C-T>\<Esc>\<C-V>zy"
|
||||||
|
bwipe!
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_visual_block_with_virtualedit()
|
func Test_visual_block_with_virtualedit()
|
||||||
CheckScreendump
|
CheckScreendump
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user