mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.0887: searchcount().exact_match is 1 right after a match
Problem: Searchcount().exact_match is 1 right after a match.
Solution: Use LT_POS() instead of LTOREQ_POS(). (closes vim/vim#6189)
57f75a5a36
This commit is contained in:
parent
5c404ad0fa
commit
973ecd8e90
@ -4489,7 +4489,7 @@ static void update_search_stat(int dirc, pos_T *pos, pos_T *cursor_pos,
|
|||||||
cnt++;
|
cnt++;
|
||||||
if (ltoreq(lastpos, p)) {
|
if (ltoreq(lastpos, p)) {
|
||||||
cur = cnt;
|
cur = cnt;
|
||||||
if (ltoreq(p, endpos)) {
|
if (lt(p, endpos)) {
|
||||||
exact_match = true;
|
exact_match = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,14 @@ func Test_search_stat()
|
|||||||
call assert_equal(
|
call assert_equal(
|
||||||
\ #{current: 1, exact_match: 1, total: 10, incomplete: 0, maxcount: 99},
|
\ #{current: 1, exact_match: 1, total: 10, incomplete: 0, maxcount: 99},
|
||||||
\ searchcount(#{pattern: 'fooooobar', pos: [3, 1, 0]}))
|
\ searchcount(#{pattern: 'fooooobar', pos: [3, 1, 0]}))
|
||||||
|
" on last char of match
|
||||||
|
call assert_equal(
|
||||||
|
\ #{current: 1, exact_match: 1, total: 10, incomplete: 0, maxcount: 99},
|
||||||
|
\ searchcount(#{pattern: 'fooooobar', pos: [3, 9, 0]}))
|
||||||
|
" on char after match
|
||||||
|
call assert_equal(
|
||||||
|
\ #{current: 1, exact_match: 0, total: 10, incomplete: 0, maxcount: 99},
|
||||||
|
\ searchcount(#{pattern: 'fooooobar', pos: [3, 10, 0]}))
|
||||||
call assert_equal(
|
call assert_equal(
|
||||||
\ #{current: 1, exact_match: 0, total: 10, incomplete: 0, maxcount: 99},
|
\ #{current: 1, exact_match: 0, total: 10, incomplete: 0, maxcount: 99},
|
||||||
\ searchcount(#{pattern: 'fooooobar', pos: [4, 1, 0]}))
|
\ searchcount(#{pattern: 'fooooobar', pos: [4, 1, 0]}))
|
||||||
|
Loading…
Reference in New Issue
Block a user