mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 19:38:20 +00:00
vim-patch:8.2.2911: pattern "\%V" does not match all of block selection
Problem: Pattern "\%V" does not match all of block selection. (Rick Howe)
Solution: Use the value of vi_curswant. (closes vim/vim#8285)
e71c0ebe2c
This commit is contained in:
@@ -3755,6 +3755,7 @@ static bool reg_match_visual(void)
|
|||||||
int mode;
|
int mode;
|
||||||
colnr_T start, end;
|
colnr_T start, end;
|
||||||
colnr_T start2, end2;
|
colnr_T start2, end2;
|
||||||
|
colnr_T curswant;
|
||||||
|
|
||||||
// Check if the buffer is the current buffer.
|
// Check if the buffer is the current buffer.
|
||||||
if (rex.reg_buf != curbuf || VIsual.lnum == 0) {
|
if (rex.reg_buf != curbuf || VIsual.lnum == 0) {
|
||||||
@@ -3770,6 +3771,7 @@ static bool reg_match_visual(void)
|
|||||||
bot = VIsual;
|
bot = VIsual;
|
||||||
}
|
}
|
||||||
mode = VIsual_mode;
|
mode = VIsual_mode;
|
||||||
|
curswant = wp->w_curswant;
|
||||||
} else {
|
} else {
|
||||||
if (lt(curbuf->b_visual.vi_start, curbuf->b_visual.vi_end)) {
|
if (lt(curbuf->b_visual.vi_start, curbuf->b_visual.vi_end)) {
|
||||||
top = curbuf->b_visual.vi_start;
|
top = curbuf->b_visual.vi_start;
|
||||||
@@ -3779,6 +3781,7 @@ static bool reg_match_visual(void)
|
|||||||
bot = curbuf->b_visual.vi_start;
|
bot = curbuf->b_visual.vi_start;
|
||||||
}
|
}
|
||||||
mode = curbuf->b_visual.vi_mode;
|
mode = curbuf->b_visual.vi_mode;
|
||||||
|
curswant = curbuf->b_visual.vi_curswant;
|
||||||
}
|
}
|
||||||
lnum = rex.lnum + rex.reg_firstlnum;
|
lnum = rex.lnum + rex.reg_firstlnum;
|
||||||
if (lnum < top.lnum || lnum > bot.lnum) {
|
if (lnum < top.lnum || lnum > bot.lnum) {
|
||||||
@@ -3798,8 +3801,9 @@ static bool reg_match_visual(void)
|
|||||||
start = start2;
|
start = start2;
|
||||||
if (end2 > end)
|
if (end2 > end)
|
||||||
end = end2;
|
end = end2;
|
||||||
if (top.col == MAXCOL || bot.col == MAXCOL)
|
if (top.col == MAXCOL || bot.col == MAXCOL || curswant == MAXCOL) {
|
||||||
end = MAXCOL;
|
end = MAXCOL;
|
||||||
|
}
|
||||||
unsigned int cols_u = win_linetabsize(wp, rex.line,
|
unsigned int cols_u = win_linetabsize(wp, rex.line,
|
||||||
(colnr_T)(rex.input - rex.line));
|
(colnr_T)(rex.input - rex.line));
|
||||||
assert(cols_u <= MAXCOL);
|
assert(cols_u <= MAXCOL);
|
||||||
|
@@ -824,6 +824,26 @@ func Test_incsearch_search_dump()
|
|||||||
call delete('Xis_search_script')
|
call delete('Xis_search_script')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_hlsearch_block_visual_match()
|
||||||
|
CheckScreendump
|
||||||
|
|
||||||
|
let lines =<< trim END
|
||||||
|
set hlsearch
|
||||||
|
call setline(1, ['aa', 'bbbb', 'cccccc'])
|
||||||
|
END
|
||||||
|
call writefile(lines, 'Xhlsearch_block')
|
||||||
|
let buf = RunVimInTerminal('-S Xhlsearch_block', {'rows': 9, 'cols': 60})
|
||||||
|
|
||||||
|
call term_sendkeys(buf, "G\<C-V>$kk\<Esc>")
|
||||||
|
sleep 100m
|
||||||
|
call term_sendkeys(buf, "/\\%V\<CR>")
|
||||||
|
sleep 100m
|
||||||
|
call VerifyScreenDump(buf, 'Test_hlsearch_block_visual_match', {})
|
||||||
|
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
|
call delete('Xhlsearch_block')
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_incsearch_substitute()
|
func Test_incsearch_substitute()
|
||||||
CheckFunction test_override
|
CheckFunction test_override
|
||||||
CheckOption incsearch
|
CheckOption incsearch
|
||||||
|
Reference in New Issue
Block a user