]> granicus.if.org Git - vim/commitdiff
updated for version 7.0185
authorBram Moolenaar <Bram@vim.org>
Sun, 22 Jan 2006 23:22:22 +0000 (23:22 +0000)
committerBram Moolenaar <Bram@vim.org>
Sun, 22 Jan 2006 23:22:22 +0000 (23:22 +0000)
runtime/doc/visual.txt
src/diff.c
src/normal.c
src/os_win32.h
src/spell.c

index f8e1efced89f0513bce6b35feea04fc7e8efff82..1ff70ac054a5021b9a58216a06f37f3a1c76cb8a 100644 (file)
@@ -1,4 +1,4 @@
-*visual.txt*    For Vim version 7.0aa.  Last change: 2005 Oct 09
+*visual.txt*    For Vim version 7.0aa.  Last change: 2006 Jan 22
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -258,6 +258,11 @@ operator character: "v{move-around}3>" (move lines 3 indents to the right).
 The {move-around} is any sequence of movement commands.  Note the difference
 with {motion}, which is only ONE movement command.
 
+Another way to operate on the Visual area is using the |/\%V| item in a
+pattern.  For example, to replace all '(' in the Visual area with '#': >
+
+       :%s/\%V(/X/g
+
 ==============================================================================
 5. Blockwise operators                                 *blockwise-operators*
 
index 1a382e399a9e9dc76116497b8487e3f1214994f0..b0958548ae28a978cdb468d8b91cf9cacb9bcf9e 100644 (file)
@@ -441,9 +441,10 @@ diff_mark_adjust(line1, line2, amount, amount_after)
     }
     diff_redraw(TRUE);
 
-    /* Recompute the scroll binding, may remove or add filler lines (e.g.,
-     * when adding lines above w_topline). */
-    check_scrollbind((linenr_T)0, 0L);
+    /* Need to recompute the scroll binding, may remove or add filler lines
+     * (e.g., when adding lines above w_topline). But it's slow when making
+     * many changes, postpone until redrawing. */
+    diff_need_scrollbind = TRUE;
 }
 
 /*
index e866250e92b200bfc77635ae3ea9bcfe3b1c4418..310a6f054bc3dff37ae87a8d5fc77eeec2de48c0 100644 (file)
@@ -3076,7 +3076,7 @@ check_visual_highlight()
 }
 
 /*
- * End visual mode.
+ * End Visual mode.
  * This function should ALWAYS be called to end Visual mode, except from
  * do_pending_operator().
  */
@@ -4843,7 +4843,7 @@ dozet:
                break;
 
     case '=':  /* "z=": suggestions for a badly spelled word  */
-               if (!checkclearopq(cap->oap))
+               if (!checkclearop(cap->oap))
                    spell_suggest((int)cap->count0);
                break;
 #endif
index b83935924f65222b431f36bdc8d8a170a3c87a83..15e616061e018dd23b2d7bbb5531edda03e90858 100644 (file)
 #include <direct.h>            /* for _mkdir() */
 #endif
 
+/* Stop the VC2005 compiler from nagging. */
+#if _MSC_VER >= 1400
+# define _CRT_SECURE_NO_DEPRECATE
+# define _CRT_NONSTDC_NO_DEPRECATE
+#endif
+
 #define BINARY_FILE_IO
 #define USE_EXE_NAME           /* use argv[0] for $VIM */
 #define SYNC_DUP_CLOSE         /* sync() a file with dup() and close() */
index ceb5b829e2e0a259477f4458fc12af42a238e594..b9f37271d6227910eb2f80e00d484965e84ae52f 100644 (file)
@@ -845,7 +845,7 @@ static void set_spell_charflags __ARGS((char_u *flags, int cnt, char_u *upp));
 static int set_spell_chartab __ARGS((char_u *fol, char_u *low, char_u *upp));
 static int spell_casefold __ARGS((char_u *p, int len, char_u *buf, int buflen));
 static int check_need_cap __ARGS((linenr_T lnum, colnr_T col));
-static void spell_find_suggest __ARGS((char_u *badptr, suginfo_T *su, int maxcount, int banbadword, int need_cap, int interactive));
+static void spell_find_suggest __ARGS((char_u *badptr, int badlen, suginfo_T *su, int maxcount, int banbadword, int need_cap, int interactive));
 #ifdef FEAT_EVAL
 static void spell_suggest_expr __ARGS((suginfo_T *su, char_u *expr));
 #endif
@@ -4461,7 +4461,6 @@ typedef struct afffile_S
 {
     char_u     *af_enc;        /* "SET", normalized, alloc'ed string or NULL */
     int                af_flagtype;    /* AFT_CHAR, AFT_LONG, AFT_NUM or AFT_CAPLONG */
-    int                af_slash;       /* character used in word for slash */
     unsigned   af_rare;        /* RARE ID for rare word */
     unsigned   af_keepcase;    /* KEEPCASE ID for keep-case word */
     unsigned   af_bad;         /* BAD ID for banned word */
@@ -4985,14 +4984,6 @@ spell_read_aff(spin, fname)
            {
                /* ignored, we look in the tree for what chars may appear */
            }
-           else if (STRCMP(items[0], "SLASH") == 0 && itemcnt == 2
-                                                       && aff->af_slash == 0)
-           {
-               aff->af_slash = items[1][0];
-               if (items[1][1] != NUL)
-                   smsg((char_u *)_("Character used for SLASH must be ASCII; in %s line %d: %s"),
-                           fname, lnum, items[1]);
-           }
            /* TODO: remove "RAR" later */
            else if ((STRCMP(items[0], "RAR") == 0
                        || STRCMP(items[0], "RARE") == 0) && itemcnt == 2
@@ -6060,13 +6051,13 @@ spell_read_dic(spin, fname, affile)
            continue;   /* empty line */
        line[l] = NUL;
 
-       /* Find the optional affix names.  Replace the SLASH character by a
-        * slash. */
+       /* Truncate the word at the "/", set "afflist" to what follows.
+        * Replace "\/" by "/" and "\\" by "\". */
        afflist = NULL;
        for (p = line; *p != NUL; mb_ptr_adv(p))
        {
-           if (*p == affile->af_slash)
-               *p = '/';
+           if (*p == '\\' && (p[1] == '\\' || p[1] == '/'))
+               mch_memmove(p, p + 1, STRLEN(p));
            else if (*p == '/')
            {
                *p = NUL;
@@ -9358,6 +9349,7 @@ spell_check_sps()
 /*
  * "z?": Find badly spelled word under or after the cursor.
  * Give suggestions for the properly spelled word.
+ * In Visual mode use the highlighted word as the bad word.
  * When "count" is non-zero use that suggestion.
  */
     void
@@ -9376,14 +9368,35 @@ spell_suggest(count)
     int                need_cap;
     int                limit;
     int                selected = count;
+    int                badlen = 0;
 
-    /* Find the start of the badly spelled word. */
-    if (spell_move_to(curwin, FORWARD, TRUE, TRUE, NULL) == 0
-           || curwin->w_cursor.col > prev_cursor.col)
+    if (no_spell_checking(curwin))
+       return;
+
+#ifdef FEAT_VISUAL
+    if (VIsual_active)
     {
-       if (!curwin->w_p_spell || *curbuf->b_p_spl == NUL)
+       /* Use the Visually selected text as the bad word.  But reject
+        * a multi-line selection. */
+       if (curwin->w_cursor.lnum != VIsual.lnum)
+       {
+           vim_beep();
            return;
-
+       }
+       badlen = (int)curwin->w_cursor.col - (int)VIsual.col;
+       if (badlen < 0)
+           badlen = -badlen;
+       else
+           curwin->w_cursor.col = VIsual.col;
+       ++badlen;
+       end_visual_mode();
+    }
+    else
+#endif
+       /* Find the start of the badly spelled word. */
+       if (spell_move_to(curwin, FORWARD, TRUE, TRUE, NULL) == 0
+           || curwin->w_cursor.col > prev_cursor.col)
+    {
        /* No bad word or it starts after the cursor: use the word under the
         * cursor. */
        curwin->w_cursor = prev_cursor;
@@ -9417,7 +9430,7 @@ spell_suggest(count)
        limit = (int)Rows - 2;
     else
        limit = sps_limit;
-    spell_find_suggest(line + curwin->w_cursor.col, &sug, limit,
+    spell_find_suggest(line + curwin->w_cursor.col, badlen, &sug, limit,
                                                        TRUE, need_cap, TRUE);
 
     if (sug.su_ga.ga_len == 0)
@@ -9728,7 +9741,7 @@ spell_suggest_list(gap, word, maxcount, need_cap, interactive)
     suggest_T  *stp;
     char_u     *wcopy;
 
-    spell_find_suggest(word, &sug, maxcount, FALSE, need_cap, interactive);
+    spell_find_suggest(word, 0, &sug, maxcount, FALSE, need_cap, interactive);
 
     /* Make room in "gap". */
     ga_init2(gap, sizeof(char_u *), sug.su_ga.ga_len + 1);
@@ -9761,8 +9774,9 @@ spell_suggest_list(gap, word, maxcount, need_cap, interactive)
  * This is based on the mechanisms of Aspell, but completely reimplemented.
  */
     static void
-spell_find_suggest(badptr, su, maxcount, banbadword, need_cap, interactive)
+spell_find_suggest(badptr, badlen, su, maxcount, banbadword, need_cap, interactive)
     char_u     *badptr;
+    int                badlen;         /* length of bad word or 0 if unknown */
     suginfo_T  *su;
     int                maxcount;
     int                banbadword;     /* don't include badword in suggestions */
@@ -9792,7 +9806,10 @@ spell_find_suggest(badptr, su, maxcount, banbadword, need_cap, interactive)
     hash_init(&su->su_banned);
 
     su->su_badptr = badptr;
-    su->su_badlen = spell_check(curwin, su->su_badptr, &attr, NULL, FALSE);
+    if (badlen != 0)
+       su->su_badlen = badlen;
+    else
+       su->su_badlen = spell_check(curwin, su->su_badptr, &attr, NULL, FALSE);
     su->su_maxcount = maxcount;
     su->su_maxscore = SCORE_MAXINIT;