mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
Make CTRL-L in command line mode respect 'ignorecase' and 'smartcase'. (Martin
Toft)
This commit is contained in:
@@ -416,7 +416,10 @@ CTRL-L A match is done on the pattern in front of the cursor. If
|
|||||||
than the pattern, no completion is done.
|
than the pattern, no completion is done.
|
||||||
When 'incsearch' is set, entering a search pattern for "/" or
|
When 'incsearch' is set, entering a search pattern for "/" or
|
||||||
"?" and the current match is displayed then CTRL-L will add
|
"?" and the current match is displayed then CTRL-L will add
|
||||||
one character from the end of the current match.
|
one character from the end of the current match. If
|
||||||
|
'ignorecase' and 'smartcase' are set and the command line has
|
||||||
|
no uppercase characters, the added character is converted to
|
||||||
|
lowercase.
|
||||||
|
|
||||||
The 'wildchar' option defaults to <Tab> (CTRL-E when in Vi compatible mode; in
|
The 'wildchar' option defaults to <Tab> (CTRL-E when in Vi compatible mode; in
|
||||||
a previous version <Esc> was used). In the pattern standard wildcards '*' and
|
a previous version <Esc> was used). In the pattern standard wildcards '*' and
|
||||||
|
@@ -3976,7 +3976,9 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
The highlighting can be set with the 'i' flag in 'highlight'.
|
The highlighting can be set with the 'i' flag in 'highlight'.
|
||||||
See also: 'hlsearch'.
|
See also: 'hlsearch'.
|
||||||
CTRL-L can be used to add one character from after the current match
|
CTRL-L can be used to add one character from after the current match
|
||||||
to the command line.
|
to the command line. If 'ignorecase' and 'smartcase' are set and the
|
||||||
|
command line has no uppercase characters, the added character is
|
||||||
|
converted to lowercase.
|
||||||
CTRL-R CTRL-W can be used to add the word at the end of the current
|
CTRL-R CTRL-W can be used to add the word at the end of the current
|
||||||
match, excluding the characters that were already typed.
|
match, excluding the characters that were already typed.
|
||||||
NOTE: This option is reset when 'compatible' is set.
|
NOTE: This option is reset when 'compatible' is set.
|
||||||
|
@@ -1088,14 +1088,16 @@ Patch to support horizontal scroll wheel in GTK. Untested. (Bjorn Winckler,
|
|||||||
2010 Jun 30)
|
2010 Jun 30)
|
||||||
|
|
||||||
|
|
||||||
|
Before (beta) release 7.3:
|
||||||
|
- Add fixes for 7.2 to version7.txt
|
||||||
|
- Rename vim73 branch to default (hints: Xavier de Gaye, 2010 May 23)
|
||||||
|
|
||||||
Vim 7.3:
|
Vim 7.3:
|
||||||
|
configure: -pthread appears in cproto arguments, from GTK
|
||||||
- Soon: remove UF_VERSION_CRYPT_PREV and UF_VERSION_PREV.
|
- Soon: remove UF_VERSION_CRYPT_PREV and UF_VERSION_PREV.
|
||||||
- Conceal feature: no update when moving to another window. (Dominique Pelle,
|
- Conceal feature: no update when moving to another window. (Dominique Pelle,
|
||||||
2010 Jul 5) Vince will look into it.
|
2010 Jul 5) Vince will look into it.
|
||||||
Patches to possibly include:
|
Patches to possibly include:
|
||||||
- Patch for gtk main_loop() to enable GtkFileChooser. (James Vega, 2010 Jun 28)
|
|
||||||
Same as this one? GTK: file chooser is disabled. Patch by Tim Starling,
|
|
||||||
2009 Nov 13.
|
|
||||||
- Patch to make CTRL-L work better with 'ignorecase' and 'smartcase'. (Martin
|
- Patch to make CTRL-L work better with 'ignorecase' and 'smartcase'. (Martin
|
||||||
Toft, 2010 Jun 8, Jun 16, Jun 30)
|
Toft, 2010 Jun 8, Jun 16, Jun 30)
|
||||||
- Patch to add diff functionality to 2html.vim. (Christian Brabandt, 2009 Dec
|
- Patch to add diff functionality to 2html.vim. (Christian Brabandt, 2009 Dec
|
||||||
@@ -1157,9 +1159,6 @@ Probably not now:
|
|||||||
- Use timestamps for undo, so that a version a certain time ago can be found
|
- Use timestamps for undo, so that a version a certain time ago can be found
|
||||||
and info before some time/date can be flushed. 'undopersist' gives maximum
|
and info before some time/date can be flushed. 'undopersist' gives maximum
|
||||||
time to keep undo: "3h", "1d", "2w", "1y", etc.
|
time to keep undo: "3h", "1d", "2w", "1y", etc.
|
||||||
Before (beta) release:
|
|
||||||
- Add fixes for 7.2 to version7.txt
|
|
||||||
- Rename vim73 branch to default (hints: Xavier de Gaye, 2010 May 23)
|
|
||||||
|
|
||||||
|
|
||||||
More patches:
|
More patches:
|
||||||
|
@@ -1411,6 +1411,11 @@ getcmdline(firstc, count, indent)
|
|||||||
&& !equalpos(curwin->w_cursor, old_cursor))
|
&& !equalpos(curwin->w_cursor, old_cursor))
|
||||||
{
|
{
|
||||||
c = gchar_cursor();
|
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))
|
||||||
|
c = MB_TOLOWER(c);
|
||||||
if (c != NUL)
|
if (c != NUL)
|
||||||
{
|
{
|
||||||
if (c == firstc || vim_strchr((char_u *)(
|
if (c == firstc || vim_strchr((char_u *)(
|
||||||
|
@@ -9606,7 +9606,7 @@ FreeWild(count, files)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* return TRUE when need to go to Insert mode because of 'insertmode'.
|
* Return TRUE when need to go to Insert mode because of 'insertmode'.
|
||||||
* Don't do this when still processing a command or a mapping.
|
* Don't do this when still processing a command or a mapping.
|
||||||
* Don't do this when inside a ":normal" command.
|
* Don't do this when inside a ":normal" command.
|
||||||
*/
|
*/
|
||||||
|
@@ -6,6 +6,7 @@ void save_search_patterns __ARGS((void));
|
|||||||
void restore_search_patterns __ARGS((void));
|
void restore_search_patterns __ARGS((void));
|
||||||
void free_search_patterns __ARGS((void));
|
void free_search_patterns __ARGS((void));
|
||||||
int ignorecase __ARGS((char_u *pat));
|
int ignorecase __ARGS((char_u *pat));
|
||||||
|
int pat_has_uppercase __ARGS((char_u *pat));
|
||||||
char_u *last_search_pat __ARGS((void));
|
char_u *last_search_pat __ARGS((void));
|
||||||
void reset_search_dir __ARGS((void));
|
void reset_search_dir __ARGS((void));
|
||||||
void set_last_search_pat __ARGS((char_u *s, int idx, int magic, int setlast));
|
void set_last_search_pat __ARGS((char_u *s, int idx, int magic, int setlast));
|
||||||
|
38
src/search.c
38
src/search.c
@@ -365,18 +365,29 @@ free_search_patterns()
|
|||||||
ignorecase(pat)
|
ignorecase(pat)
|
||||||
char_u *pat;
|
char_u *pat;
|
||||||
{
|
{
|
||||||
char_u *p;
|
int ic = p_ic;
|
||||||
int ic;
|
|
||||||
|
|
||||||
ic = p_ic;
|
|
||||||
if (ic && !no_smartcase && p_scs
|
if (ic && !no_smartcase && p_scs
|
||||||
#ifdef FEAT_INS_EXPAND
|
#ifdef FEAT_INS_EXPAND
|
||||||
&& !(ctrl_x_mode && curbuf->b_p_inf)
|
&& !(ctrl_x_mode && curbuf->b_p_inf)
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
ic = !pat_has_uppercase(pat);
|
||||||
/* don't ignore case if pattern has uppercase */
|
no_smartcase = FALSE;
|
||||||
for (p = pat; *p; )
|
|
||||||
|
return ic;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return TRUE if patter "pat" has an uppercase character.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
pat_has_uppercase(pat)
|
||||||
|
char_u *pat;
|
||||||
|
{
|
||||||
|
char_u *p = pat;
|
||||||
|
|
||||||
|
while (*p != NUL)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
#ifdef FEAT_MBYTE
|
||||||
int l;
|
int l;
|
||||||
@@ -384,10 +395,7 @@ ignorecase(pat)
|
|||||||
if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1)
|
if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1)
|
||||||
{
|
{
|
||||||
if (enc_utf8 && utf_isupper(utf_ptr2char(p)))
|
if (enc_utf8 && utf_isupper(utf_ptr2char(p)))
|
||||||
{
|
return TRUE;
|
||||||
ic = FALSE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
p += l;
|
p += l;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -404,17 +412,11 @@ ignorecase(pat)
|
|||||||
p += 1;
|
p += 1;
|
||||||
}
|
}
|
||||||
else if (MB_ISUPPER(*p))
|
else if (MB_ISUPPER(*p))
|
||||||
{
|
return TRUE;
|
||||||
ic = FALSE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
}
|
return FALSE;
|
||||||
no_smartcase = FALSE;
|
|
||||||
|
|
||||||
return ic;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char_u *
|
char_u *
|
||||||
|
Reference in New Issue
Block a user