mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 8.1.1148: CTRL-L with 'incsearch' does not pick up char under cursor
Problem: CTRL-L with 'incsearch' does not pick up char under cursor. (Smylers) Solution: Do not compare the position with the cursor position. (Hirohito Higashi, closes #3620)
This commit is contained in:
@@ -745,17 +745,14 @@ may_add_char_to_search(int firstc, int *c, incsearch_state_T *is_state)
|
|||||||
if (is_state->did_incsearch)
|
if (is_state->did_incsearch)
|
||||||
{
|
{
|
||||||
curwin->w_cursor = is_state->match_end;
|
curwin->w_cursor = is_state->match_end;
|
||||||
if (!EQUAL_POS(curwin->w_cursor, is_state->search_start))
|
|
||||||
{
|
|
||||||
*c = gchar_cursor();
|
*c = gchar_cursor();
|
||||||
|
if (*c != NUL)
|
||||||
|
{
|
||||||
// If 'ignorecase' and 'smartcase' are set and the
|
// If 'ignorecase' and 'smartcase' are set and the
|
||||||
// command line has no uppercase characters, convert
|
// command line has no uppercase characters, convert
|
||||||
// the character to lowercase.
|
// the character to lowercase.
|
||||||
if (p_ic && p_scs && !pat_has_uppercase(ccline.cmdbuff + skiplen))
|
if (p_ic && p_scs && !pat_has_uppercase(ccline.cmdbuff + skiplen))
|
||||||
*c = MB_TOLOWER(*c);
|
*c = MB_TOLOWER(*c);
|
||||||
if (*c != NUL)
|
|
||||||
{
|
|
||||||
if (*c == firstc || vim_strchr((char_u *)(
|
if (*c == firstc || vim_strchr((char_u *)(
|
||||||
p_magic ? "\\~^$.*[" : "\\^$"), *c) != NULL)
|
p_magic ? "\\~^$.*[" : "\\^$"), *c) != NULL)
|
||||||
{
|
{
|
||||||
@@ -779,7 +776,6 @@ may_add_char_to_search(int firstc, int *c, incsearch_state_T *is_state)
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1248,3 +1248,20 @@ func Test_one_error_msg()
|
|||||||
" This was also giving an internal error
|
" This was also giving an internal error
|
||||||
call assert_fails('call search(" \\((\\v[[=P=]]){185}+ ")', 'E871:')
|
call assert_fails('call search(" \\((\\v[[=P=]]){185}+ ")', 'E871:')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_incsearch_add_char_under_cursor()
|
||||||
|
if !exists('+incsearch')
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
set incsearch
|
||||||
|
new
|
||||||
|
call setline(1, ['find match', 'anything'])
|
||||||
|
1
|
||||||
|
call test_override('char_avail', 1)
|
||||||
|
call feedkeys("fc/m\<C-L>\<C-L>\<C-L>\<C-L>\<C-L>\<CR>", 'tx')
|
||||||
|
call assert_equal('match', @/)
|
||||||
|
call test_override('char_avail', 0)
|
||||||
|
|
||||||
|
set incsearch&
|
||||||
|
bwipe!
|
||||||
|
endfunc
|
||||||
|
@@ -771,6 +771,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1148,
|
||||||
/**/
|
/**/
|
||||||
1147,
|
1147,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user