summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvimboss <devnull@localhost>2006-01-22 23:22:22 +0000
committervimboss <devnull@localhost>2006-01-22 23:22:22 +0000
commita33a83c2c3893d54cb46f4ec9a2d66518023e9a8 (patch)
tree694bb4e0de4e1f9b6c9eb7a59498c785acd9022c
parentb8c9a2e85225b7a8455d562511327df5d10d6b81 (diff)
downloadvim-a33a83c2c3893d54cb46f4ec9a2d66518023e9a8.tar.gz
updated for version 7.0185
-rw-r--r--runtime/doc/visual.txt7
-rw-r--r--src/diff.c7
-rw-r--r--src/normal.c4
-rw-r--r--src/os_win32.h6
-rw-r--r--src/spell.c63
5 files changed, 58 insertions, 29 deletions
diff --git a/runtime/doc/visual.txt b/runtime/doc/visual.txt
index f8e1efce..1ff70ac0 100644
--- a/runtime/doc/visual.txt
+++ b/runtime/doc/visual.txt
@@ -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*
diff --git a/src/diff.c b/src/diff.c
index 1a382e39..b0958548 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -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;
}
/*
diff --git a/src/normal.c b/src/normal.c
index e866250e..310a6f05 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -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
diff --git a/src/os_win32.h b/src/os_win32.h
index b8393592..15e61606 100644
--- a/src/os_win32.h
+++ b/src/os_win32.h
@@ -15,6 +15,12 @@
#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() */
diff --git a/src/spell.c b/src/spell.c
index ceb5b829..b9f37271 100644
--- a/src/spell.c
+++ b/src/spell.c
@@ -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;