mirror of
https://github.com/neovim/neovim.git
synced 2025-09-23 03:28:33 +00:00
vim-patch:8.2.3494: illegal memory access in utf_head_off
Problem: Illegal memory access in utf_head_off.
Solution: Check cursor position when reselecting the Visual area.
(closes vim/vim#8963)
b07626d4af
Including the XTest_beval -> XTest_block from patch 8.2.3096.
This commit is contained in:
@@ -5963,11 +5963,8 @@ static void nv_visual(cmdarg_T *cap)
|
||||
* was only one -- webb
|
||||
*/
|
||||
if (resel_VIsual_mode != 'v' || resel_VIsual_line_count > 1) {
|
||||
curwin->w_cursor.lnum +=
|
||||
resel_VIsual_line_count * cap->count0 - 1;
|
||||
if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count) {
|
||||
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
|
||||
}
|
||||
curwin->w_cursor.lnum += resel_VIsual_line_count * cap->count0 - 1;
|
||||
check_cursor();
|
||||
}
|
||||
VIsual_mode = resel_VIsual_mode;
|
||||
if (VIsual_mode == 'v') {
|
||||
|
@@ -1120,7 +1120,27 @@ func Test_visual_block_with_virtualedit()
|
||||
" clean up
|
||||
call term_sendkeys(buf, "\<Esc>")
|
||||
call StopVimInTerminal(buf)
|
||||
call delete('XTest_beval')
|
||||
call delete('XTest_block')
|
||||
endfunc
|
||||
|
||||
func Test_visual_reselect_with_count()
|
||||
" this was causing an illegal memory access
|
||||
let lines =<< trim END
|
||||
|
||||
|
||||
|
||||
:
|
||||
r<sfile>
|
||||
exe "%norm e3\<c-v>kr\t"
|
||||
:
|
||||
|
||||
:
|
||||
END
|
||||
call writefile(lines, 'XvisualReselect')
|
||||
source XvisualReselect
|
||||
|
||||
bwipe!
|
||||
call delete('XvisualReselect')
|
||||
endfunc
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user