mirror of
https://github.com/zoriya/vim.git
synced 2025-12-30 10:58:24 +00:00
Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0f6c9487b7 | ||
|
|
d7f8f5c847 | ||
|
|
238b8e20bb | ||
|
|
e0e6f99212 | ||
|
|
3576da72b4 | ||
|
|
cbb8eb3480 | ||
|
|
dc5e218396 | ||
|
|
2a8ced0150 | ||
|
|
90dca41948 | ||
|
|
61665aa512 | ||
|
|
8ba1bd2f01 | ||
|
|
19c9c76c4d | ||
|
|
67a060e9ad | ||
|
|
42ba12662e | ||
|
|
42022d5e45 | ||
|
|
0133bba301 | ||
|
|
555b3d5aba | ||
|
|
4eac38fb45 | ||
|
|
f4f664c50e | ||
|
|
3d0089f5f4 | ||
|
|
9f94b05b1f | ||
|
|
5d55c0ff02 | ||
|
|
10d4cecefd | ||
|
|
2eb6eb323f | ||
|
|
9bf1361652 |
@@ -5841,7 +5841,8 @@ mouse_netterm Compiled with support for netterm mouse.
|
||||
mouse_pterm Compiled with support for qnx pterm mouse.
|
||||
mouse_sysmouse Compiled with support for sysmouse (*BSD console mouse)
|
||||
mouse_xterm Compiled with support for xterm mouse.
|
||||
multi_byte Compiled with support for editing Korean et al.
|
||||
multi_byte Compiled with support for 'encoding'
|
||||
multi_byte_encoding 'encoding' is set to a multi-byte encoding.
|
||||
multi_byte_ime Compiled with support for IME input method.
|
||||
multi_lang Compiled with support for multiple languages.
|
||||
mzscheme Compiled with MzScheme interface |mzscheme|.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*netbeans.txt* For Vim version 7.2. Last change: 2008 Jun 28
|
||||
*netbeans.txt* For Vim version 7.2. Last change: 2009 Jan 06
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Gordon Prieur et al.
|
||||
@@ -722,8 +722,10 @@ keyAtPos keyName lnum/col
|
||||
of the cursor.
|
||||
New in version 2.1.
|
||||
|
||||
killed A file was closed by the user. Only for files that have been
|
||||
assigned a number by the IDE.
|
||||
killed A file was deleted or wiped out by the user and the buffer
|
||||
annotations have been removed. The bufID number for this
|
||||
buffer has become invalid. Only for files that have been
|
||||
assigned a bufID number by the IDE.
|
||||
|
||||
newDotAndMark off off
|
||||
Reports the position of the cursor being at "off" bytes into
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*spell.txt* For Vim version 7.2. Last change: 2008 Jun 21
|
||||
*spell.txt* For Vim version 7.2. Last change: 2008 Nov 30
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -831,8 +831,11 @@ Comment lines in the .aff file start with a '#':
|
||||
|
||||
# comment line ~
|
||||
|
||||
With some items it's also possible to put a comment after it, but this isn't
|
||||
supported in general.
|
||||
Items with a fixed number of arguments can be followed by a comment. But only
|
||||
if none of the arguments can contain white space. The comment must start with
|
||||
a "#" character. Example:
|
||||
|
||||
KEEPCASE = # fix case for words with this flag ~
|
||||
|
||||
|
||||
ENCODING *spell-SET*
|
||||
@@ -965,6 +968,9 @@ common items and two-character flags for uncommon items.
|
||||
|
||||
Note: When using utf-8 only characters up to 65000 may be used for flags.
|
||||
|
||||
Note: even when using "num" or "long" the number of flags available to
|
||||
compounding and prefixes is limited to about 250.
|
||||
|
||||
|
||||
AFFIXES
|
||||
*spell-PFX* *spell-SFX*
|
||||
@@ -1178,6 +1184,9 @@ word as good.
|
||||
The flag also applies to the word with affixes, thus this can be used to mark
|
||||
a whole bunch of related words as bad.
|
||||
|
||||
*spell-FORBIDDENWORD*
|
||||
FORBIDDENWORD can be used just like BAD. For compatibility with Hunspell.
|
||||
|
||||
*spell-NEEDAFFIX*
|
||||
The NEEDAFFIX flag is used to require that a word is used with an affix. The
|
||||
word itself is not a good word (unless there is an empty affix). Example:
|
||||
@@ -1268,6 +1277,10 @@ compound word. The word itself is not a good word. Example:
|
||||
|
||||
NEEDCOMPOUND & ~
|
||||
|
||||
*spell-ONLYINCOMPOUND*
|
||||
The ONLYINCOMPOUND does exactly the same as NEEDCOMPOUND. Supported for
|
||||
compatiblity with Hunspell.
|
||||
|
||||
*spell-COMPOUNDMIN*
|
||||
The minimal character length of a word used for compounding is specified with
|
||||
COMPOUNDMIN. Example:
|
||||
@@ -1328,6 +1341,20 @@ compound. This means it counts for two words when checking the compounding
|
||||
rules. Can also be used for an affix to count the affix as a compounding
|
||||
word.
|
||||
|
||||
*spell-CHECKCOMPOUNDPATTERN*
|
||||
CHECKCOMPOUNDPATTERN is used to define patterns that, when matching at the
|
||||
position where two words are compounded together forbids the compound.
|
||||
For example:
|
||||
CHECKCOMPOUNDPATTERN o e ~
|
||||
|
||||
This forbids compounding if the first word ends in "o" and the second word
|
||||
starts with "e".
|
||||
|
||||
The arguments must be plain text, no patterns are actually supported, despite
|
||||
the item name. Case is always ignored.
|
||||
|
||||
The Hunspell feature to use three arguments and flags is not supported.
|
||||
|
||||
*spell-SYLLABLE*
|
||||
The SYLLABLE item defines characters or character sequences that are used to
|
||||
count the number of syllables in a word. Example:
|
||||
@@ -1496,6 +1523,10 @@ ignored, not supported or defined in another way.
|
||||
ACCENT (Hunspell) *spell-ACCENT*
|
||||
Use MAP instead. |spell-MAP|
|
||||
|
||||
BREAK (Hunspell) *spell-BREAK*
|
||||
Define break points. Unclear how it works exactly.
|
||||
Not supported.
|
||||
|
||||
CHECKCOMPOUNDCASE (Hunspell) *spell-CHECKCOMPOUNDCASE*
|
||||
Disallow uppercase letters at compound word boundaries.
|
||||
Not supported.
|
||||
@@ -1512,9 +1543,6 @@ CHECKCOMPOUNDTRIPLE (Hunspell) *spell-CHECKCOMPOUNDTRIPLE*
|
||||
Forbid three identical characters when compounding. Not
|
||||
supported.
|
||||
|
||||
CHECKCOMPOUNDPATTERN (Hunspell) *spell-CHECKCOMPOUNDPATTERN*
|
||||
Forbid compounding when patterns match. Not supported.
|
||||
|
||||
COMPLEXPREFIXES (Hunspell) *spell-COMPLEXPREFIXES*
|
||||
Enables using two prefixes. Not supported.
|
||||
|
||||
@@ -1536,13 +1564,18 @@ COMPOUNDEND (Hunspell) *spell-COMPOUNDEND*
|
||||
COMPOUNDMIDDLE (Hunspell) *spell-COMPOUNDMIDDLE*
|
||||
Use COMPOUNDRULE instead. |spell-COMPOUNDRULE|
|
||||
|
||||
COMPOUNDRULES (Hunspell) *spell-COMPOUNDRULES*
|
||||
Number of COMPOUNDRULE lines following. Ignored, but the
|
||||
argument must be a number.
|
||||
|
||||
COMPOUNDSYLLABLE (Hunspell) *spell-COMPOUNDSYLLABLE*
|
||||
Use SYLLABLE and COMPOUNDSYLMAX instead. |spell-SYLLABLE|
|
||||
|spell-COMPOUNDSYLMAX|
|
||||
|
||||
FORBIDDENWORD (Hunspell) *spell-FORBIDDENWORD*
|
||||
Use BAD instead. |spell-BAD|
|
||||
|
||||
KEY (Hunspell) *spell-KEY*
|
||||
Define characters that are close together on the keyboard.
|
||||
Used to give better suggestions. Not supported.
|
||||
|
||||
LANG (Hunspell) *spell-LANG*
|
||||
This specifies language-specific behavior. This actually
|
||||
moves part of the language knowledge into the program,
|
||||
@@ -1553,10 +1586,7 @@ LEMMA_PRESENT (Hunspell) *spell-LEMMA_PRESENT*
|
||||
Only needed for morphological analysis.
|
||||
|
||||
MAXNGRAMSUGS (Hunspell) *spell-MAXNGRAMSUGS*
|
||||
Not supported.
|
||||
|
||||
ONLYINCOMPOUND (Hunspell) *spell-ONLYINCOMPOUND*
|
||||
Use NEEDCOMPOUND instead. |spell-NEEDCOMPOUND|
|
||||
Set number of n-gram suggestions. Not supported.
|
||||
|
||||
PSEUDOROOT (Hunspell) *spell-PSEUDOROOT*
|
||||
Use NEEDAFFIX instead. |spell-NEEDAFFIX|
|
||||
|
||||
16
src/buffer.c
16
src/buffer.c
@@ -437,10 +437,6 @@ close_buffer(win, buf, action)
|
||||
return;
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_NETBEANS_INTG
|
||||
if (usingNetbeans)
|
||||
netbeans_file_closed(buf);
|
||||
#endif
|
||||
/* Change directories when the 'acd' option is set. */
|
||||
DO_AUTOCHDIR
|
||||
|
||||
@@ -639,6 +635,10 @@ free_buffer_stuff(buf, free_options)
|
||||
#ifdef FEAT_SIGNS
|
||||
buf_delete_signs(buf); /* delete any signs */
|
||||
#endif
|
||||
#ifdef FEAT_NETBEANS_INTG
|
||||
if (usingNetbeans)
|
||||
netbeans_file_killed(buf);
|
||||
#endif
|
||||
#ifdef FEAT_LOCALMAP
|
||||
map_clear_int(buf, MAP_ALL_MODES, TRUE, FALSE); /* clear local mappings */
|
||||
map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE); /* clear local abbrevs */
|
||||
@@ -815,9 +815,6 @@ do_bufdel(command, arg, addr_count, start_bnr, end_bnr, forceit)
|
||||
int bnr; /* buffer number */
|
||||
char_u *p;
|
||||
|
||||
#ifdef FEAT_NETBEANS_INTG
|
||||
netbeansCloseFile = 1;
|
||||
#endif
|
||||
if (addr_count == 0)
|
||||
{
|
||||
(void)do_buffer(command, DOBUF_CURRENT, FORWARD, 0, forceit);
|
||||
@@ -912,9 +909,6 @@ do_bufdel(command, arg, addr_count, start_bnr, end_bnr, forceit)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef FEAT_NETBEANS_INTG
|
||||
netbeansCloseFile = 0;
|
||||
#endif
|
||||
|
||||
return errormsg;
|
||||
}
|
||||
@@ -5118,7 +5112,7 @@ buf_spname(buf)
|
||||
{
|
||||
if (buf->b_sfname != NULL)
|
||||
return (char *)buf->b_sfname;
|
||||
return "[Scratch]";
|
||||
return _("[Scratch]");
|
||||
}
|
||||
#endif
|
||||
if (buf->b_fname == NULL)
|
||||
|
||||
@@ -73,6 +73,8 @@ diff_buf_delete(buf)
|
||||
{
|
||||
tp->tp_diffbuf[i] = NULL;
|
||||
tp->tp_diff_invalid = TRUE;
|
||||
if (tp == curtab)
|
||||
diff_redraw(TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -102,6 +104,7 @@ diff_buf_adjust(win)
|
||||
{
|
||||
curtab->tp_diffbuf[i] = NULL;
|
||||
curtab->tp_diff_invalid = TRUE;
|
||||
diff_redraw(TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -131,6 +134,7 @@ diff_buf_add(buf)
|
||||
{
|
||||
curtab->tp_diffbuf[i] = buf;
|
||||
curtab->tp_diff_invalid = TRUE;
|
||||
diff_redraw(TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
90
src/edit.c
90
src/edit.c
@@ -147,6 +147,7 @@ static void ins_compl_clear __ARGS((void));
|
||||
static int ins_compl_bs __ARGS((void));
|
||||
static void ins_compl_new_leader __ARGS((void));
|
||||
static void ins_compl_addleader __ARGS((int c));
|
||||
static int ins_compl_len __ARGS((void));
|
||||
static void ins_compl_restart __ARGS((void));
|
||||
static void ins_compl_set_original_text __ARGS((char_u *str));
|
||||
static void ins_compl_addfrommatch __ARGS((void));
|
||||
@@ -197,7 +198,8 @@ static void replace_pop_ins __ARGS((void));
|
||||
static void mb_replace_pop_ins __ARGS((int cc));
|
||||
#endif
|
||||
static void replace_flush __ARGS((void));
|
||||
static void replace_do_bs __ARGS((void));
|
||||
static void replace_do_bs __ARGS((int limit_col));
|
||||
static int del_char_after_col __ARGS((int limit_col));
|
||||
#ifdef FEAT_CINDENT
|
||||
static int cindent_on __ARGS((void));
|
||||
#endif
|
||||
@@ -1933,6 +1935,8 @@ truncate_spaces(line)
|
||||
/*
|
||||
* Backspace the cursor until the given column. Handles REPLACE and VREPLACE
|
||||
* modes correctly. May also be used when not in insert mode at all.
|
||||
* Will attempt not to go before "col" even when there is a composing
|
||||
* character.
|
||||
*/
|
||||
void
|
||||
backspace_until_column(col)
|
||||
@@ -1942,13 +1946,49 @@ backspace_until_column(col)
|
||||
{
|
||||
curwin->w_cursor.col--;
|
||||
if (State & REPLACE_FLAG)
|
||||
replace_do_bs();
|
||||
else
|
||||
(void)del_char(FALSE);
|
||||
replace_do_bs(col);
|
||||
else if (!del_char_after_col(col))
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Like del_char(), but make sure not to go before column "limit_col".
|
||||
* Only matters when there are composing characters.
|
||||
* Return TRUE when something was deleted.
|
||||
*/
|
||||
static int
|
||||
del_char_after_col(limit_col)
|
||||
int limit_col;
|
||||
{
|
||||
#ifdef FEAT_MBYTE
|
||||
if (enc_utf8 && limit_col >= 0)
|
||||
{
|
||||
int ecol = curwin->w_cursor.col + 1;
|
||||
|
||||
/* Make sure the cursor is at the start of a character, but
|
||||
* skip forward again when going too far back because of a
|
||||
* composing character. */
|
||||
mb_adjust_cursor();
|
||||
while (curwin->w_cursor.col < limit_col)
|
||||
{
|
||||
int l = utf_ptr2len(ml_get_cursor());
|
||||
|
||||
if (l == 0) /* end of line */
|
||||
break;
|
||||
curwin->w_cursor.col += l;
|
||||
}
|
||||
if (*ml_get_cursor() == NUL || curwin->w_cursor.col == ecol)
|
||||
return FALSE;
|
||||
del_bytes((long)(ecol - curwin->w_cursor.col), FALSE, TRUE);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
(void)del_char(FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#if defined(FEAT_INS_EXPAND) || defined(PROTO)
|
||||
/*
|
||||
* CTRL-X pressed in Insert mode.
|
||||
@@ -2418,7 +2458,7 @@ ins_compl_longest_match(match)
|
||||
{
|
||||
had_match = (curwin->w_cursor.col > compl_col);
|
||||
ins_compl_delete();
|
||||
ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
|
||||
ins_bytes(compl_leader + ins_compl_len());
|
||||
ins_redraw(FALSE);
|
||||
|
||||
/* When the match isn't there (to avoid matching itself) remove it
|
||||
@@ -2470,7 +2510,7 @@ ins_compl_longest_match(match)
|
||||
*p = NUL;
|
||||
had_match = (curwin->w_cursor.col > compl_col);
|
||||
ins_compl_delete();
|
||||
ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
|
||||
ins_bytes(compl_leader + ins_compl_len());
|
||||
ins_redraw(FALSE);
|
||||
|
||||
/* When the match isn't there (to avoid matching itself) remove it
|
||||
@@ -3209,7 +3249,7 @@ ins_compl_new_leader()
|
||||
{
|
||||
ins_compl_del_pum();
|
||||
ins_compl_delete();
|
||||
ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
|
||||
ins_bytes(compl_leader + ins_compl_len());
|
||||
compl_used_match = FALSE;
|
||||
|
||||
if (compl_started)
|
||||
@@ -3263,6 +3303,20 @@ ins_compl_new_leader()
|
||||
compl_enter_selects = FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the length of the completion, from the completion start column to
|
||||
* the cursor column. Making sure it never goes below zero.
|
||||
*/
|
||||
static int
|
||||
ins_compl_len()
|
||||
{
|
||||
int off = curwin->w_cursor.col - compl_col;
|
||||
|
||||
if (off < 0)
|
||||
return 0;
|
||||
return off;
|
||||
}
|
||||
|
||||
/*
|
||||
* Append one character to the match leader. May reduce the number of
|
||||
* matches.
|
||||
@@ -3621,10 +3675,9 @@ ins_compl_prep(c)
|
||||
{
|
||||
ins_compl_delete();
|
||||
if (compl_leader != NULL)
|
||||
ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
|
||||
ins_bytes(compl_leader + ins_compl_len());
|
||||
else if (compl_first_match != NULL)
|
||||
ins_bytes(compl_orig_text
|
||||
+ curwin->w_cursor.col - compl_col);
|
||||
ins_bytes(compl_orig_text + ins_compl_len());
|
||||
retval = TRUE;
|
||||
}
|
||||
|
||||
@@ -4256,7 +4309,7 @@ ins_compl_delete()
|
||||
static void
|
||||
ins_compl_insert()
|
||||
{
|
||||
ins_bytes(compl_shown_match->cp_str + curwin->w_cursor.col - compl_col);
|
||||
ins_bytes(compl_shown_match->cp_str + ins_compl_len());
|
||||
if (compl_shown_match->cp_flags & ORIGINAL_TEXT)
|
||||
compl_used_match = FALSE;
|
||||
else
|
||||
@@ -4425,7 +4478,7 @@ ins_compl_next(allow_get_expansion, count, insert_match)
|
||||
if (!compl_get_longest || compl_used_match)
|
||||
ins_compl_insert();
|
||||
else
|
||||
ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
|
||||
ins_bytes(compl_leader + ins_compl_len());
|
||||
}
|
||||
else
|
||||
compl_used_match = FALSE;
|
||||
@@ -7123,9 +7176,12 @@ replace_flush()
|
||||
* cc == 0: character was inserted, delete it
|
||||
* cc > 0: character was replaced, put cc (first byte of original char) back
|
||||
* and check for more characters to be put back
|
||||
* When "limit_col" is >= 0, don't delete before this column. Matters when
|
||||
* using composing characters, use del_char_after_col() instead of del_char().
|
||||
*/
|
||||
static void
|
||||
replace_do_bs()
|
||||
replace_do_bs(limit_col)
|
||||
int limit_col;
|
||||
{
|
||||
int cc;
|
||||
#ifdef FEAT_VREPLACE
|
||||
@@ -7153,7 +7209,7 @@ replace_do_bs()
|
||||
#ifdef FEAT_MBYTE
|
||||
if (has_mbyte)
|
||||
{
|
||||
del_char(FALSE);
|
||||
(void)del_char_after_col(limit_col);
|
||||
# ifdef FEAT_VREPLACE
|
||||
if (State & VREPLACE_FLAG)
|
||||
orig_len = (int)STRLEN(ml_get_cursor());
|
||||
@@ -7203,7 +7259,7 @@ replace_do_bs()
|
||||
changed_bytes(curwin->w_cursor.lnum, curwin->w_cursor.col);
|
||||
}
|
||||
else if (cc == 0)
|
||||
(void)del_char(FALSE);
|
||||
(void)del_char_after_col(limit_col);
|
||||
}
|
||||
|
||||
#ifdef FEAT_CINDENT
|
||||
@@ -8239,7 +8295,7 @@ ins_bs_one(vcolp)
|
||||
* Replace mode */
|
||||
if (curwin->w_cursor.lnum != Insstart.lnum
|
||||
|| curwin->w_cursor.col >= Insstart.col)
|
||||
replace_do_bs();
|
||||
replace_do_bs(-1);
|
||||
}
|
||||
else
|
||||
(void)del_char(FALSE);
|
||||
@@ -8556,7 +8612,7 @@ ins_bs(c, mode, inserted_space_p)
|
||||
break;
|
||||
}
|
||||
if (State & REPLACE_FLAG)
|
||||
replace_do_bs();
|
||||
replace_do_bs(-1);
|
||||
else
|
||||
{
|
||||
#ifdef FEAT_MBYTE
|
||||
|
||||
197
src/eval.c
197
src/eval.c
@@ -32,6 +32,9 @@
|
||||
|
||||
#define DICT_MAXNEST 100 /* maximum nesting of lists and dicts */
|
||||
|
||||
#define DO_NOT_FREE_CNT 99999 /* refcount for dict or list that should not
|
||||
be freed. */
|
||||
|
||||
/*
|
||||
* In a hashtab item "hi_key" points to "di_key" in a dictitem.
|
||||
* This avoids adding a pointer to the hashtab item.
|
||||
@@ -789,6 +792,8 @@ static void func_free __ARGS((ufunc_T *fp));
|
||||
static void func_unref __ARGS((char_u *name));
|
||||
static void func_ref __ARGS((char_u *name));
|
||||
static void call_user_func __ARGS((ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rettv, linenr_T firstline, linenr_T lastline, dict_T *selfdict));
|
||||
static int can_free_funccal __ARGS((funccall_T *fc, int copyID)) ;
|
||||
static void free_funccal __ARGS((funccall_T *fc, int free_val));
|
||||
static void add_nr_var __ARGS((dict_T *dp, dictitem_T *v, char *name, varnumber_T nr));
|
||||
static win_T *find_win_by_nr __ARGS((typval_T *vp, tabpage_T *tp));
|
||||
static void getwinvar __ARGS((typval_T *argvars, typval_T *rettv, int off));
|
||||
@@ -923,6 +928,10 @@ func_level(cookie)
|
||||
/* pointer to funccal for currently active function */
|
||||
funccall_T *current_funccal = NULL;
|
||||
|
||||
/* pointer to list of previously used funccal, still around because some
|
||||
* item in it is still being used. */
|
||||
funccall_T *previous_funccal = NULL;
|
||||
|
||||
/*
|
||||
* Return TRUE when a function was ended by a ":return" command.
|
||||
*/
|
||||
@@ -6490,7 +6499,7 @@ garbage_collect()
|
||||
buf_T *buf;
|
||||
win_T *wp;
|
||||
int i;
|
||||
funccall_T *fc;
|
||||
funccall_T *fc, **pfc;
|
||||
int did_free = FALSE;
|
||||
#ifdef FEAT_WINDOWS
|
||||
tabpage_T *tp;
|
||||
@@ -6574,6 +6583,20 @@ garbage_collect()
|
||||
else
|
||||
ll = ll->lv_used_next;
|
||||
|
||||
/* check if any funccal can be freed now */
|
||||
for (pfc = &previous_funccal; *pfc != NULL; )
|
||||
{
|
||||
if (can_free_funccal(*pfc, copyID))
|
||||
{
|
||||
fc = *pfc;
|
||||
*pfc = fc->caller;
|
||||
free_funccal(fc, TRUE);
|
||||
did_free = TRUE;
|
||||
}
|
||||
else
|
||||
pfc = &(*pfc)->caller;
|
||||
}
|
||||
|
||||
return did_free;
|
||||
}
|
||||
|
||||
@@ -10339,7 +10362,8 @@ f_function(argvars, rettv)
|
||||
s = get_tv_string(&argvars[0]);
|
||||
if (s == NULL || *s == NUL || VIM_ISDIGIT(*s))
|
||||
EMSG2(_(e_invarg2), s);
|
||||
else if (!function_exists(s))
|
||||
/* Don't check an autoload name for existence here. */
|
||||
else if (vim_strchr(s, AUTOLOAD_CHAR) == NULL && !function_exists(s))
|
||||
EMSG2(_("E700: Unknown function: %s"), s);
|
||||
else
|
||||
{
|
||||
@@ -11841,6 +11865,10 @@ f_has(argvars, rettv)
|
||||
n = has_patch(atoi((char *)name + 5));
|
||||
else if (STRICMP(name, "vim_starting") == 0)
|
||||
n = (starting != 0);
|
||||
#ifdef FEAT_MBYTE
|
||||
else if (STRICMP(name, "multi_byte_encoding") == 0)
|
||||
n = has_mbyte;
|
||||
#endif
|
||||
#if defined(FEAT_BEVAL) && defined(FEAT_GUI_W32)
|
||||
else if (STRICMP(name, "balloon_multiline") == 0)
|
||||
n = multiline_balloon_available();
|
||||
@@ -18957,7 +18985,7 @@ init_var_dict(dict, dict_var)
|
||||
dictitem_T *dict_var;
|
||||
{
|
||||
hash_init(&dict->dv_hashtab);
|
||||
dict->dv_refcount = 99999;
|
||||
dict->dv_refcount = DO_NOT_FREE_CNT;
|
||||
dict_var->di_tv.vval.v_dict = dict;
|
||||
dict_var->di_tv.v_type = VAR_DICT;
|
||||
dict_var->di_tv.v_lock = VAR_FIXED;
|
||||
@@ -19294,6 +19322,8 @@ tv_check_lock(lock, name)
|
||||
* Copy the values from typval_T "from" to typval_T "to".
|
||||
* When needed allocates string or increases reference count.
|
||||
* Does not make a copy of a list or dict but copies the reference!
|
||||
* It is OK for "from" and "to" to point to the same item. This is used to
|
||||
* make a copy later.
|
||||
*/
|
||||
static void
|
||||
copy_tv(from, to)
|
||||
@@ -21106,7 +21136,7 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
|
||||
char_u *save_sourcing_name;
|
||||
linenr_T save_sourcing_lnum;
|
||||
scid_T save_current_SID;
|
||||
funccall_T fc;
|
||||
funccall_T *fc;
|
||||
int save_did_emsg;
|
||||
static int depth = 0;
|
||||
dictitem_T *v;
|
||||
@@ -21132,36 +21162,37 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
|
||||
|
||||
line_breakcheck(); /* check for CTRL-C hit */
|
||||
|
||||
fc.caller = current_funccal;
|
||||
current_funccal = &fc;
|
||||
fc.func = fp;
|
||||
fc.rettv = rettv;
|
||||
fc = (funccall_T *)alloc(sizeof(funccall_T));
|
||||
fc->caller = current_funccal;
|
||||
current_funccal = fc;
|
||||
fc->func = fp;
|
||||
fc->rettv = rettv;
|
||||
rettv->vval.v_number = 0;
|
||||
fc.linenr = 0;
|
||||
fc.returned = FALSE;
|
||||
fc.level = ex_nesting_level;
|
||||
fc->linenr = 0;
|
||||
fc->returned = FALSE;
|
||||
fc->level = ex_nesting_level;
|
||||
/* Check if this function has a breakpoint. */
|
||||
fc.breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, (linenr_T)0);
|
||||
fc.dbg_tick = debug_tick;
|
||||
fc->breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, (linenr_T)0);
|
||||
fc->dbg_tick = debug_tick;
|
||||
|
||||
/*
|
||||
* Note about using fc.fixvar[]: This is an array of FIXVAR_CNT variables
|
||||
* Note about using fc->fixvar[]: This is an array of FIXVAR_CNT variables
|
||||
* with names up to VAR_SHORT_LEN long. This avoids having to alloc/free
|
||||
* each argument variable and saves a lot of time.
|
||||
*/
|
||||
/*
|
||||
* Init l: variables.
|
||||
*/
|
||||
init_var_dict(&fc.l_vars, &fc.l_vars_var);
|
||||
init_var_dict(&fc->l_vars, &fc->l_vars_var);
|
||||
if (selfdict != NULL)
|
||||
{
|
||||
/* Set l:self to "selfdict". Use "name" to avoid a warning from
|
||||
* some compiler that checks the destination size. */
|
||||
v = &fc.fixvar[fixvar_idx++].var;
|
||||
v = &fc->fixvar[fixvar_idx++].var;
|
||||
name = v->di_key;
|
||||
STRCPY(name, "self");
|
||||
v->di_flags = DI_FLAGS_RO + DI_FLAGS_FIX;
|
||||
hash_add(&fc.l_vars.dv_hashtab, DI2HIKEY(v));
|
||||
hash_add(&fc->l_vars.dv_hashtab, DI2HIKEY(v));
|
||||
v->di_tv.v_type = VAR_DICT;
|
||||
v->di_tv.v_lock = 0;
|
||||
v->di_tv.vval.v_dict = selfdict;
|
||||
@@ -21173,31 +21204,31 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
|
||||
* Set a:0 to "argcount".
|
||||
* Set a:000 to a list with room for the "..." arguments.
|
||||
*/
|
||||
init_var_dict(&fc.l_avars, &fc.l_avars_var);
|
||||
add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "0",
|
||||
init_var_dict(&fc->l_avars, &fc->l_avars_var);
|
||||
add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "0",
|
||||
(varnumber_T)(argcount - fp->uf_args.ga_len));
|
||||
/* Use "name" to avoid a warning from some compiler that checks the
|
||||
* destination size. */
|
||||
v = &fc.fixvar[fixvar_idx++].var;
|
||||
v = &fc->fixvar[fixvar_idx++].var;
|
||||
name = v->di_key;
|
||||
STRCPY(name, "000");
|
||||
v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
|
||||
hash_add(&fc.l_avars.dv_hashtab, DI2HIKEY(v));
|
||||
hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v));
|
||||
v->di_tv.v_type = VAR_LIST;
|
||||
v->di_tv.v_lock = VAR_FIXED;
|
||||
v->di_tv.vval.v_list = &fc.l_varlist;
|
||||
vim_memset(&fc.l_varlist, 0, sizeof(list_T));
|
||||
fc.l_varlist.lv_refcount = 99999;
|
||||
fc.l_varlist.lv_lock = VAR_FIXED;
|
||||
v->di_tv.vval.v_list = &fc->l_varlist;
|
||||
vim_memset(&fc->l_varlist, 0, sizeof(list_T));
|
||||
fc->l_varlist.lv_refcount = DO_NOT_FREE_CNT;
|
||||
fc->l_varlist.lv_lock = VAR_FIXED;
|
||||
|
||||
/*
|
||||
* Set a:firstline to "firstline" and a:lastline to "lastline".
|
||||
* Set a:name to named arguments.
|
||||
* Set a:N to the "..." arguments.
|
||||
*/
|
||||
add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "firstline",
|
||||
add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "firstline",
|
||||
(varnumber_T)firstline);
|
||||
add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "lastline",
|
||||
add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "lastline",
|
||||
(varnumber_T)lastline);
|
||||
for (i = 0; i < argcount; ++i)
|
||||
{
|
||||
@@ -21213,7 +21244,7 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
|
||||
}
|
||||
if (fixvar_idx < FIXVAR_CNT && STRLEN(name) <= VAR_SHORT_LEN)
|
||||
{
|
||||
v = &fc.fixvar[fixvar_idx++].var;
|
||||
v = &fc->fixvar[fixvar_idx++].var;
|
||||
v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
|
||||
}
|
||||
else
|
||||
@@ -21225,7 +21256,7 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
|
||||
v->di_flags = DI_FLAGS_RO;
|
||||
}
|
||||
STRCPY(v->di_key, name);
|
||||
hash_add(&fc.l_avars.dv_hashtab, DI2HIKEY(v));
|
||||
hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v));
|
||||
|
||||
/* Note: the values are copied directly to avoid alloc/free.
|
||||
* "argvars" must have VAR_FIXED for v_lock. */
|
||||
@@ -21234,9 +21265,9 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
|
||||
|
||||
if (ai >= 0 && ai < MAX_FUNC_ARGS)
|
||||
{
|
||||
list_append(&fc.l_varlist, &fc.l_listitems[ai]);
|
||||
fc.l_listitems[ai].li_tv = argvars[i];
|
||||
fc.l_listitems[ai].li_tv.v_lock = VAR_FIXED;
|
||||
list_append(&fc->l_varlist, &fc->l_listitems[ai]);
|
||||
fc->l_listitems[ai].li_tv = argvars[i];
|
||||
fc->l_listitems[ai].li_tv.v_lock = VAR_FIXED;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21301,7 +21332,7 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
|
||||
if (!fp->uf_profiling && has_profiling(FALSE, fp->uf_name, NULL))
|
||||
func_do_profile(fp);
|
||||
if (fp->uf_profiling
|
||||
|| (fc.caller != NULL && fc.caller->func->uf_profiling))
|
||||
|| (fc->caller != NULL && fc->caller->func->uf_profiling))
|
||||
{
|
||||
++fp->uf_tm_count;
|
||||
profile_start(&call_start);
|
||||
@@ -21317,7 +21348,7 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
|
||||
did_emsg = FALSE;
|
||||
|
||||
/* call do_cmdline() to execute the lines */
|
||||
do_cmdline(NULL, get_func_line, (void *)&fc,
|
||||
do_cmdline(NULL, get_func_line, (void *)fc,
|
||||
DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT);
|
||||
|
||||
--RedrawingDisabled;
|
||||
@@ -21332,16 +21363,16 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
|
||||
|
||||
#ifdef FEAT_PROFILE
|
||||
if (do_profiling == PROF_YES && (fp->uf_profiling
|
||||
|| (fc.caller != NULL && fc.caller->func->uf_profiling)))
|
||||
|| (fc->caller != NULL && fc->caller->func->uf_profiling)))
|
||||
{
|
||||
profile_end(&call_start);
|
||||
profile_sub_wait(&wait_start, &call_start);
|
||||
profile_add(&fp->uf_tm_total, &call_start);
|
||||
profile_self(&fp->uf_tm_self, &call_start, &fp->uf_tm_children);
|
||||
if (fc.caller != NULL && fc.caller->func->uf_profiling)
|
||||
if (fc->caller != NULL && fc->caller->func->uf_profiling)
|
||||
{
|
||||
profile_add(&fc.caller->func->uf_tm_children, &call_start);
|
||||
profile_add(&fc.caller->func->uf_tml_children, &call_start);
|
||||
profile_add(&fc->caller->func->uf_tm_children, &call_start);
|
||||
profile_add(&fc->caller->func->uf_tml_children, &call_start);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -21354,9 +21385,9 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
|
||||
|
||||
if (aborting())
|
||||
smsg((char_u *)_("%s aborted"), sourcing_name);
|
||||
else if (fc.rettv->v_type == VAR_NUMBER)
|
||||
else if (fc->rettv->v_type == VAR_NUMBER)
|
||||
smsg((char_u *)_("%s returning #%ld"), sourcing_name,
|
||||
(long)fc.rettv->vval.v_number);
|
||||
(long)fc->rettv->vval.v_number);
|
||||
else
|
||||
{
|
||||
char_u buf[MSG_BUF_LEN];
|
||||
@@ -21367,7 +21398,7 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
|
||||
/* The value may be very long. Skip the middle part, so that we
|
||||
* have some idea how it starts and ends. smsg() would always
|
||||
* truncate it at the end. */
|
||||
s = tv2string(fc.rettv, &tofree, numbuf2, 0);
|
||||
s = tv2string(fc->rettv, &tofree, numbuf2, 0);
|
||||
if (s != NULL)
|
||||
{
|
||||
trunc_string(s, buf, MSG_BUF_CLEN);
|
||||
@@ -21403,14 +21434,84 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
|
||||
}
|
||||
|
||||
did_emsg |= save_did_emsg;
|
||||
current_funccal = fc.caller;
|
||||
|
||||
/* The a: variables typevals were not allocated, only free the allocated
|
||||
* variables. */
|
||||
vars_clear_ext(&fc.l_avars.dv_hashtab, FALSE);
|
||||
|
||||
vars_clear(&fc.l_vars.dv_hashtab); /* free all l: variables */
|
||||
current_funccal = fc->caller;
|
||||
--depth;
|
||||
|
||||
/* if the a:000 list and the a: dict are not referenced we can free the
|
||||
* funccall_T and what's in it. */
|
||||
if (fc->l_varlist.lv_refcount == DO_NOT_FREE_CNT
|
||||
&& fc->l_vars.dv_refcount == DO_NOT_FREE_CNT
|
||||
&& fc->l_avars.dv_refcount == DO_NOT_FREE_CNT)
|
||||
{
|
||||
free_funccal(fc, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
hashitem_T *hi;
|
||||
listitem_T *li;
|
||||
int todo;
|
||||
|
||||
/* "fc" is still in use. This can happen when returning "a:000" or
|
||||
* assigning "l:" to a global variable.
|
||||
* Link "fc" in the list for garbage collection later. */
|
||||
fc->caller = previous_funccal;
|
||||
previous_funccal = fc;
|
||||
|
||||
/* Make a copy of the a: variables, since we didn't do that above. */
|
||||
todo = (int)fc->l_avars.dv_hashtab.ht_used;
|
||||
for (hi = fc->l_avars.dv_hashtab.ht_array; todo > 0; ++hi)
|
||||
{
|
||||
if (!HASHITEM_EMPTY(hi))
|
||||
{
|
||||
--todo;
|
||||
v = HI2DI(hi);
|
||||
copy_tv(&v->di_tv, &v->di_tv);
|
||||
}
|
||||
}
|
||||
|
||||
/* Make a copy of the a:000 items, since we didn't do that above. */
|
||||
for (li = fc->l_varlist.lv_first; li != NULL; li = li->li_next)
|
||||
copy_tv(&li->li_tv, &li->li_tv);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Return TRUE if items in "fc" do not have "copyID". That means they are not
|
||||
* referenced from anywyere.
|
||||
*/
|
||||
static int
|
||||
can_free_funccal(fc, copyID)
|
||||
funccall_T *fc;
|
||||
int copyID;
|
||||
{
|
||||
return (fc->l_varlist.lv_copyID != copyID
|
||||
&& fc->l_vars.dv_copyID != copyID
|
||||
&& fc->l_avars.dv_copyID != copyID);
|
||||
}
|
||||
|
||||
/*
|
||||
* Free "fc" and what it contains.
|
||||
*/
|
||||
static void
|
||||
free_funccal(fc, free_val)
|
||||
funccall_T *fc;
|
||||
int free_val; /* a: vars were allocated */
|
||||
{
|
||||
listitem_T *li;
|
||||
|
||||
/* The a: variables typevals may not have been allocated, only free the
|
||||
* allocated variables. */
|
||||
vars_clear_ext(&fc->l_avars.dv_hashtab, free_val);
|
||||
|
||||
/* free all l: variables */
|
||||
vars_clear(&fc->l_vars.dv_hashtab);
|
||||
|
||||
/* Free the a:000 variables if they were allocated. */
|
||||
if (free_val)
|
||||
for (li = fc->l_varlist.lv_first; li != NULL; li = li->li_next)
|
||||
clear_tv(&li->li_tv);
|
||||
|
||||
vim_free(fc);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -10106,7 +10106,7 @@ makeopens(fd, dirnow)
|
||||
*/
|
||||
if (put_line(fd, "let s:sx = expand(\"<sfile>:p:r\").\"x.vim\"") == FAIL
|
||||
|| put_line(fd, "if file_readable(s:sx)") == FAIL
|
||||
|| put_line(fd, " exe \"source \" . s:sx") == FAIL
|
||||
|| put_line(fd, " exe \"source \" . fnameescape(s:sx)") == FAIL
|
||||
|| put_line(fd, "endif") == FAIL)
|
||||
return FAIL;
|
||||
|
||||
|
||||
65
src/fileio.c
65
src/fileio.c
@@ -6106,12 +6106,24 @@ vim_rename(from, to)
|
||||
#ifdef HAVE_ACL
|
||||
vim_acl_T acl; /* ACL from original file */
|
||||
#endif
|
||||
#if defined(UNIX) || defined(CASE_INSENSITIVE_FILENAME)
|
||||
int use_tmp_file = FALSE;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* When the names are identical, there is nothing to do.
|
||||
* When the names are identical, there is nothing to do. When they refer
|
||||
* to the same file (ignoring case and slash/backslash differences) but
|
||||
* the file name differs we need to go through a temp file.
|
||||
*/
|
||||
if (fnamecmp(from, to) == 0)
|
||||
return 0;
|
||||
{
|
||||
#ifdef CASE_INSENSITIVE_FILENAME
|
||||
if (STRCMP(gettail(from), gettail(to)) != 0)
|
||||
use_tmp_file = TRUE;
|
||||
else
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Fail if the "from" file doesn't exist. Avoids that "to" is deleted.
|
||||
@@ -6119,6 +6131,55 @@ vim_rename(from, to)
|
||||
if (mch_stat((char *)from, &st) < 0)
|
||||
return -1;
|
||||
|
||||
#ifdef UNIX
|
||||
{
|
||||
struct stat st_to;
|
||||
|
||||
/* It's possible for the source and destination to be the same file.
|
||||
* This happens when "from" and "to" differ in case and are on a FAT32
|
||||
* filesystem. In that case go through a temp file name. */
|
||||
if (mch_stat((char *)to, &st_to) >= 0
|
||||
&& st.st_dev == st_to.st_dev
|
||||
&& st.st_ino == st_to.st_ino)
|
||||
use_tmp_file = TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(UNIX) || defined(CASE_INSENSITIVE_FILENAME)
|
||||
if (use_tmp_file)
|
||||
{
|
||||
char tempname[MAXPATHL + 1];
|
||||
|
||||
/*
|
||||
* Find a name that doesn't exist and is in the same directory.
|
||||
* Rename "from" to "tempname" and then rename "tempname" to "to".
|
||||
*/
|
||||
if (STRLEN(from) >= MAXPATHL - 5)
|
||||
return -1;
|
||||
STRCPY(tempname, from);
|
||||
for (n = 123; n < 99999; ++n)
|
||||
{
|
||||
sprintf((char *)gettail((char_u *)tempname), "%d", n);
|
||||
if (mch_stat(tempname, &st) < 0)
|
||||
{
|
||||
if (mch_rename((char *)from, tempname) == 0)
|
||||
{
|
||||
if (mch_rename(tempname, (char *)to) == 0)
|
||||
return 0;
|
||||
/* Strange, the second step failed. Try moving the
|
||||
* file back and return failure. */
|
||||
mch_rename(tempname, (char *)from);
|
||||
return -1;
|
||||
}
|
||||
/* If it fails for one temp name it will most likely fail
|
||||
* for any temp name, give up. */
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Delete the "to" file, this is required on some systems to make the
|
||||
* mch_rename() work, on other systems it makes sure that we don't have
|
||||
|
||||
18
src/fold.c
18
src/fold.c
@@ -740,7 +740,7 @@ deleteFold(start, end, recursive, had_visual)
|
||||
garray_T *found_ga;
|
||||
fold_T *found_fp = NULL;
|
||||
linenr_T found_off = 0;
|
||||
int use_level = FALSE;
|
||||
int use_level;
|
||||
int maybe_small = FALSE;
|
||||
int level = 0;
|
||||
linenr_T lnum = start;
|
||||
@@ -757,6 +757,7 @@ deleteFold(start, end, recursive, had_visual)
|
||||
gap = &curwin->w_folds;
|
||||
found_ga = NULL;
|
||||
lnum_off = 0;
|
||||
use_level = FALSE;
|
||||
for (;;)
|
||||
{
|
||||
if (!foldFind(gap, lnum - lnum_off, &fp))
|
||||
@@ -783,20 +784,21 @@ deleteFold(start, end, recursive, had_visual)
|
||||
else
|
||||
{
|
||||
lnum = found_fp->fd_top + found_fp->fd_len + found_off;
|
||||
did_one = TRUE;
|
||||
|
||||
if (foldmethodIsManual(curwin))
|
||||
deleteFoldEntry(found_ga,
|
||||
(int)(found_fp - (fold_T *)found_ga->ga_data), recursive);
|
||||
else
|
||||
{
|
||||
if (found_fp->fd_top + found_off < first_lnum)
|
||||
first_lnum = found_fp->fd_top;
|
||||
if (lnum > last_lnum)
|
||||
if (first_lnum > found_fp->fd_top + found_off)
|
||||
first_lnum = found_fp->fd_top + found_off;
|
||||
if (last_lnum < lnum)
|
||||
last_lnum = lnum;
|
||||
parseMarker(curwin);
|
||||
if (!did_one)
|
||||
parseMarker(curwin);
|
||||
deleteFoldMarkers(found_fp, recursive, found_off);
|
||||
}
|
||||
did_one = TRUE;
|
||||
|
||||
/* redraw window */
|
||||
changed_window_setting();
|
||||
@@ -811,6 +813,10 @@ deleteFold(start, end, recursive, had_visual)
|
||||
redraw_curbuf_later(INVERTED);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
/* Deleting markers may make cursor column invalid. */
|
||||
check_cursor_col();
|
||||
|
||||
if (last_lnum > 0)
|
||||
changed_lines(first_lnum, (colnr_T)0, last_lnum, 0L);
|
||||
}
|
||||
|
||||
@@ -1340,7 +1340,6 @@ EXTERN garray_T error_ga
|
||||
|
||||
#ifdef FEAT_NETBEANS_INTG
|
||||
EXTERN char *netbeansArg INIT(= NULL); /* the -nb[:host:port:passwd] arg */
|
||||
EXTERN int netbeansCloseFile INIT(= 0); /* send killed if != 0 */
|
||||
EXTERN int netbeansFireChanges INIT(= 1); /* send buffer changes if != 0 */
|
||||
EXTERN int netbeansForcedQuit INIT(= 0);/* don't write modified files */
|
||||
EXTERN int netbeansReadFile INIT(= 1); /* OK to read from disk if != 0 */
|
||||
|
||||
28
src/gui.c
28
src/gui.c
@@ -3241,7 +3241,7 @@ gui_init_which_components(oldval)
|
||||
i = Rows;
|
||||
gui_update_tabline();
|
||||
Rows = i;
|
||||
need_set_size = RESIZE_VERT;
|
||||
need_set_size |= RESIZE_VERT;
|
||||
if (using_tabline)
|
||||
fix_size = TRUE;
|
||||
if (!gui_use_tabline())
|
||||
@@ -3275,9 +3275,9 @@ gui_init_which_components(oldval)
|
||||
if (gui.which_scrollbars[i] != prev_which_scrollbars[i])
|
||||
{
|
||||
if (i == SBAR_BOTTOM)
|
||||
need_set_size = RESIZE_VERT;
|
||||
need_set_size |= RESIZE_VERT;
|
||||
else
|
||||
need_set_size = RESIZE_HOR;
|
||||
need_set_size |= RESIZE_HOR;
|
||||
if (gui.which_scrollbars[i])
|
||||
fix_size = TRUE;
|
||||
}
|
||||
@@ -3297,7 +3297,7 @@ gui_init_which_components(oldval)
|
||||
gui_mch_enable_menu(gui.menu_is_active);
|
||||
Rows = i;
|
||||
prev_menu_is_active = gui.menu_is_active;
|
||||
need_set_size = RESIZE_VERT;
|
||||
need_set_size |= RESIZE_VERT;
|
||||
if (gui.menu_is_active)
|
||||
fix_size = TRUE;
|
||||
}
|
||||
@@ -3308,7 +3308,7 @@ gui_init_which_components(oldval)
|
||||
{
|
||||
gui_mch_show_toolbar(using_toolbar);
|
||||
prev_toolbar = using_toolbar;
|
||||
need_set_size = RESIZE_VERT;
|
||||
need_set_size |= RESIZE_VERT;
|
||||
if (using_toolbar)
|
||||
fix_size = TRUE;
|
||||
}
|
||||
@@ -3318,7 +3318,7 @@ gui_init_which_components(oldval)
|
||||
{
|
||||
gui_mch_enable_footer(using_footer);
|
||||
prev_footer = using_footer;
|
||||
need_set_size = RESIZE_VERT;
|
||||
need_set_size |= RESIZE_VERT;
|
||||
if (using_footer)
|
||||
fix_size = TRUE;
|
||||
}
|
||||
@@ -3330,10 +3330,11 @@ gui_init_which_components(oldval)
|
||||
prev_tearoff = using_tearoff;
|
||||
}
|
||||
#endif
|
||||
if (need_set_size)
|
||||
if (need_set_size != 0)
|
||||
{
|
||||
#ifdef FEAT_GUI_GTK
|
||||
long c = Columns;
|
||||
long prev_Columns = Columns;
|
||||
long prev_Rows = Rows;
|
||||
#endif
|
||||
/* Adjust the size of the window to make the text area keep the
|
||||
* same size and to avoid that part of our window is off-screen
|
||||
@@ -3349,11 +3350,14 @@ gui_init_which_components(oldval)
|
||||
* If you remove this, please test this command for resizing
|
||||
* effects (with optional left scrollbar): ":vsp|q|vsp|q|vsp|q".
|
||||
* Don't do this while starting up though.
|
||||
* And don't change Rows, it may have be reduced intentionally
|
||||
* when adding menu/toolbar/tabline. */
|
||||
if (!gui.starting)
|
||||
* Don't change Rows when adding menu/toolbar/tabline.
|
||||
* Don't change Columns when adding vertical toolbar. */
|
||||
if (!gui.starting && need_set_size != (RESIZE_VERT | RESIZE_HOR))
|
||||
(void)char_avail();
|
||||
Columns = c;
|
||||
if ((need_set_size & RESIZE_VERT) == 0)
|
||||
Rows = prev_Rows;
|
||||
if ((need_set_size & RESIZE_HOR) == 0)
|
||||
Columns = prev_Columns;
|
||||
#endif
|
||||
}
|
||||
#ifdef FEAT_WINDOWS
|
||||
|
||||
@@ -4966,7 +4966,7 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx)
|
||||
char_u *p_actext;
|
||||
|
||||
p_actext = menu->actext;
|
||||
key = find_special_key(&p_actext, &modifiers, /*keycode=*/0);
|
||||
key = find_special_key(&p_actext, &modifiers, FALSE, FALSE);
|
||||
if (*p_actext != 0)
|
||||
key = 0; /* error: trailing text */
|
||||
/* find_special_key() returns a keycode with as many of the
|
||||
|
||||
@@ -1937,6 +1937,11 @@ gui_mch_wait_for_chars(int wtime)
|
||||
s_need_activate = FALSE;
|
||||
}
|
||||
|
||||
#ifdef FEAT_NETBEANS_INTG
|
||||
/* Process the queued netbeans messages. */
|
||||
netbeans_parse_messages();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Don't use gui_mch_update() because then we will spin-lock until a
|
||||
* char arrives, instead we use GetMessage() to hang until an
|
||||
|
||||
@@ -166,7 +166,7 @@ EXTERN_C void boot_DynaLoader __ARGS((pTHX_ CV*));
|
||||
# define Perl_Isv_yes_ptr dll_Perl_Isv_yes_ptr
|
||||
# define boot_DynaLoader dll_boot_DynaLoader
|
||||
|
||||
# define Perl_sys_init3 dll_Perl_sys_init3
|
||||
# define Perl_sys_init dll_Perl_sys_init
|
||||
# define Perl_sys_term dll_Perl_sys_term
|
||||
# define Perl_ISv_ptr dll_Perl_ISv_ptr
|
||||
# define Perl_Istack_max_ptr dll_Perl_Istack_max_ptr
|
||||
@@ -272,7 +272,7 @@ static void (*boot_DynaLoader)_((pTHX_ CV*));
|
||||
|
||||
#if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
|
||||
static void (*Perl_sv_free2)(pTHX_ SV*);
|
||||
static void (*Perl_sys_init3)(int* argc, char*** argv, char*** env);
|
||||
static void (*Perl_sys_init)(int* argc, char*** argv);
|
||||
static void (*Perl_sys_term)(void);
|
||||
static SV** (*Perl_ISv_ptr)(register PerlInterpreter*);
|
||||
static SV*** (*Perl_Istack_max_ptr)(register PerlInterpreter*);
|
||||
@@ -372,7 +372,7 @@ static struct {
|
||||
{"Perl_Tna_ptr", (PERL_PROC*)&Perl_Tna_ptr},
|
||||
#else
|
||||
{"Perl_sv_free2", (PERL_PROC*)&Perl_sv_free2},
|
||||
{"Perl_sys_init3", (PERL_PROC*)&Perl_sys_init3},
|
||||
{"Perl_sys_init", (PERL_PROC*)&Perl_sys_init},
|
||||
{"Perl_sys_term", (PERL_PROC*)&Perl_sys_term},
|
||||
{"Perl_ISv_ptr", (PERL_PROC*)&Perl_ISv_ptr},
|
||||
{"Perl_Istack_sp_ptr", (PERL_PROC*)&Perl_Istack_sp_ptr},
|
||||
@@ -460,7 +460,7 @@ perl_init()
|
||||
static char *argv[] = { "", "-e", "" };
|
||||
|
||||
#if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
|
||||
Perl_sys_init3(&argc, (char***)&argv, NULL);
|
||||
Perl_sys_init(&argc, (char***)&argv);
|
||||
#endif
|
||||
perl_interp = perl_alloc();
|
||||
perl_construct(perl_interp);
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
*
|
||||
* if_sniff.c Interface between Vim and SNiFF+
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* See README.txt for an overview of the Vim source code.
|
||||
*/
|
||||
|
||||
@@ -716,8 +714,10 @@ ConnectToSniffEmacs()
|
||||
#else /* UNIX Version of the Code */
|
||||
int ToSniffEmacs[2], FromSniffEmacs[2];
|
||||
|
||||
pipe(ToSniffEmacs);
|
||||
pipe(FromSniffEmacs);
|
||||
if (pipe(ToSniffEmacs) != 0)
|
||||
return 1;
|
||||
if (pipe(FromSniffEmacs) != 0)
|
||||
return 1;
|
||||
|
||||
/* fork */
|
||||
if ((sniffemacs_pid=fork()) == 0)
|
||||
|
||||
10
src/misc2.c
10
src/misc2.c
@@ -2561,7 +2561,7 @@ trans_special(srcp, dst, keycode)
|
||||
int key;
|
||||
int dlen = 0;
|
||||
|
||||
key = find_special_key(srcp, &modifiers, keycode);
|
||||
key = find_special_key(srcp, &modifiers, keycode, FALSE);
|
||||
if (key == 0)
|
||||
return 0;
|
||||
|
||||
@@ -2597,10 +2597,11 @@ trans_special(srcp, dst, keycode)
|
||||
* returns 0 if there is no match.
|
||||
*/
|
||||
int
|
||||
find_special_key(srcp, modp, keycode)
|
||||
find_special_key(srcp, modp, keycode, keep_x_key)
|
||||
char_u **srcp;
|
||||
int *modp;
|
||||
int keycode; /* prefer key code, e.g. K_DEL instead of DEL */
|
||||
int keycode; /* prefer key code, e.g. K_DEL instead of DEL */
|
||||
int keep_x_key; /* don't translate xHome to Home key */
|
||||
{
|
||||
char_u *last_dash;
|
||||
char_u *end_of_name;
|
||||
@@ -2668,7 +2669,8 @@ find_special_key(srcp, modp, keycode)
|
||||
else
|
||||
{
|
||||
key = get_special_key_code(last_dash + 1);
|
||||
key = handle_x_keys(key);
|
||||
if (!keep_x_key)
|
||||
key = handle_x_keys(key);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -769,11 +769,14 @@ messageFromNetbeans(gpointer clientData, gint unused1,
|
||||
return; /* don't try to parse it */
|
||||
}
|
||||
|
||||
#ifdef FEAT_GUI_GTK
|
||||
#if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_W32)
|
||||
/* Let the main loop handle messages. */
|
||||
# ifdef FEAT_GUI_GTK
|
||||
if (gtk_main_level() > 0)
|
||||
gtk_main_quit();
|
||||
# endif
|
||||
#else
|
||||
/* Parse the messages, but avoid recursion. */
|
||||
/* Parse the messages now, but avoid recursion. */
|
||||
if (level == 1)
|
||||
netbeans_parse_messages();
|
||||
|
||||
@@ -2918,44 +2921,26 @@ netbeans_file_opened(buf_T *bufp)
|
||||
}
|
||||
|
||||
/*
|
||||
* Tell netbeans a file was closed.
|
||||
* Tell netbeans that a file was deleted or wiped out.
|
||||
*/
|
||||
void
|
||||
netbeans_file_closed(buf_T *bufp)
|
||||
netbeans_file_killed(buf_T *bufp)
|
||||
{
|
||||
int bufno = nb_getbufno(bufp);
|
||||
nbbuf_T *nbbuf = nb_get_buf(bufno);
|
||||
char buffer[2*MAXPATHL];
|
||||
|
||||
if (!haveConnection || bufno < 0)
|
||||
if (!haveConnection || bufno == -1)
|
||||
return;
|
||||
|
||||
if (!netbeansCloseFile)
|
||||
{
|
||||
nbdebug(("Ignoring file_closed for %s. File was closed from IDE\n",
|
||||
bufp->b_ffname));
|
||||
return;
|
||||
}
|
||||
|
||||
nbdebug(("netbeans_file_closed:\n"));
|
||||
nbdebug((" Closing bufno: %d", bufno));
|
||||
if (curbuf != NULL && curbuf != bufp)
|
||||
{
|
||||
nbdebug((" Curbuf bufno: %d\n", nb_getbufno(curbuf)));
|
||||
}
|
||||
else if (curbuf == bufp)
|
||||
{
|
||||
nbdebug((" curbuf == bufp\n"));
|
||||
}
|
||||
|
||||
if (bufno <= 0)
|
||||
return;
|
||||
nbdebug(("netbeans_file_killed:\n"));
|
||||
nbdebug((" Killing bufno: %d", bufno));
|
||||
|
||||
sprintf(buffer, "%d:killed=%d\n", bufno, r_cmdno);
|
||||
|
||||
nbdebug(("EVT: %s", buffer));
|
||||
|
||||
nb_send(buffer, "netbeans_file_closed");
|
||||
nb_send(buffer, "netbeans_file_killed");
|
||||
|
||||
if (nbbuf != NULL)
|
||||
nbbuf->bufp = NULL;
|
||||
|
||||
@@ -2209,12 +2209,15 @@ op_tilde(oap)
|
||||
{
|
||||
for (; pos.lnum <= oap->end.lnum; ++pos.lnum)
|
||||
{
|
||||
int one_change;
|
||||
|
||||
block_prep(oap, &bd, pos.lnum, FALSE);
|
||||
pos.col = bd.textcol;
|
||||
did_change = swapchars(oap->op_type, &pos, bd.textlen);
|
||||
one_change = swapchars(oap->op_type, &pos, bd.textlen);
|
||||
did_change |= one_change;
|
||||
|
||||
# ifdef FEAT_NETBEANS_INTG
|
||||
if (usingNetbeans && did_change)
|
||||
if (usingNetbeans && one_change)
|
||||
{
|
||||
char_u *ptr = ml_get_buf(curbuf, pos.lnum, FALSE);
|
||||
|
||||
|
||||
@@ -8328,7 +8328,7 @@ find_key_option(arg)
|
||||
{
|
||||
--arg; /* put arg at the '<' */
|
||||
modifiers = 0;
|
||||
key = find_special_key(&arg, &modifiers, TRUE);
|
||||
key = find_special_key(&arg, &modifiers, TRUE, TRUE);
|
||||
if (modifiers) /* can't handle modifiers here */
|
||||
key = 0;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ int simplify_key __ARGS((int key, int *modifiers));
|
||||
int handle_x_keys __ARGS((int key));
|
||||
char_u *get_special_key_name __ARGS((int c, int modifiers));
|
||||
int trans_special __ARGS((char_u **srcp, char_u *dst, int keycode));
|
||||
int find_special_key __ARGS((char_u **srcp, int *modp, int keycode));
|
||||
int find_special_key __ARGS((char_u **srcp, int *modp, int keycode, int keep_x_key));
|
||||
int extract_modifiers __ARGS((int key, int *modp));
|
||||
int find_special_key_in_table __ARGS((int c));
|
||||
int get_special_key_code __ARGS((char_u *name));
|
||||
|
||||
@@ -11,7 +11,7 @@ void netbeans_send_disconnect __ARGS((void));
|
||||
void netbeans_frame_moved __ARGS((int new_x, int new_y));
|
||||
void netbeans_file_activated __ARGS((buf_T *bufp));
|
||||
void netbeans_file_opened __ARGS((buf_T *bufp));
|
||||
void netbeans_file_closed __ARGS((buf_T *bufp));
|
||||
void netbeans_file_killed __ARGS((buf_T *bufp));
|
||||
void netbeans_inserted __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, char_u *txt, int newlen));
|
||||
void netbeans_removed __ARGS((buf_T *bufp, linenr_T linenr, colnr_T col, long len));
|
||||
void netbeans_unmodified __ARGS((buf_T *bufp));
|
||||
|
||||
338
src/spell.c
338
src/spell.c
@@ -469,6 +469,7 @@ struct slang_S
|
||||
garray_T sl_comppat; /* CHECKCOMPOUNDPATTERN items */
|
||||
regprog_T *sl_compprog; /* COMPOUNDRULE turned into a regexp progrm
|
||||
* (NULL when no compounding) */
|
||||
char_u *sl_comprules; /* all COMPOUNDRULE concatenated (or NULL) */
|
||||
char_u *sl_compstartflags; /* flags for first compound word */
|
||||
char_u *sl_compallflags; /* all flags for compound words */
|
||||
char_u sl_nobreak; /* When TRUE: no spaces between words */
|
||||
@@ -839,7 +840,10 @@ static void slang_free __ARGS((slang_T *lp));
|
||||
static void slang_clear __ARGS((slang_T *lp));
|
||||
static void slang_clear_sug __ARGS((slang_T *lp));
|
||||
static void find_word __ARGS((matchinf_T *mip, int mode));
|
||||
static int match_checkcompoundpattern __ARGS((char_u *ptr, int wlen, garray_T *gap));
|
||||
static int can_compound __ARGS((slang_T *slang, char_u *word, char_u *flags));
|
||||
static int can_be_compound __ARGS((trystate_T *sp, slang_T *slang, char_u *compflags, int flag));
|
||||
static int match_compoundrule __ARGS((slang_T *slang, char_u *compflags));
|
||||
static int valid_word_prefix __ARGS((int totprefcnt, int arridx, int flags, char_u *word, slang_T *slang, int cond_req));
|
||||
static void find_prefix __ARGS((matchinf_T *mip, int mode));
|
||||
static int fold_more __ARGS((matchinf_T *mip));
|
||||
@@ -1519,6 +1523,11 @@ find_word(mip, mode)
|
||||
((unsigned)flags >> 24)))
|
||||
continue;
|
||||
|
||||
/* If there is a match with a CHECKCOMPOUNDPATTERN rule
|
||||
* discard the compound word. */
|
||||
if (match_checkcompoundpattern(ptr, wlen, &slang->sl_comppat))
|
||||
continue;
|
||||
|
||||
if (mode == FIND_COMPOUND)
|
||||
{
|
||||
int capflags;
|
||||
@@ -1577,6 +1586,11 @@ find_word(mip, mode)
|
||||
if (!can_compound(slang, fword, mip->mi_compflags))
|
||||
continue;
|
||||
}
|
||||
else if (slang->sl_comprules != NULL
|
||||
&& !match_compoundrule(slang, mip->mi_compflags))
|
||||
/* The compound flags collected so far do not match any
|
||||
* COMPOUNDRULE, discard the compounded word. */
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Check NEEDCOMPOUND: can't use word without compounding. */
|
||||
@@ -1726,6 +1740,39 @@ find_word(mip, mode)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Return TRUE if there is a match between the word ptr[wlen] and
|
||||
* CHECKCOMPOUNDPATTERN rules, assuming that we will concatenate with another
|
||||
* word.
|
||||
* A match means that the first part of CHECKCOMPOUNDPATTERN matches at the
|
||||
* end of ptr[wlen] and the second part matches after it.
|
||||
*/
|
||||
static int
|
||||
match_checkcompoundpattern(ptr, wlen, gap)
|
||||
char_u *ptr;
|
||||
int wlen;
|
||||
garray_T *gap; /* &sl_comppat */
|
||||
{
|
||||
int i;
|
||||
char_u *p;
|
||||
int len;
|
||||
|
||||
for (i = 0; i + 1 < gap->ga_len; i += 2)
|
||||
{
|
||||
p = ((char_u **)gap->ga_data)[i + 1];
|
||||
if (STRNCMP(ptr + wlen, p, STRLEN(p)) == 0)
|
||||
{
|
||||
/* Second part matches at start of following compound word, now
|
||||
* check if first part matches at end of previous word. */
|
||||
p = ((char_u **)gap->ga_data)[i];
|
||||
len = (int)STRLEN(p);
|
||||
if (len <= wlen && STRNCMP(ptr + wlen - len, p, len) == 0)
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return TRUE if "flags" is a valid sequence of compound flags and "word"
|
||||
* does not have too many syllables.
|
||||
@@ -1772,6 +1819,98 @@ can_compound(slang, word, flags)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return TRUE when the sequence of flags in "compflags" plus "flag" can
|
||||
* possibly form a valid compounded word. This also checks the COMPOUNDRULE
|
||||
* lines if they don't contain wildcards.
|
||||
*/
|
||||
static int
|
||||
can_be_compound(sp, slang, compflags, flag)
|
||||
trystate_T *sp;
|
||||
slang_T *slang;
|
||||
char_u *compflags;
|
||||
int flag;
|
||||
{
|
||||
/* If the flag doesn't appear in sl_compstartflags or sl_compallflags
|
||||
* then it can't possibly compound. */
|
||||
if (!byte_in_str(sp->ts_complen == sp->ts_compsplit
|
||||
? slang->sl_compstartflags : slang->sl_compallflags, flag))
|
||||
return FALSE;
|
||||
|
||||
/* If there are no wildcards, we can check if the flags collected so far
|
||||
* possibly can form a match with COMPOUNDRULE patterns. This only
|
||||
* makes sense when we have two or more words. */
|
||||
if (slang->sl_comprules != NULL && sp->ts_complen > sp->ts_compsplit)
|
||||
{
|
||||
int v;
|
||||
|
||||
compflags[sp->ts_complen] = flag;
|
||||
compflags[sp->ts_complen + 1] = NUL;
|
||||
v = match_compoundrule(slang, compflags + sp->ts_compsplit);
|
||||
compflags[sp->ts_complen] = NUL;
|
||||
return v;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return TRUE if the compound flags in compflags[] match the start of any
|
||||
* compound rule. This is used to stop trying a compound if the flags
|
||||
* collected so far can't possibly match any compound rule.
|
||||
* Caller must check that slang->sl_comprules is not NULL.
|
||||
*/
|
||||
static int
|
||||
match_compoundrule(slang, compflags)
|
||||
slang_T *slang;
|
||||
char_u *compflags;
|
||||
{
|
||||
char_u *p;
|
||||
int i;
|
||||
int c;
|
||||
|
||||
/* loop over all the COMPOUNDRULE entries */
|
||||
for (p = slang->sl_comprules; *p != NUL; ++p)
|
||||
{
|
||||
/* loop over the flags in the compound word we have made, match
|
||||
* them against the current rule entry */
|
||||
for (i = 0; ; ++i)
|
||||
{
|
||||
c = compflags[i];
|
||||
if (c == NUL)
|
||||
/* found a rule that matches for the flags we have so far */
|
||||
return TRUE;
|
||||
if (*p == '/' || *p == NUL)
|
||||
break; /* end of rule, it's too short */
|
||||
if (*p == '[')
|
||||
{
|
||||
int match = FALSE;
|
||||
|
||||
/* compare against all the flags in [] */
|
||||
++p;
|
||||
while (*p != ']' && *p != NUL)
|
||||
if (*p++ == c)
|
||||
match = TRUE;
|
||||
if (!match)
|
||||
break; /* none matches */
|
||||
}
|
||||
else if (*p != c)
|
||||
break; /* flag of word doesn't match flag in pattern */
|
||||
++p;
|
||||
}
|
||||
|
||||
/* Skip to the next "/", where the next pattern starts. */
|
||||
p = vim_strchr(p, '/');
|
||||
if (p == NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Checked all the rules and none of them match the flags, so there
|
||||
* can't possibly be a compound starting with these flags. */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return non-zero if the prefix indicated by "arridx" matches with the prefix
|
||||
* ID in "flags" for the word "word".
|
||||
@@ -2513,9 +2652,11 @@ slang_clear(lp)
|
||||
lp->sl_midword = NULL;
|
||||
|
||||
vim_free(lp->sl_compprog);
|
||||
vim_free(lp->sl_comprules);
|
||||
vim_free(lp->sl_compstartflags);
|
||||
vim_free(lp->sl_compallflags);
|
||||
lp->sl_compprog = NULL;
|
||||
lp->sl_comprules = NULL;
|
||||
lp->sl_compstartflags = NULL;
|
||||
lp->sl_compallflags = NULL;
|
||||
|
||||
@@ -3460,6 +3601,7 @@ read_compound(fd, slang, len)
|
||||
char_u *pp;
|
||||
char_u *cp;
|
||||
char_u *ap;
|
||||
char_u *crp;
|
||||
int cnt;
|
||||
garray_T *gap;
|
||||
|
||||
@@ -3545,6 +3687,12 @@ read_compound(fd, slang, len)
|
||||
slang->sl_compallflags = ap;
|
||||
*ap = NUL;
|
||||
|
||||
/* And a list of all patterns in their original form, for checking whether
|
||||
* compounding may work in match_compoundrule(). This is freed when we
|
||||
* encounter a wildcard, the check doesn't work then. */
|
||||
crp = alloc(todo + 1);
|
||||
slang->sl_comprules = crp;
|
||||
|
||||
pp = pat;
|
||||
*pp++ = '^';
|
||||
*pp++ = '\\';
|
||||
@@ -3587,6 +3735,20 @@ read_compound(fd, slang, len)
|
||||
atstart = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Copy flag to "sl_comprules", unless we run into a wildcard. */
|
||||
if (crp != NULL)
|
||||
{
|
||||
if (c == '+' || c == '*')
|
||||
{
|
||||
vim_free(slang->sl_comprules);
|
||||
slang->sl_comprules = NULL;
|
||||
crp = NULL;
|
||||
}
|
||||
else
|
||||
*crp++ = c;
|
||||
}
|
||||
|
||||
if (c == '/') /* slash separates two items */
|
||||
{
|
||||
*pp++ = '\\';
|
||||
@@ -3611,6 +3773,9 @@ read_compound(fd, slang, len)
|
||||
*pp++ = '$';
|
||||
*pp = NUL;
|
||||
|
||||
if (crp != NULL)
|
||||
*crp = NUL;
|
||||
|
||||
slang->sl_compprog = vim_regcomp(pat, RE_MAGIC + RE_STRING + RE_STRICT);
|
||||
vim_free(pat);
|
||||
if (slang->sl_compprog == NULL)
|
||||
@@ -4915,6 +5080,7 @@ typedef struct spellinfo_S
|
||||
} spellinfo_T;
|
||||
|
||||
static afffile_T *spell_read_aff __ARGS((spellinfo_T *spin, char_u *fname));
|
||||
static int is_aff_rule __ARGS((char_u **items, int itemcnt, char *rulename, int mincount));
|
||||
static void aff_process_flags __ARGS((afffile_T *affile, affentry_T *entry));
|
||||
static int spell_info_item __ARGS((char_u *s));
|
||||
static unsigned affitem2flag __ARGS((int flagtype, char_u *item, char_u *fname, int lnum));
|
||||
@@ -5223,8 +5389,7 @@ spell_read_aff(spin, fname)
|
||||
/* Handle non-empty lines. */
|
||||
if (itemcnt > 0)
|
||||
{
|
||||
if (STRCMP(items[0], "SET") == 0 && itemcnt == 2
|
||||
&& aff->af_enc == NULL)
|
||||
if (is_aff_rule(items, itemcnt, "SET", 2) && aff->af_enc == NULL)
|
||||
{
|
||||
#ifdef FEAT_MBYTE
|
||||
/* Setup for conversion from "ENC" to 'encoding'. */
|
||||
@@ -5239,7 +5404,7 @@ spell_read_aff(spin, fname)
|
||||
smsg((char_u *)_("Conversion in %s not supported"), fname);
|
||||
#endif
|
||||
}
|
||||
else if (STRCMP(items[0], "FLAG") == 0 && itemcnt == 2
|
||||
else if (is_aff_rule(items, itemcnt, "FLAG", 2)
|
||||
&& aff->af_flagtype == AFT_CHAR)
|
||||
{
|
||||
if (STRCMP(items[1], "long") == 0)
|
||||
@@ -5284,69 +5449,71 @@ spell_read_aff(spin, fname)
|
||||
spin->si_info = p;
|
||||
}
|
||||
}
|
||||
else if (STRCMP(items[0], "MIDWORD") == 0 && itemcnt == 2
|
||||
else if (is_aff_rule(items, itemcnt, "MIDWORD", 2)
|
||||
&& midword == NULL)
|
||||
{
|
||||
midword = getroom_save(spin, items[1]);
|
||||
}
|
||||
else if (STRCMP(items[0], "TRY") == 0 && itemcnt == 2)
|
||||
else if (is_aff_rule(items, itemcnt, "TRY", 2))
|
||||
{
|
||||
/* ignored, we look in the tree for what chars may appear */
|
||||
}
|
||||
/* TODO: remove "RAR" later */
|
||||
else if ((STRCMP(items[0], "RAR") == 0
|
||||
|| STRCMP(items[0], "RARE") == 0) && itemcnt == 2
|
||||
&& aff->af_rare == 0)
|
||||
else if ((is_aff_rule(items, itemcnt, "RAR", 2)
|
||||
|| is_aff_rule(items, itemcnt, "RARE", 2))
|
||||
&& aff->af_rare == 0)
|
||||
{
|
||||
aff->af_rare = affitem2flag(aff->af_flagtype, items[1],
|
||||
fname, lnum);
|
||||
}
|
||||
/* TODO: remove "KEP" later */
|
||||
else if ((STRCMP(items[0], "KEP") == 0
|
||||
|| STRCMP(items[0], "KEEPCASE") == 0) && itemcnt == 2
|
||||
else if ((is_aff_rule(items, itemcnt, "KEP", 2)
|
||||
|| is_aff_rule(items, itemcnt, "KEEPCASE", 2))
|
||||
&& aff->af_keepcase == 0)
|
||||
{
|
||||
aff->af_keepcase = affitem2flag(aff->af_flagtype, items[1],
|
||||
fname, lnum);
|
||||
}
|
||||
else if (STRCMP(items[0], "BAD") == 0 && itemcnt == 2
|
||||
&& aff->af_bad == 0)
|
||||
else if ((is_aff_rule(items, itemcnt, "BAD", 2)
|
||||
|| is_aff_rule(items, itemcnt, "FORBIDDENWORD", 2))
|
||||
&& aff->af_bad == 0)
|
||||
{
|
||||
aff->af_bad = affitem2flag(aff->af_flagtype, items[1],
|
||||
fname, lnum);
|
||||
}
|
||||
else if (STRCMP(items[0], "NEEDAFFIX") == 0 && itemcnt == 2
|
||||
else if (is_aff_rule(items, itemcnt, "NEEDAFFIX", 2)
|
||||
&& aff->af_needaffix == 0)
|
||||
{
|
||||
aff->af_needaffix = affitem2flag(aff->af_flagtype, items[1],
|
||||
fname, lnum);
|
||||
}
|
||||
else if (STRCMP(items[0], "CIRCUMFIX") == 0 && itemcnt == 2
|
||||
else if (is_aff_rule(items, itemcnt, "CIRCUMFIX", 2)
|
||||
&& aff->af_circumfix == 0)
|
||||
{
|
||||
aff->af_circumfix = affitem2flag(aff->af_flagtype, items[1],
|
||||
fname, lnum);
|
||||
}
|
||||
else if (STRCMP(items[0], "NOSUGGEST") == 0 && itemcnt == 2
|
||||
else if (is_aff_rule(items, itemcnt, "NOSUGGEST", 2)
|
||||
&& aff->af_nosuggest == 0)
|
||||
{
|
||||
aff->af_nosuggest = affitem2flag(aff->af_flagtype, items[1],
|
||||
fname, lnum);
|
||||
}
|
||||
else if (STRCMP(items[0], "NEEDCOMPOUND") == 0 && itemcnt == 2
|
||||
else if ((is_aff_rule(items, itemcnt, "NEEDCOMPOUND", 2)
|
||||
|| is_aff_rule(items, itemcnt, "ONLYINCOMPOUND", 2))
|
||||
&& aff->af_needcomp == 0)
|
||||
{
|
||||
aff->af_needcomp = affitem2flag(aff->af_flagtype, items[1],
|
||||
fname, lnum);
|
||||
}
|
||||
else if (STRCMP(items[0], "COMPOUNDROOT") == 0 && itemcnt == 2
|
||||
else if (is_aff_rule(items, itemcnt, "COMPOUNDROOT", 2)
|
||||
&& aff->af_comproot == 0)
|
||||
{
|
||||
aff->af_comproot = affitem2flag(aff->af_flagtype, items[1],
|
||||
fname, lnum);
|
||||
}
|
||||
else if (STRCMP(items[0], "COMPOUNDFORBIDFLAG") == 0
|
||||
&& itemcnt == 2 && aff->af_compforbid == 0)
|
||||
else if (is_aff_rule(items, itemcnt, "COMPOUNDFORBIDFLAG", 2)
|
||||
&& aff->af_compforbid == 0)
|
||||
{
|
||||
aff->af_compforbid = affitem2flag(aff->af_flagtype, items[1],
|
||||
fname, lnum);
|
||||
@@ -5354,8 +5521,8 @@ spell_read_aff(spin, fname)
|
||||
smsg((char_u *)_("Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line %d"),
|
||||
fname, lnum);
|
||||
}
|
||||
else if (STRCMP(items[0], "COMPOUNDPERMITFLAG") == 0
|
||||
&& itemcnt == 2 && aff->af_comppermit == 0)
|
||||
else if (is_aff_rule(items, itemcnt, "COMPOUNDPERMITFLAG", 2)
|
||||
&& aff->af_comppermit == 0)
|
||||
{
|
||||
aff->af_comppermit = affitem2flag(aff->af_flagtype, items[1],
|
||||
fname, lnum);
|
||||
@@ -5363,7 +5530,7 @@ spell_read_aff(spin, fname)
|
||||
smsg((char_u *)_("Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line %d"),
|
||||
fname, lnum);
|
||||
}
|
||||
else if (STRCMP(items[0], "COMPOUNDFLAG") == 0 && itemcnt == 2
|
||||
else if (is_aff_rule(items, itemcnt, "COMPOUNDFLAG", 2)
|
||||
&& compflags == NULL)
|
||||
{
|
||||
/* Turn flag "c" into COMPOUNDRULE compatible string "c+",
|
||||
@@ -5376,7 +5543,15 @@ spell_read_aff(spin, fname)
|
||||
compflags = p;
|
||||
}
|
||||
}
|
||||
else if (STRCMP(items[0], "COMPOUNDRULE") == 0 && itemcnt == 2)
|
||||
else if (is_aff_rule(items, itemcnt, "COMPOUNDRULES", 2))
|
||||
{
|
||||
/* We don't use the count, but do check that it's a number and
|
||||
* not COMPOUNDRULE mistyped. */
|
||||
if (atoi((char *)items[1]) == 0)
|
||||
smsg((char_u *)_("Wrong COMPOUNDRULES value in %s line %d: %s"),
|
||||
fname, lnum, items[1]);
|
||||
}
|
||||
else if (is_aff_rule(items, itemcnt, "COMPOUNDRULE", 2))
|
||||
{
|
||||
/* Concatenate this string to previously defined ones, using a
|
||||
* slash to separate them. */
|
||||
@@ -5395,7 +5570,7 @@ spell_read_aff(spin, fname)
|
||||
compflags = p;
|
||||
}
|
||||
}
|
||||
else if (STRCMP(items[0], "COMPOUNDWORDMAX") == 0 && itemcnt == 2
|
||||
else if (is_aff_rule(items, itemcnt, "COMPOUNDWORDMAX", 2)
|
||||
&& compmax == 0)
|
||||
{
|
||||
compmax = atoi((char *)items[1]);
|
||||
@@ -5403,7 +5578,7 @@ spell_read_aff(spin, fname)
|
||||
smsg((char_u *)_("Wrong COMPOUNDWORDMAX value in %s line %d: %s"),
|
||||
fname, lnum, items[1]);
|
||||
}
|
||||
else if (STRCMP(items[0], "COMPOUNDMIN") == 0 && itemcnt == 2
|
||||
else if (is_aff_rule(items, itemcnt, "COMPOUNDMIN", 2)
|
||||
&& compminlen == 0)
|
||||
{
|
||||
compminlen = atoi((char *)items[1]);
|
||||
@@ -5411,7 +5586,7 @@ spell_read_aff(spin, fname)
|
||||
smsg((char_u *)_("Wrong COMPOUNDMIN value in %s line %d: %s"),
|
||||
fname, lnum, items[1]);
|
||||
}
|
||||
else if (STRCMP(items[0], "COMPOUNDSYLMAX") == 0 && itemcnt == 2
|
||||
else if (is_aff_rule(items, itemcnt, "COMPOUNDSYLMAX", 2)
|
||||
&& compsylmax == 0)
|
||||
{
|
||||
compsylmax = atoi((char *)items[1]);
|
||||
@@ -5419,32 +5594,29 @@ spell_read_aff(spin, fname)
|
||||
smsg((char_u *)_("Wrong COMPOUNDSYLMAX value in %s line %d: %s"),
|
||||
fname, lnum, items[1]);
|
||||
}
|
||||
else if (STRCMP(items[0], "CHECKCOMPOUNDDUP") == 0 && itemcnt == 1)
|
||||
else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDDUP", 1))
|
||||
{
|
||||
compoptions |= COMP_CHECKDUP;
|
||||
}
|
||||
else if (STRCMP(items[0], "CHECKCOMPOUNDREP") == 0 && itemcnt == 1)
|
||||
else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDREP", 1))
|
||||
{
|
||||
compoptions |= COMP_CHECKREP;
|
||||
}
|
||||
else if (STRCMP(items[0], "CHECKCOMPOUNDCASE") == 0 && itemcnt == 1)
|
||||
else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDCASE", 1))
|
||||
{
|
||||
compoptions |= COMP_CHECKCASE;
|
||||
}
|
||||
else if (STRCMP(items[0], "CHECKCOMPOUNDTRIPLE") == 0
|
||||
&& itemcnt == 1)
|
||||
else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDTRIPLE", 1))
|
||||
{
|
||||
compoptions |= COMP_CHECKTRIPLE;
|
||||
}
|
||||
else if (STRCMP(items[0], "CHECKCOMPOUNDPATTERN") == 0
|
||||
&& itemcnt == 2)
|
||||
else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 2))
|
||||
{
|
||||
if (atoi((char *)items[1]) == 0)
|
||||
smsg((char_u *)_("Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s"),
|
||||
fname, lnum, items[1]);
|
||||
}
|
||||
else if (STRCMP(items[0], "CHECKCOMPOUNDPATTERN") == 0
|
||||
&& itemcnt == 3)
|
||||
else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 3))
|
||||
{
|
||||
garray_T *gap = &spin->si_comppat;
|
||||
int i;
|
||||
@@ -5463,24 +5635,24 @@ spell_read_aff(spin, fname)
|
||||
= getroom_save(spin, items[2]);
|
||||
}
|
||||
}
|
||||
else if (STRCMP(items[0], "SYLLABLE") == 0 && itemcnt == 2
|
||||
else if (is_aff_rule(items, itemcnt, "SYLLABLE", 2)
|
||||
&& syllable == NULL)
|
||||
{
|
||||
syllable = getroom_save(spin, items[1]);
|
||||
}
|
||||
else if (STRCMP(items[0], "NOBREAK") == 0 && itemcnt == 1)
|
||||
else if (is_aff_rule(items, itemcnt, "NOBREAK", 1))
|
||||
{
|
||||
spin->si_nobreak = TRUE;
|
||||
}
|
||||
else if (STRCMP(items[0], "NOSPLITSUGS") == 0 && itemcnt == 1)
|
||||
else if (is_aff_rule(items, itemcnt, "NOSPLITSUGS", 1))
|
||||
{
|
||||
spin->si_nosplitsugs = TRUE;
|
||||
}
|
||||
else if (STRCMP(items[0], "NOSUGFILE") == 0 && itemcnt == 1)
|
||||
else if (is_aff_rule(items, itemcnt, "NOSUGFILE", 1))
|
||||
{
|
||||
spin->si_nosugfile = TRUE;
|
||||
}
|
||||
else if (STRCMP(items[0], "PFXPOSTPONE") == 0 && itemcnt == 1)
|
||||
else if (is_aff_rule(items, itemcnt, "PFXPOSTPONE", 1))
|
||||
{
|
||||
aff->af_pfxpostpone = TRUE;
|
||||
}
|
||||
@@ -5771,24 +5943,20 @@ spell_read_aff(spin, fname)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (STRCMP(items[0], "FOL") == 0 && itemcnt == 2
|
||||
&& fol == NULL)
|
||||
else if (is_aff_rule(items, itemcnt, "FOL", 2) && fol == NULL)
|
||||
{
|
||||
fol = vim_strsave(items[1]);
|
||||
}
|
||||
else if (STRCMP(items[0], "LOW") == 0 && itemcnt == 2
|
||||
&& low == NULL)
|
||||
else if (is_aff_rule(items, itemcnt, "LOW", 2) && low == NULL)
|
||||
{
|
||||
low = vim_strsave(items[1]);
|
||||
}
|
||||
else if (STRCMP(items[0], "UPP") == 0 && itemcnt == 2
|
||||
&& upp == NULL)
|
||||
else if (is_aff_rule(items, itemcnt, "UPP", 2) && upp == NULL)
|
||||
{
|
||||
upp = vim_strsave(items[1]);
|
||||
}
|
||||
else if ((STRCMP(items[0], "REP") == 0
|
||||
|| STRCMP(items[0], "REPSAL") == 0)
|
||||
&& itemcnt == 2)
|
||||
else if (is_aff_rule(items, itemcnt, "REP", 2)
|
||||
|| is_aff_rule(items, itemcnt, "REPSAL", 2))
|
||||
{
|
||||
/* Ignore REP/REPSAL count */;
|
||||
if (!isdigit(*items[1]))
|
||||
@@ -5819,7 +5987,7 @@ spell_read_aff(spin, fname)
|
||||
: &spin->si_rep, items[1], items[2]);
|
||||
}
|
||||
}
|
||||
else if (STRCMP(items[0], "MAP") == 0 && itemcnt == 2)
|
||||
else if (is_aff_rule(items, itemcnt, "MAP", 2))
|
||||
{
|
||||
/* MAP item or count */
|
||||
if (!found_map)
|
||||
@@ -5856,9 +6024,8 @@ spell_read_aff(spin, fname)
|
||||
ga_append(&spin->si_map, '/');
|
||||
}
|
||||
}
|
||||
/* Accept "SAL from to" and "SAL from to # comment". */
|
||||
else if (STRCMP(items[0], "SAL") == 0
|
||||
&& (itemcnt == 3 || (itemcnt > 3 && items[3][0] == '#')))
|
||||
/* Accept "SAL from to" and "SAL from to #comment". */
|
||||
else if (is_aff_rule(items, itemcnt, "SAL", 3))
|
||||
{
|
||||
if (do_sal)
|
||||
{
|
||||
@@ -5877,12 +6044,12 @@ spell_read_aff(spin, fname)
|
||||
: items[2]);
|
||||
}
|
||||
}
|
||||
else if (STRCMP(items[0], "SOFOFROM") == 0 && itemcnt == 2
|
||||
else if (is_aff_rule(items, itemcnt, "SOFOFROM", 2)
|
||||
&& sofofrom == NULL)
|
||||
{
|
||||
sofofrom = getroom_save(spin, items[1]);
|
||||
}
|
||||
else if (STRCMP(items[0], "SOFOTO") == 0 && itemcnt == 2
|
||||
else if (is_aff_rule(items, itemcnt, "SOFOTO", 2)
|
||||
&& sofoto == NULL)
|
||||
{
|
||||
sofoto = getroom_save(spin, items[1]);
|
||||
@@ -6016,6 +6183,22 @@ spell_read_aff(spin, fname)
|
||||
return aff;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return TRUE when items[0] equals "rulename", there are "mincount" items or
|
||||
* a comment is following after item "mincount".
|
||||
*/
|
||||
static int
|
||||
is_aff_rule(items, itemcnt, rulename, mincount)
|
||||
char_u **items;
|
||||
int itemcnt;
|
||||
char *rulename;
|
||||
int mincount;
|
||||
{
|
||||
return (STRCMP(items[0], rulename) == 0
|
||||
&& (itemcnt == mincount
|
||||
|| (itemcnt > mincount && items[mincount][0] == '#')));
|
||||
}
|
||||
|
||||
/*
|
||||
* For affix "entry" move COMPOUNDFORBIDFLAG and COMPOUNDPERMITFLAG from
|
||||
* ae_flags to ae_comppermit and ae_compforbid.
|
||||
@@ -7926,7 +8109,7 @@ write_vim_spell(spin, fname)
|
||||
char_u *p;
|
||||
int rr;
|
||||
int retval = OK;
|
||||
int fwv = 1; /* collect return value of fwrite() to avoid
|
||||
size_t fwv = 1; /* collect return value of fwrite() to avoid
|
||||
warnings from picky compiler */
|
||||
|
||||
fd = mch_fopen((char *)fname, "w");
|
||||
@@ -7939,6 +8122,10 @@ write_vim_spell(spin, fname)
|
||||
/* <HEADER>: <fileID> <versionnr> */
|
||||
/* <fileID> */
|
||||
fwv &= fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd);
|
||||
if (fwv != (size_t)1)
|
||||
/* Catch first write error, don't try writing more. */
|
||||
goto theend;
|
||||
|
||||
putc(VIMSPELLVERSION, fd); /* <versionnr> */
|
||||
|
||||
/*
|
||||
@@ -8112,7 +8299,8 @@ write_vim_spell(spin, fname)
|
||||
p = rr == 1 ? ftp->ft_from : ftp->ft_to;
|
||||
l = (int)STRLEN(p);
|
||||
putc(l, fd);
|
||||
fwv &= fwrite(p, l, (size_t)1, fd);
|
||||
if (l > 0)
|
||||
fwv &= fwrite(p, l, (size_t)1, fd);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8299,11 +8487,11 @@ write_vim_spell(spin, fname)
|
||||
/* Write another byte to check for errors (file system full). */
|
||||
if (putc(0, fd) == EOF)
|
||||
retval = FAIL;
|
||||
|
||||
theend:
|
||||
if (fclose(fd) == EOF)
|
||||
retval = FAIL;
|
||||
|
||||
if (fwv != 1)
|
||||
if (fwv != (size_t)1)
|
||||
retval = FAIL;
|
||||
if (retval == FAIL)
|
||||
EMSG(_(e_write));
|
||||
@@ -9896,7 +10084,7 @@ write_spell_prefcond(fd, gap)
|
||||
char_u *p;
|
||||
int len;
|
||||
int totlen;
|
||||
int x = 1; /* collect return value of fwrite() */
|
||||
size_t x = 1; /* collect return value of fwrite() */
|
||||
|
||||
if (fd != NULL)
|
||||
put_bytes(fd, (long_u)gap->ga_len, 2); /* <prefcondcnt> */
|
||||
@@ -11487,15 +11675,24 @@ suggest_trie_walk(su, lp, fword, soundfold)
|
||||
vim_strncpy(preword + sp->ts_prewordlen,
|
||||
tword + sp->ts_splitoff,
|
||||
sp->ts_twordlen - sp->ts_splitoff);
|
||||
p = preword;
|
||||
while (*skiptowhite(p) != NUL)
|
||||
p = skipwhite(skiptowhite(p));
|
||||
if (fword_ends && !can_compound(slang, p,
|
||||
compflags + sp->ts_compsplit))
|
||||
/* Compound is not allowed. But it may still be
|
||||
* possible if we add another (short) word. */
|
||||
|
||||
/* Verify CHECKCOMPOUNDPATTERN rules. */
|
||||
if (match_checkcompoundpattern(preword, sp->ts_prewordlen,
|
||||
&slang->sl_comppat))
|
||||
compound_ok = FALSE;
|
||||
|
||||
if (compound_ok)
|
||||
{
|
||||
p = preword;
|
||||
while (*skiptowhite(p) != NUL)
|
||||
p = skipwhite(skiptowhite(p));
|
||||
if (fword_ends && !can_compound(slang, p,
|
||||
compflags + sp->ts_compsplit))
|
||||
/* Compound is not allowed. But it may still be
|
||||
* possible if we add another (short) word. */
|
||||
compound_ok = FALSE;
|
||||
}
|
||||
|
||||
/* Get pointer to last char of previous word. */
|
||||
p = preword + sp->ts_prewordlen;
|
||||
mb_ptr_back(preword, p);
|
||||
@@ -11692,10 +11889,9 @@ suggest_trie_walk(su, lp, fword, soundfold)
|
||||
&& (slang->sl_compsylmax < MAXWLEN
|
||||
|| sp->ts_complen + 1 - sp->ts_compsplit
|
||||
< slang->sl_compmax)
|
||||
&& (byte_in_str(sp->ts_complen == sp->ts_compsplit
|
||||
? slang->sl_compstartflags
|
||||
: slang->sl_compallflags,
|
||||
((unsigned)flags >> 24))))
|
||||
&& (can_be_compound(sp, slang,
|
||||
compflags, ((unsigned)flags >> 24))))
|
||||
|
||||
{
|
||||
try_compound = TRUE;
|
||||
compflags[sp->ts_complen] = ((unsigned)flags >> 24);
|
||||
|
||||
21
src/tag.c
21
src/tag.c
@@ -2725,7 +2725,24 @@ parse_tag_line(lbuf,
|
||||
*/
|
||||
p_7f = vim_strchr(lbuf, 0x7f);
|
||||
if (p_7f == NULL)
|
||||
{
|
||||
etag_fail:
|
||||
if (vim_strchr(lbuf, '\n') == NULL)
|
||||
{
|
||||
/* Truncated line. Ignore it. */
|
||||
if (p_verbose >= 5)
|
||||
{
|
||||
verbose_enter();
|
||||
MSG(_("Ignoring long line in tags file"));
|
||||
verbose_leave();
|
||||
}
|
||||
tagp->command = lbuf;
|
||||
tagp->tagname = lbuf;
|
||||
tagp->tagname_end = lbuf;
|
||||
return OK;
|
||||
}
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
/* Find ^A. If not found the line number is after the 0x7f */
|
||||
p = vim_strchr(p_7f, Ctrl_A);
|
||||
@@ -2735,7 +2752,7 @@ parse_tag_line(lbuf,
|
||||
++p;
|
||||
|
||||
if (!VIM_ISDIGIT(*p)) /* check for start of line number */
|
||||
return FAIL;
|
||||
goto etag_fail;
|
||||
tagp->command = p;
|
||||
|
||||
|
||||
@@ -2749,7 +2766,7 @@ parse_tag_line(lbuf,
|
||||
/* find end of tagname */
|
||||
for (p = p_7f - 1; !vim_iswordc(*p); --p)
|
||||
if (p == lbuf)
|
||||
return FAIL;
|
||||
goto etag_fail;
|
||||
tagp->tagname_end = p + 1;
|
||||
while (p >= lbuf && vim_iswordc(*p))
|
||||
--p;
|
||||
|
||||
@@ -676,6 +676,56 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
80,
|
||||
/**/
|
||||
79,
|
||||
/**/
|
||||
78,
|
||||
/**/
|
||||
77,
|
||||
/**/
|
||||
76,
|
||||
/**/
|
||||
75,
|
||||
/**/
|
||||
74,
|
||||
/**/
|
||||
73,
|
||||
/**/
|
||||
72,
|
||||
/**/
|
||||
71,
|
||||
/**/
|
||||
70,
|
||||
/**/
|
||||
69,
|
||||
/**/
|
||||
68,
|
||||
/**/
|
||||
67,
|
||||
/**/
|
||||
66,
|
||||
/**/
|
||||
65,
|
||||
/**/
|
||||
64,
|
||||
/**/
|
||||
63,
|
||||
/**/
|
||||
62,
|
||||
/**/
|
||||
61,
|
||||
/**/
|
||||
60,
|
||||
/**/
|
||||
59,
|
||||
/**/
|
||||
58,
|
||||
/**/
|
||||
57,
|
||||
/**/
|
||||
56,
|
||||
/**/
|
||||
55,
|
||||
/**/
|
||||
@@ -790,6 +840,19 @@ static int included_patches[] =
|
||||
0
|
||||
};
|
||||
|
||||
/*
|
||||
* Place to put a short description when adding a feature with a patch.
|
||||
* Keep it short, e.g.,: "relative numbers", "persistent undo".
|
||||
* Also add a comment marker to separate the lines.
|
||||
* See the official Vim patches for the diff format: It must use a context of
|
||||
* one line only. Create it by hand or use "diff -C2" and edit the patch.
|
||||
*/
|
||||
static char *(extra_patches[]) =
|
||||
{ /* Add your patch description below this line */
|
||||
/**/
|
||||
NULL
|
||||
};
|
||||
|
||||
int
|
||||
highest_patch()
|
||||
{
|
||||
@@ -935,6 +998,19 @@ list_version()
|
||||
}
|
||||
}
|
||||
|
||||
/* Print the list of extra patch descriptions if there is at least one. */
|
||||
if (extra_patches[0] != NULL)
|
||||
{
|
||||
MSG_PUTS(_("\nExtra patches: "));
|
||||
s = "";
|
||||
for (i = 0; extra_patches[i] != NULL; ++i)
|
||||
{
|
||||
MSG_PUTS(s);
|
||||
s = ", ";
|
||||
MSG_PUTS(extra_patches[i]);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MODIFIED_BY
|
||||
MSG_PUTS("\n");
|
||||
MSG_PUTS(_("Modified by "));
|
||||
|
||||
Reference in New Issue
Block a user