Hi Martin,
thanks for looking into it!

I just remembered one thing, though:

If there's already something upper case in the search pattern and the
new char is converted to lower case, the pattern will again stop
matching! Maybe the search pattern needs to be scanned for case
inside  the "if (p_ic && p_scs)" and only convert to lower case if the
search pattern is already only lower case (i.e. not triggering the
case sensitivity of 'smartcase')?

/Erik


On Jun 5, 11:07 pm, Martin Toft <[email protected]> wrote:
> Hi,
>
> this patch addresses the following bug:
>
>     When 'smartcase' is set and using CTRL-L to add to the search
>     pattern it may result in no matches.  Convert chars to lower case?
>     (Erik Wognsen, 2009 Apr 16)
>
> The description is taken 
> fromhttp://code.google.com/p/vim/source/browse/runtime/doc/todo.txt?r=631...
> and the original mail thread describing the problem 
> ishttp://groups.google.com/group/vim_use/browse_thread/thread/7321c95eb...
>
> The patch does what the description suggests, i.e. the added character
> is converted to lowercase if 'ignorecase' and 'smartcase' are set and
> CTRL-L is pressed during an incremental search.
>
> Martin
>
> diff -r 63157185aea5 runtime/doc/cmdline.txt
> --- a/runtime/doc/cmdline.txt   Sat Jun 05 12:49:46 2010 +0200
> +++ b/runtime/doc/cmdline.txt   Sat Jun 05 20:58:28 2010 +0200
> @@ -416,7 +416,9 @@
>                 than the pattern, no completion is done.
>                 When 'incsearch' is set, entering a search pattern for "/" or
>                 "?" 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, the added character is
> +               converted to lowercase.
>
>  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
> diff -r 63157185aea5 runtime/doc/options.txt
> --- a/runtime/doc/options.txt   Sat Jun 05 12:49:46 2010 +0200
> +++ b/runtime/doc/options.txt   Sat Jun 05 20:58:28 2010 +0200
> @@ -3939,7 +3939,8 @@
>         The highlighting can be set with the 'i' flag in 'highlight'.
>         See also: 'hlsearch'.
>         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, the
> +       added character is converted to lowercase.
>         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.
>         NOTE: This option is reset when 'compatible' is set.
> diff -r 63157185aea5 src/ex_getln.c
> --- a/src/ex_getln.c    Sat Jun 05 12:49:46 2010 +0200
> +++ b/src/ex_getln.c    Sat Jun 05 20:58:28 2010 +0200
> @@ -1411,6 +1411,10 @@
>                                    && !equalpos(curwin->w_cursor, old_cursor))
>                     {
>                         c = gchar_cursor();
> +                       /* If 'ignorecase' and 'smartcase' are set, convert 
> the
> +                        * character to lowercase */
> +                       if (p_ic && p_scs)
> +                           c = MB_TOLOWER(c);
>                         if (c != NUL)
>                         {
>                             if (c == firstc || vim_strchr((char_u *)(

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui