Merged from the latest developing branch.
authoredyfox <edyfox@2a77ed30-b011-0410-a7ad-c7884a0aa172>
Wed, 24 Mar 2010 06:22:28 +0000 (24 06:22 +0000)
committeredyfox <edyfox@2a77ed30-b011-0410-a7ad-c7884a0aa172>
Wed, 24 Mar 2010 06:22:28 +0000 (24 06:22 +0000)
git-svn-id: https://vim.svn.sourceforge.net/svnroot/vim/trunk@1828 2a77ed30-b011-0410-a7ad-c7884a0aa172

src/ex_cmds.c
src/ex_getln.c
src/misc1.c
src/regexp.c
src/screen.c
src/syntax.c
src/version.c

index 68627a5..2296c33 100644 (file)
@@ -4238,6 +4238,7 @@ do_sub(eap)
     char_u     *sub_firstline;         /* allocated copy of first sub line */
     int                endcolumn = FALSE;      /* cursor in last column when done */
     pos_T      old_cursor = curwin->w_cursor;
+    int                start_nsubs;
 
     cmd = eap->arg;
     if (!global_busy)
@@ -4245,6 +4246,7 @@ do_sub(eap)
        sub_nsubs = 0;
        sub_nlines = 0;
     }
+    start_nsubs = sub_nsubs;
 
     if (eap->cmdidx == CMD_tilde)
        which_pat = RE_LAST;    /* use last used regexp */
@@ -5106,7 +5108,7 @@ outofmem:
     if (do_count)
        curwin->w_cursor = old_cursor;
 
-    if (sub_nsubs)
+    if (sub_nsubs > start_nsubs)
     {
        /* Set the '[ and '] marks. */
        curbuf->b_op_start.lnum = eap->line1;
@@ -5236,8 +5238,6 @@ ex_global(eap)
        type = *eap->cmd;
     cmd = eap->arg;
     which_pat = RE_LAST;           /* default: use last used regexp */
-    sub_nsubs = 0;
-    sub_nlines = 0;
 
     /*
      * undocumented vi feature:
@@ -5341,6 +5341,8 @@ global_exe(cmd)
     /* When the command writes a message, don't overwrite the command. */
     msg_didout = TRUE;
 
+    sub_nsubs = 0;
+    sub_nlines = 0;
     global_need_beginline = FALSE;
     global_busy = 1;
     old_lcount = curbuf->b_ml.ml_line_count;
index dea4b13..6e74a23 100644 (file)
@@ -3948,12 +3948,26 @@ showmatches(xp, wildmenu)
                                          || xp->xp_context == EXPAND_SHELLCMD
                                          || xp->xp_context == EXPAND_BUFFERS)
                {
-                   char_u      *halved_slash;
-
                    /* highlight directories */
-                   halved_slash = backslash_halve_save(files_found[k]);
-                   j = mch_isdir(halved_slash);
-                   vim_free(halved_slash);
+                   if (xp->xp_numfiles != -1)
+                   {
+                       char_u  *halved_slash;
+                       char_u  *exp_path;
+
+                       /* Expansion was done before and special characters
+                        * were escaped, need to halve backslashes.  Also
+                        * $HOME has been replaced with ~/. */
+                       exp_path = expand_env_save_opt(files_found[k], TRUE);
+                       halved_slash = backslash_halve_save(
+                               exp_path != NULL ? exp_path : files_found[k]);
+                       j = mch_isdir(halved_slash != NULL ? halved_slash
+                                                           : files_found[k]);
+                       vim_free(exp_path);
+                       vim_free(halved_slash);
+                   }
+                   else
+                       /* Expansion was done here, file names are literal. */
+                       j = mch_isdir(files_found[k]);
                    if (showtail)
                        p = L_SHOWFILE(k);
                    else
index f67f9c6..ffd0b83 100644 (file)
@@ -6270,6 +6270,8 @@ get_c_indent()
            case 'l': ind_keep_case_label = n; break;
            case '#': ind_hash_comment = n; break;
        }
+       if (*options == ',')
+           ++options;
     }
 
     /* remember where the cursor was when we started */
index 037222e..216bf3a 100644 (file)
@@ -6963,6 +6963,8 @@ vim_regsub_both(source, dest, copy, magic, backslash)
            eval_result = eval_to_string(source + 2, NULL, TRUE);
            if (eval_result != NULL)
            {
+               int had_backslash = FALSE;
+
                for (s = eval_result; *s != NUL; mb_ptr_adv(s))
                {
                    /* Change NL to CR, so that it becomes a line break.
@@ -6970,7 +6972,20 @@ vim_regsub_both(source, dest, copy, magic, backslash)
                    if (*s == NL)
                        *s = CAR;
                    else if (*s == '\\' && s[1] != NUL)
+                   {
                        ++s;
+                       had_backslash = TRUE;
+                   }
+               }
+               if (had_backslash && backslash)
+               {
+                   /* Backslashes will be consumed, need to double them. */
+                   s = vim_strsave_escaped(eval_result, (char_u *)"\\");
+                   if (s != NULL)
+                   {
+                       vim_free(eval_result);
+                       eval_result = s;
+                   }
                }
 
                dst += STRLEN(eval_result);
index 7cd72bd..7f929ac 100644 (file)
  * one character which occupies two display cells.
  * For UTF-8 a multi-byte character is converted to Unicode and stored in
  * ScreenLinesUC[].  ScreenLines[] contains the first byte only.  For an ASCII
- * character without composing chars ScreenLinesUC[] will be 0.  When the
- * character occupies two display cells the next byte in ScreenLines[] is 0.
+ * character without composing chars ScreenLinesUC[] will be 0 and
+ * ScreenLinesC[][] is not used.  When the character occupies two display
+ * cells the next byte in ScreenLines[] is 0.
  * ScreenLinesC[][] contain up to 'maxcombine' composing characters
- * (drawn on top of the first character).  They are 0 when not used.
+ * (drawn on top of the first character).  There is 0 after the last one used.
  * ScreenLines2[] is only used for euc-jp to store the second byte if the
  * first byte is 0x8e (single-width character).
  *
@@ -4893,6 +4894,7 @@ static int comp_char_differs __ARGS((int, int));
 
 /*
  * Return if the composing characters at "off_from" and "off_to" differ.
+ * Only to be used when ScreenLinesUC[off_from] != 0.
  */
     static int
 comp_char_differs(off_from, off_to)
@@ -6281,6 +6283,7 @@ static int screen_comp_differs __ARGS((int, int*));
 /*
  * Return TRUE if composing characters for screen posn "off" differs from
  * composing characters in "u8cc".
+ * Only to be used when ScreenLinesUC[off] != 0.
  */
     static int
 screen_comp_differs(off, u8cc)
@@ -6461,8 +6464,10 @@ screen_puts_len(text, len, row, col, attr)
                    && c == 0x8e
                    && ScreenLines2[off] != ptr[1])
                || (enc_utf8
-                   && (ScreenLinesUC[off] != (u8char_T)(c >= 0x80 ? u8c : 0)
-                       || screen_comp_differs(off, u8cc)))
+                   && (ScreenLinesUC[off] !=
+                               (u8char_T)(c < 0x80 && u8cc[0] == 0 ? 0 : u8c)
+                       || (ScreenLinesUC[off] != 0
+                                         && screen_comp_differs(off, u8cc))))
 #endif
                || ScreenAttrs[off] != attr
                || exmode_active;
@@ -7536,13 +7541,13 @@ retry:
     new_ScreenLines = (schar_T *)lalloc((long_u)(
                              (Rows + 1) * Columns * sizeof(schar_T)), FALSE);
 #ifdef FEAT_MBYTE
-    vim_memset(new_ScreenLinesC, 0, sizeof(u8char_T) * MAX_MCO);
+    vim_memset(new_ScreenLinesC, 0, sizeof(u8char_T *) * MAX_MCO);
     if (enc_utf8)
     {
        new_ScreenLinesUC = (u8char_T *)lalloc((long_u)(
                             (Rows + 1) * Columns * sizeof(u8char_T)), FALSE);
        for (i = 0; i < p_mco; ++i)
-           new_ScreenLinesC[i] = (u8char_T *)lalloc((long_u)(
+           new_ScreenLinesC[i] = (u8char_T *)lalloc_clear((long_u)(
                             (Rows + 1) * Columns * sizeof(u8char_T)), FALSE);
     }
     if (enc_dbcs == DBCS_JPNU)
index 3f502b7..9a24d43 100644 (file)
@@ -6205,10 +6205,8 @@ static char *(highlight_init_both[]) =
     {
        CENT("ErrorMsg term=standout ctermbg=DarkRed ctermfg=White",
             "ErrorMsg term=standout ctermbg=DarkRed ctermfg=White guibg=Red guifg=White"),
-#ifdef FEAT_SEARCH_EXTRA
        CENT("IncSearch term=reverse cterm=reverse",
             "IncSearch term=reverse cterm=reverse gui=reverse"),
-#endif
        CENT("ModeMsg term=bold cterm=bold",
             "ModeMsg term=bold cterm=bold gui=bold"),
        CENT("NonText term=bold ctermfg=Blue",
index 12174c7..ef9b5ed 100644 (file)
@@ -682,6 +682,22 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    411,
+/**/
+    410,
+/**/
+    409,
+/**/
+    408,
+/**/
+    407,
+/**/
+    406,
+/**/
+    405,
+/**/
+    404,
+/**/
     403,
 /**/
     402,