diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-04-11 13:45:57 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-04-11 13:45:57 +0200 |
commit | 730f48fe3691dc62331f3df23cb947bfc33a5add (patch) | |
tree | cfedff294d2336462fcd0c0db5c56a68673d963a /src/ex_getln.c | |
parent | a60e536a290f7c14cf2b255ddb7071b39619fcd3 (diff) |
patch 8.1.1148: CTRL-L with 'incsearch' does not pick up char under cursorv8.1.1148
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)
Diffstat (limited to 'src/ex_getln.c')
-rw-r--r-- | src/ex_getln.c | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c index 52eda33c73..e6bb815b45 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -745,39 +745,35 @@ may_add_char_to_search(int firstc, int *c, incsearch_state_T *is_state) if (is_state->did_incsearch) { curwin->w_cursor = is_state->match_end; - if (!EQUAL_POS(curwin->w_cursor, is_state->search_start)) + *c = gchar_cursor(); + if (*c != NUL) { - *c = gchar_cursor(); - // If 'ignorecase' and 'smartcase' are set and the // command line has no uppercase characters, convert // the character to lowercase. if (p_ic && p_scs && !pat_has_uppercase(ccline.cmdbuff + skiplen)) *c = MB_TOLOWER(*c); - if (*c != NUL) + if (*c == firstc || vim_strchr((char_u *)( + p_magic ? "\\~^$.*[" : "\\^$"), *c) != NULL) + { + // put a backslash before special characters + stuffcharReadbuff(*c); + *c = '\\'; + } + // add any composing characters + if (mb_char2len(*c) != mb_ptr2len(ml_get_cursor())) { - if (*c == firstc || vim_strchr((char_u *)( - p_magic ? "\\~^$.*[" : "\\^$"), *c) != NULL) + int save_c = *c; + + while (mb_char2len(*c) != mb_ptr2len(ml_get_cursor())) { - // put a backslash before special characters + curwin->w_cursor.col += mb_char2len(*c); + *c = gchar_cursor(); stuffcharReadbuff(*c); - *c = '\\'; } - // add any composing characters - if (mb_char2len(*c) != mb_ptr2len(ml_get_cursor())) - { - int save_c = *c; - - while (mb_char2len(*c) != mb_ptr2len(ml_get_cursor())) - { - curwin->w_cursor.col += mb_char2len(*c); - *c = gchar_cursor(); - stuffcharReadbuff(*c); - } - *c = save_c; - } - return FAIL; + *c = save_c; } + return FAIL; } } return OK; |