Am I going in the wrong direction with this?

I have attached an ordinary Mercual-diff, in case my earlier context
diff was too weird. It is attached as a file this time.

Martin

-- 
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
diff -r ae2e615a7320 runtime/doc/cmdline.txt
--- a/runtime/doc/cmdline.txt   Mon Jun 14 01:39:13 2010 +0200
+++ b/runtime/doc/cmdline.txt   Wed Jun 16 22:18:19 2010 +0200
@@ -416,7 +416,10 @@
                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 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
 a previous version <Esc> was used).  In the pattern standard wildcards '*' and
diff -r ae2e615a7320 runtime/doc/options.txt
--- a/runtime/doc/options.txt   Mon Jun 14 01:39:13 2010 +0200
+++ b/runtime/doc/options.txt   Wed Jun 16 22:18:19 2010 +0200
@@ -3974,7 +3974,9 @@
        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 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
        match, excluding the characters that were already typed.
        NOTE: This option is reset when 'compatible' is set.
diff -r ae2e615a7320 src/ex_getln.c
--- a/src/ex_getln.c    Mon Jun 14 01:39:13 2010 +0200
+++ b/src/ex_getln.c    Wed Jun 16 22:18:19 2010 +0200
@@ -1411,6 +1411,11 @@
                                   && !equalpos(curwin->w_cursor, old_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 && !has_uppercase(ccline.cmdbuff))
+                           c = MB_TOLOWER(c);
                        if (c != NUL)
                        {
                            if (c == firstc || vim_strchr((char_u *)(
diff -r ae2e615a7320 src/misc1.c
--- a/src/misc1.c       Mon Jun 14 01:39:13 2010 +0200
+++ b/src/misc1.c       Wed Jun 16 22:18:19 2010 +0200
@@ -9575,7 +9575,7 @@
 }
 
 /*
- * 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 inside a ":normal" command.
  */
@@ -9584,3 +9584,49 @@
 {
     return (p_im && stuff_empty() && typebuf_typed());
 }
+
+/*
+ * Return TRUE when pattern "pat" has an uppercase character.
+ */
+    int
+has_uppercase(pat)
+    char_u     *pat;
+{
+    while (*pat)
+    {
+#ifdef FEAT_MBYTE
+       int             l;
+
+       if (has_mbyte && (l = (*mb_ptr2len)(pat)) > 1)
+       {
+           if (enc_utf8 && utf_isupper(utf_ptr2char(pat)))
+           {
+               return TRUE;
+               break;
+           }
+           pat += l;
+       }
+       else
+#endif
+           if (*pat == '\\')
+           {
+               if (pat[1] == '_' && pat[2] != NUL)  /* skip "\_X" */
+                   pat += 3;
+               else if (pat[1] == '%' && pat[2] != NUL)  /* skip "\%X" */
+                   pat += 3;
+               else if (pat[1] != NUL)  /* skip "\X" */
+                   pat += 2;
+               else
+                   pat += 1;
+           }
+           else if (MB_ISUPPER(*pat))
+           {
+               return TRUE;
+               break;
+           }
+           else
+               ++pat;
+    }
+
+    return FALSE;
+}
diff -r ae2e615a7320 src/search.c
--- a/src/search.c      Mon Jun 14 01:39:13 2010 +0200
+++ b/src/search.c      Wed Jun 16 22:18:19 2010 +0200
@@ -365,56 +365,15 @@
 ignorecase(pat)
     char_u     *pat;
 {
-    char_u     *p;
-    int                ic;
-
-    ic = p_ic;
-    if (ic && !no_smartcase && p_scs
+    if (p_ic && !no_smartcase && p_scs && !has_uppercase(pat)
 #ifdef FEAT_INS_EXPAND
                                && !(ctrl_x_mode && curbuf->b_p_inf)
 #endif
                                                                    )
-    {
-       /* don't ignore case if pattern has uppercase */
-       for (p = pat; *p; )
-       {
-#ifdef FEAT_MBYTE
-           int         l;
-
-           if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1)
-           {
-               if (enc_utf8 && utf_isupper(utf_ptr2char(p)))
-               {
-                   ic = FALSE;
-                   break;
-               }
-               p += l;
-           }
-           else
-#endif
-                if (*p == '\\')
-               {
-                   if (p[1] == '_' && p[2] != NUL)  /* skip "\_X" */
-                       p += 3;
-                   else if (p[1] == '%' && p[2] != NUL)  /* skip "\%X" */
-                       p += 3;
-                   else if (p[1] != NUL)  /* skip "\X" */
-                       p += 2;
-                   else
-                       p += 1;
-               }
-               else if (MB_ISUPPER(*p))
-               {
-                   ic = FALSE;
-                   break;
-               }
-               else
-                   ++p;
-       }
-    }
+       return TRUE;
+
     no_smartcase = FALSE;
-
-    return ic;
+    return FALSE;
 }
 
     char_u *

Raspunde prin e-mail lui