Compare commits

..

11 Commits

Author SHA1 Message Date
5fe691240b patch 8.0.0666: dead for loop
Problem:    Dead for loop. (Coverity)
Solution:   Remove the for loop.
2017-06-23 23:00:08 +02:00
090209bfbd patch 8.0.0665: warning for uninitialized variable
Problem:    Warning for uninitialized variable. (Tony Mechelynck)
Solution:   Initialize it.
2017-06-23 22:45:33 +02:00
6d006f9e95 patch 8.0.0664: mouse does not work in tmux
Problem:    Mouse does not work in tmux. (lilydjwg)
Solution:   Add flag for SGR release being present.
2017-06-23 22:35:34 +02:00
f8be461d02 patch 8.0.0663: unexpected error message only when 'verbose' is set
Problem:    Giving an error message only when 'verbose' set is unexpected.
Solution:   Give a warning message instead.
2017-06-23 20:52:40 +02:00
4670490673 patch 8.0.0662: stray FIXME for fixed problem
Problem:    Stray FIXME for fixed problem.
Solution:   Remove the comment. (Dominique Pelle)
2017-06-22 23:03:12 +02:00
a529ce068b patch 8.0.0661: recognizing urxvt mouse codes does not work well
Problem:    Recognizing urxvt mouse codes does not work well.
Solution:   Recognize "Esc[*M" and "Esc[*m". (Maurice Bos, closes #1486)
2017-06-22 22:37:57 +02:00
a1fed064d1 patch 8.0.0660: silent install on MS-Windows shows dialog
Problem:    Silent install on MS-Windows does show a dialog.
Solution:   Add /SD to the default choice. (allburov, closes #1772)
2017-06-22 22:05:02 +02:00
4d785895d1 patch 8.0.0659: no test for conceal mode
Problem:    No test for conceal mode.
Solution:   Add a conceal mode test. (Dominique Pelle, closes #1783)
2017-06-22 22:00:50 +02:00
d2c061d24c patch 8.0.0658: spell test is old style
Problem:    Spell test is old style.
Solution:   Turn the spell test into a new style test (pschuh, closes #1778)
2017-06-22 21:42:49 +02:00
6a8958db25 patch 8.0.0657: cannot get and set quickfix list items
Problem:    Cannot get and set quickfix list items.
Solution:   Add the "items" argument to getqflist() and setqflist(). (Yegappan
            Lakshmanan)
2017-06-22 21:33:20 +02:00
6f9a476b2f patch 8.0.0656: cannot use ! after some user commands
Problem:    Cannot use ! after some user commands.
Solution:   Properly check for existing command. (Higashi Higashi)
2017-06-22 20:39:17 +02:00
22 changed files with 1080 additions and 1091 deletions

View File

@ -87,7 +87,7 @@ UninstPage instfiles
Function .onInit
MessageBox MB_YESNO|MB_ICONQUESTION \
"This will install Vim ${VER_MAJOR}.${VER_MINOR} on your computer.$\n Continue?" \
IDYES NoAbort
/SD IDYES NoAbort
Abort ; causes installer to quit.
NoAbort:

View File

@ -1,4 +1,4 @@
*eval.txt* For Vim version 8.0. Last change: 2017 Jun 22
*eval.txt* For Vim version 8.0. Last change: 2017 Jun 23
VIM REFERENCE MANUAL by Bram Moolenaar
@ -4586,6 +4586,7 @@ getqflist([{what}]) *getqflist()*
returns only the items listed in {what} as a dictionary. The
following string items are supported in {what}:
context get the context stored with |setqflist()|
items quickfix list entries
nr get information for this quickfix list; zero
means the current quickfix list and '$' means
the last quickfix list
@ -4602,6 +4603,7 @@ getqflist([{what}]) *getqflist()*
The returned dictionary contains the following entries:
context context information stored with |setqflist()|
items quickfix list entries
nr quickfix list number
title quickfix list title text
winid quickfix |window-ID| (if opened)
@ -5466,9 +5468,9 @@ line({expr}) The result is a Number, which is the line number of the file
This autocommand jumps to the last known position in a file
just after opening it, if the '" mark is set: >
:au BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") && &ft !~# 'commit'
\ | exe "normal! g`\""
\ | endif
\ if line("'\"") > 1 && line("'\"") <= line("$") && &ft !~# 'commit'
\ | exe "normal! g`\""
\ | endif
line2byte({lnum}) *line2byte()*
Return the byte count from the start of the buffer for line
@ -5890,7 +5892,7 @@ max({expr}) Return the maximum value of all items in {expr}.
it returns the maximum of all values in the dictionary.
If {expr} is neither a list nor a dictionary, or one of the
items in {expr} cannot be used as a Number this results in
an error. An empty |List| or |Dictionary| results in zero.
an error. An empty |List| or |Dictionary| results in zero.
*min()*
min({expr}) Return the minimum value of all items in {expr}.
@ -5898,7 +5900,7 @@ min({expr}) Return the minimum value of all items in {expr}.
it returns the minimum of all values in the dictionary.
If {expr} is neither a list nor a dictionary, or one of the
items in {expr} cannot be used as a Number this results in
an error. An empty |List| or |Dictionary| results in zero.
an error. An empty |List| or |Dictionary| results in zero.
*mkdir()* *E739*
mkdir({name} [, {path} [, {prot}]])
@ -6193,8 +6195,8 @@ printf({fmt}, {expr1} ...) *printf()*
zero the decimal point is omitted. When the precision
is not specified 6 is used. A really big number
(out of range or dividing by zero) results in "inf"
or "-inf" with %f (INF or -INF with %F).
"0.0 / 0.0" results in "nan" with %f (NAN with %F).
or "-inf" with %f (INF or -INF with %F).
"0.0 / 0.0" results in "nan" with %f (NAN with %F).
Example: >
echo printf("%.2f", 12.115)
< 12.12
@ -6998,6 +7000,8 @@ setqflist({list} [, {action}[, {what}]]) *setqflist()*
argument is ignored. The following items can be specified in
{what}:
context any Vim type can be stored as a context
items list of quickfix entries. Same as the {list}
argument.
nr list number in the quickfix stack; zero
means the current quickfix list and '$' means
the last quickfix list
@ -7651,17 +7655,20 @@ synIDtrans({synID}) *synIDtrans()*
":highlight link" are followed.
synconcealed({lnum}, {col}) *synconcealed()*
The result is a List. The first item in the list is 0 if the
character at the position {lnum} and {col} is not part of a
concealable region, 1 if it is. The second item in the list is
a string. If the first item is 1, the second item contains the
text which will be displayed in place of the concealed text,
depending on the current setting of 'conceallevel'. The third
and final item in the list is a unique number representing the
specific syntax region matched. This allows detection of the
beginning of a new concealable region if there are two
consecutive regions with the same replacement character.
For an example use see $VIMRUNTIME/syntax/2html.vim .
The result is a List with currently three items:
1. The first item in the list is 0 if the character at the
position {lnum} and {col} is not part of a concealable
region, 1 if it is.
2. The second item in the list is a string. If the first item
is 1, the second item contains the text which will be
displayed in place of the concealed text, depending on the
current setting of 'conceallevel' and 'listchars'.
3. The third and final item in the list is a unique number
representing the specific syntax region matched. This
allows detection of the beginning of a new concealable
region if there are two consecutive regions with the same
replacement character. For an example use see
$VIMRUNTIME/syntax/2html.vim .
synstack({lnum}, {col}) *synstack()*
@ -8348,8 +8355,8 @@ winwidth({nr}) *winwidth()*
:if winwidth(0) <= 50
: exe "normal 50\<C-W>|"
:endif
< For getting the terminal or screen size, see the 'columns'
option.
< For getting the terminal or screen size, see the 'columns'
option.
wordcount() *wordcount()*
@ -8367,11 +8374,11 @@ wordcount() *wordcount()*
cursor_words Number of words before cursor position
(not in Visual mode)
visual_bytes Number of bytes visually selected
(only in Visual mode)
(only in Visual mode)
visual_chars Number of chars visually selected
(only in Visual mode)
(only in Visual mode)
visual_words Number of chars visually selected
(only in Visual mode)
(only in Visual mode)
*writefile()*
@ -8715,6 +8722,9 @@ See |:verbose-cmd| for more information.
not used an error message is given. When [!] is used,
an existing function is silently replaced. Unless it
is currently being executed, that is an error.
NOTE: Use ! wisely. If used without care it can cause
an existing function to be replaced unexpectedly,
which is hard to debug.
For the {arguments} see |function-argument|.
@ -8764,7 +8774,7 @@ See |:verbose-cmd| for more information.
implies that the effect of |:nohlsearch| is undone
when the function returns.
*:endf* *:endfunction* *E126* *E193* *E946*
*:endf* *:endfunction* *E126* *E193* *W22*
:endf[unction] [argument]
The end of a function definition. Best is to put it
on a line by its own, without [argument].
@ -8773,12 +8783,16 @@ See |:verbose-cmd| for more information.
| command command to execute next
\n command command to execute next
" comment always ignored
anything else ignored, unless 'verbose' is
non-zero
anything else ignored, warning given when
'verbose' is non-zero
The support for a following command was added in Vim
8.0.0654, before that any argument was silently
ignored.
To be able to define a function inside an `:execute`
command, use line breaks instead of |:bar|: >
:exe "func Foo()\necho 'foo'\nendfunc"
<
*:delf* *:delfunction* *E130* *E131* *E933*
:delf[unction][!] {name}
Delete function {name}.

View File

@ -2086,7 +2086,7 @@ test1 \
test20 test21 test22 test23 test24 test25 test26 test27 test28 test29 \
test30 test31 test32 test33 test34 test36 test37 test38 test39 \
test40 test41 test42 test43 test44 test45 test48 test49 \
test50 test51 test52 test53 test54 test55 test56 test57 test58 test59 \
test50 test51 test52 test53 test54 test55 test56 test57 test59 \
test60 test64 test66 test67 test68 test69 \
test70 test72 test73 test74 test75 test77 test78 test79 \
test80 test82 test83 test84 test85 test86 test87 test88 \

View File

@ -11841,8 +11841,8 @@ f_synconcealed(typval_T *argvars UNUSED, typval_T *rettv)
if ((syntax_flags & HL_CONCEAL) && curwin->w_p_cole < 3)
{
cchar = syn_get_sub_char();
if (cchar == NUL && curwin->w_p_cole == 1 && lcs_conceal != NUL)
cchar = lcs_conceal;
if (cchar == NUL && curwin->w_p_cole == 1)
cchar = (lcs_conceal == NUL) ? ' ' : lcs_conceal;
if (cchar != NUL)
{
# ifdef FEAT_MBYTE

View File

@ -2370,7 +2370,8 @@ do_one_cmd(
goto doend;
}
/* Check for wrong commands. */
if (*p == '!' && ea.cmd[1] == 0151 && ea.cmd[0] == 78)
if (*p == '!' && ea.cmd[1] == 0151 && ea.cmd[0] == 78
&& !IS_USER_CMDIDX(ea.cmdidx))
{
errormsg = uc_fun_cmd();
goto doend;

View File

@ -112,6 +112,7 @@
/* Used for the sgr mouse. */
#define KS_SGR_MOUSE 237
#define KS_SGR_MOUSE_RELEASE 236 /* Release */
/*
* Filler used after KS_SPECIAL and others
@ -416,6 +417,7 @@ enum key_extra
#define K_PTERM_MOUSE TERMCAP2KEY(KS_PTERM_MOUSE, KE_FILLER)
#define K_URXVT_MOUSE TERMCAP2KEY(KS_URXVT_MOUSE, KE_FILLER)
#define K_SGR_MOUSE TERMCAP2KEY(KS_SGR_MOUSE, KE_FILLER)
#define K_SGR_MOUSERELEASE TERMCAP2KEY(KS_SGR_MOUSE_RELEASE, KE_FILLER)
#define K_SELECT TERMCAP2KEY(KS_SELECT, KE_FILLER)
#define K_TEAROFF TERMCAP2KEY(KS_TEAROFF, KE_FILLER)

View File

@ -3471,6 +3471,13 @@ give_warning(char_u *message, int hl)
--no_wait_return;
}
void
give_warning2(char_u *message, char_u *a1, int hl)
{
vim_snprintf((char *)IObuff, IOSIZE, (char *)message, a1);
give_warning(IObuff, hl);
}
/*
* Advance msg cursor to column "col".
*/

View File

@ -2438,6 +2438,7 @@ static struct key_name_entry
#endif
#ifdef FEAT_MOUSE_SGR
{K_SGR_MOUSE, (char_u *)"SgrMouse"},
{K_SGR_MOUSERELEASE, (char_u *)"SgrMouseRelelase"},
#endif
{K_LEFTMOUSE, (char_u *)"LeftMouse"},
{K_LEFTMOUSE_NM, (char_u *)"LeftMouseNM"},

View File

@ -3771,7 +3771,6 @@ check_mouse_termcode(void)
del_mouse_termcode(KS_PTERM_MOUSE);
# endif
# ifdef FEAT_MOUSE_URXVT
/* same conflict as the dec mouse */
if (use_xterm_mouse() == 3
# ifdef FEAT_GUI
&& !gui.in_use
@ -3779,8 +3778,8 @@ check_mouse_termcode(void)
)
{
set_mouse_termcode(KS_URXVT_MOUSE, (char_u *)(term_is_8bit(T_NAME)
? IF_EB("\233", CSI_STR)
: IF_EB("\033[", ESC_STR "[")));
? IF_EB("\233*M", CSI_STR "*M")
: IF_EB("\033[*M", ESC_STR "[*M")));
if (*p_mouse != NUL)
{
@ -3792,7 +3791,6 @@ check_mouse_termcode(void)
del_mouse_termcode(KS_URXVT_MOUSE);
# endif
# ifdef FEAT_MOUSE_SGR
/* There is no conflict with xterm mouse */
if (use_xterm_mouse() == 4
# ifdef FEAT_GUI
&& !gui.in_use
@ -3800,8 +3798,12 @@ check_mouse_termcode(void)
)
{
set_mouse_termcode(KS_SGR_MOUSE, (char_u *)(term_is_8bit(T_NAME)
? IF_EB("\233<", CSI_STR "<")
: IF_EB("\033[<", ESC_STR "[<")));
? IF_EB("\233<*M", CSI_STR "<*M")
: IF_EB("\033[<*M", ESC_STR "[<*M")));
set_mouse_termcode(KS_SGR_MOUSE_RELEASE, (char_u *)(term_is_8bit(T_NAME)
? IF_EB("\233<*m", CSI_STR "<*m")
: IF_EB("\033[<*m", ESC_STR "[<*m")));
if (*p_mouse != NUL)
{
@ -3810,7 +3812,10 @@ check_mouse_termcode(void)
}
}
else
{
del_mouse_termcode(KS_SGR_MOUSE);
del_mouse_termcode(KS_SGR_MOUSE_RELEASE);
}
# endif
}
#endif

View File

@ -75,6 +75,7 @@ void verbose_leave_scroll(void);
void verbose_stop(void);
int verbose_open(void);
void give_warning(char_u *message, int hl);
void give_warning2(char_u *message, char_u *a1, int hl);
void msg_advance(int col);
int do_dialog(int type, char_u *title, char_u *message, char_u *buttons, int dfltbutton, char_u *textfield, int ex_cmd);
void display_confirm_msg(void);

View File

@ -47,19 +47,32 @@ struct qfline_S
*/
#define LISTCOUNT 10
/*
* Quickfix/Location list definition
* Contains a list of entries (qfline_T). qf_start points to the first entry
* and qf_last points to the last entry. qf_count contains the list size.
*
* Usually the list contains one or more entries. But an empty list can be
* created using setqflist()/setloclist() with a title and/or user context
* information and entries can be added later using setqflist()/setloclist().
*/
typedef struct qf_list_S
{
qfline_T *qf_start; /* pointer to the first error */
qfline_T *qf_last; /* pointer to the last error */
qfline_T *qf_ptr; /* pointer to the current error */
int qf_count; /* number of errors (0 means no error list) */
int qf_count; /* number of errors (0 means empty list) */
int qf_index; /* current index in the error list */
int qf_nonevalid; /* TRUE if not a single valid entry found */
char_u *qf_title; /* title derived from the command that created
* the error list */
* the error list or set by setqflist */
typval_T *qf_ctx; /* context set by setqflist/setloclist */
} qf_list_T;
/*
* Quickfix/Location list stack definition
* Contains a list of quickfix/location lists (qf_list_T)
*/
struct qf_info_S
{
/*
@ -1347,6 +1360,9 @@ qf_init_end:
static void
qf_store_title(qf_info_T *qi, int qf_idx, char_u *title)
{
vim_free(qi->qf_lists[qf_idx].qf_title);
qi->qf_lists[qf_idx].qf_title = NULL;
if (title != NULL)
{
char_u *p = alloc((int)STRLEN(title) + 2);
@ -2735,10 +2751,11 @@ qf_history(exarg_T *eap)
}
/*
* Free all the entries in the error list "idx".
* Free all the entries in the error list "idx". Note that other information
* associated with the list like context and title are not freed.
*/
static void
qf_free(qf_info_T *qi, int idx)
qf_free_items(qf_info_T *qi, int idx)
{
qfline_T *qfp;
qfline_T *qfpnext;
@ -2763,10 +2780,7 @@ qf_free(qf_info_T *qi, int idx)
qi->qf_lists[idx].qf_start = qfpnext;
--qi->qf_lists[idx].qf_count;
}
vim_free(qi->qf_lists[idx].qf_title);
qi->qf_lists[idx].qf_title = NULL;
free_tv(qi->qf_lists[idx].qf_ctx);
qi->qf_lists[idx].qf_ctx = NULL;
qi->qf_lists[idx].qf_index = 0;
qi->qf_lists[idx].qf_start = NULL;
qi->qf_lists[idx].qf_last = NULL;
@ -2782,6 +2796,21 @@ qf_free(qf_info_T *qi, int idx)
qi->qf_multiscan = FALSE;
}
/*
* Free error list "idx". Frees all the entries in the quickfix list,
* associated context information and the title.
*/
static void
qf_free(qf_info_T *qi, int idx)
{
qf_free_items(qi, idx);
vim_free(qi->qf_lists[idx].qf_title);
qi->qf_lists[idx].qf_title = NULL;
free_tv(qi->qf_lists[idx].qf_ctx);
qi->qf_lists[idx].qf_ctx = NULL;
}
/*
* qf_mark_adjust: adjust marks
*/
@ -4698,13 +4727,11 @@ get_errorlist_properties(win_T *wp, dict_T *what, dict_T *retdict)
} else if ((di->di_tv.v_type == VAR_STRING) &&
(STRCMP(di->di_tv.vval.v_string, "$") == 0))
{
{
/* Get the last quickfix list number */
if (qi->qf_listcount > 0)
qf_idx = qi->qf_listcount - 1;
else
qf_idx = -1; /* Quickfix stack is empty */
}
/* Get the last quickfix list number */
if (qi->qf_listcount > 0)
qf_idx = qi->qf_listcount - 1;
else
qf_idx = -1; /* Quickfix stack is empty */
flags |= QF_GETLIST_NR;
}
else
@ -4724,6 +4751,9 @@ get_errorlist_properties(win_T *wp, dict_T *what, dict_T *retdict)
if (dict_find(what, (char_u *)"context", -1) != NULL)
flags |= QF_GETLIST_CONTEXT;
if (dict_find(what, (char_u *)"items", -1) != NULL)
flags |= QF_GETLIST_ITEMS;
}
if (flags & QF_GETLIST_TITLE)
@ -4743,6 +4773,15 @@ get_errorlist_properties(win_T *wp, dict_T *what, dict_T *retdict)
if (win != NULL)
status = dict_add_nr_str(retdict, "winid", win->w_id, NULL);
}
if ((status == OK) && (flags & QF_GETLIST_ITEMS))
{
list_T *l = list_alloc();
if (l != NULL)
{
(void)get_errorlist(wp, qf_idx, l);
dict_add_list(retdict, "items", l);
}
}
if ((status == OK) && (flags & QF_GETLIST_CONTEXT))
{
@ -4802,7 +4841,7 @@ qf_add_entries(
#endif
else if (action == 'r')
{
qf_free(qi, qf_idx);
qf_free_items(qi, qf_idx);
qf_store_title(qi, qf_idx, title);
}
@ -4915,15 +4954,27 @@ qf_set_properties(qf_info_T *qi, dict_T *what, int action)
/* for zero use the current list */
if (di->di_tv.vval.v_number != 0)
qf_idx = di->di_tv.vval.v_number - 1;
if (qf_idx < 0 || qf_idx >= qi->qf_listcount)
if ((action == ' ' || action == 'a') &&
qf_idx == qi->qf_listcount)
/*
* When creating a new list, accept qf_idx pointing to the next
* non-available list
*/
newlist = TRUE;
else if (qf_idx < 0 || qf_idx >= qi->qf_listcount)
return FAIL;
else
newlist = FALSE; /* use the specified list */
} else if (di->di_tv.v_type == VAR_STRING &&
STRCMP(di->di_tv.vval.v_string, "$") == 0 &&
qi->qf_listcount > 0)
{
qf_idx = qi->qf_listcount - 1;
newlist = FALSE;
}
else
return FAIL;
newlist = FALSE; /* use the specified list */
}
if (newlist)
@ -4944,6 +4995,17 @@ qf_set_properties(qf_info_T *qi, dict_T *what, int action)
retval = OK;
}
}
if ((di = dict_find(what, (char_u *)"items", -1)) != NULL)
{
if (di->di_tv.v_type == VAR_LIST)
{
char_u *title_save = vim_strsave(qi->qf_lists[qf_idx].qf_title);
retval = qf_add_entries(qi, qf_idx, di->di_tv.vval.v_list,
title_save, action == ' ' ? 'a' : action);
vim_free(title_save);
}
}
if ((di = dict_find(what, (char_u *)"context", -1)) != NULL)
{

View File

@ -1801,9 +1801,8 @@ set_termname(char_u *term)
* The termcode for the mouse is added as a side effect in option.c.
*/
{
char_u *p;
char_u *p = (char_u *)"";
p = (char_u *)"";
# ifdef FEAT_MOUSE_XTERM
if (use_xterm_like_mouse(term))
{
@ -1944,6 +1943,7 @@ set_termname(char_u *term)
# define HMT_PTERM 16
# define HMT_URXVT 32
# define HMT_SGR 64
# define HMT_SGR_REL 128
static int has_mouse_termcode = 0;
# endif
@ -1987,6 +1987,8 @@ set_mouse_termcode(
# ifdef FEAT_MOUSE_SGR
if (n == KS_SGR_MOUSE)
has_mouse_termcode |= HMT_SGR;
else if (n == KS_SGR_MOUSE_RELEASE)
has_mouse_termcode |= HMT_SGR_REL;
else
# endif
has_mouse_termcode |= HMT_NORMAL;
@ -2034,6 +2036,8 @@ del_mouse_termcode(
# ifdef FEAT_MOUSE_SGR
if (n == KS_SGR_MOUSE)
has_mouse_termcode &= ~HMT_SGR;
else if (n == KS_SGR_MOUSE_RELEASE)
has_mouse_termcode &= ~HMT_SGR_REL;
else
# endif
has_mouse_termcode &= ~HMT_NORMAL;
@ -3786,9 +3790,9 @@ add_termcode(char_u *name, char_u *string, int flags)
}
/*
* Check termcode "code[len]" for ending in ;*X, <Esc>O*X or <M-O>*X.
* Check termcode "code[len]" for ending in ;*X or *X.
* The "X" can be any character.
* Return 0 if not found, 2 for ;*X and 1 for O*X and <M-O>*X.
* Return 0 if not found, 2 for ;*X and 1 for *X.
*/
static int
termcode_star(char_u *code, int len)
@ -3798,7 +3802,7 @@ termcode_star(char_u *code, int len)
{
if (len >= 5 && code[len - 3] == ';')
return 2;
if ((len >= 4 && code[len - 3] == 'O') || code[len - 3] == 'O' + 128)
else
return 1;
}
return 0;
@ -3940,6 +3944,7 @@ check_termcode(
int offset;
char_u key_name[2];
int modifiers;
char_u *modifiers_start = NULL;
int key;
int new_slen;
int extra;
@ -4065,6 +4070,7 @@ check_termcode(
* But only when the 'K' flag is in 'cpoptions'.
*/
slen = termcodes[idx].len;
modifiers_start = NULL;
if (cpo_koffset && offset && len < slen)
continue;
if (STRNCMP(termcodes[idx].code, tp,
@ -4125,7 +4131,7 @@ check_termcode(
{
/* Skip over the digits, the final char must
* follow. */
for (j = slen - 2; j < len && isdigit(tp[j]); ++j)
for (j = slen - 2; j < len && (isdigit(tp[j]) || tp[j] == ';'); ++j)
;
++j;
if (len < j) /* got a partial sequence */
@ -4133,8 +4139,10 @@ check_termcode(
if (tp[j - 1] != termcodes[idx].code[slen - 1])
continue; /* no match */
modifiers_start = tp + slen - 2;
/* Match! Convert modifier bits. */
n = atoi((char *)tp + slen - 2) - 1;
n = atoi((char *)modifiers_start) - 1;
if (n & 1)
modifiers |= MOD_MASK_SHIFT;
if (n & 2)
@ -4156,7 +4164,7 @@ check_termcode(
#ifdef FEAT_TERMRESPONSE
if (key_name[0] == NUL
/* Mouse codes of DEC, pterm, and URXVT start with <ESC>[. When
/* Mouse codes of DEC and pterm start with <ESC>[. When
* detecting the start of these mouse codes they might as well be
* another key code or terminal response. */
# ifdef FEAT_MOUSE_DEC
@ -4164,9 +4172,6 @@ check_termcode(
# endif
# ifdef FEAT_MOUSE_PTERM
|| key_name[0] == KS_PTERM_MOUSE
# endif
# ifdef FEAT_MOUSE_URXVT
|| key_name[0] == KS_URXVT_MOUSE
# endif
)
{
@ -4509,6 +4514,7 @@ check_termcode(
# endif
# ifdef FEAT_MOUSE_SGR
|| key_name[0] == KS_SGR_MOUSE
|| key_name[0] == KS_SGR_MOUSE_RELEASE
# endif
)
{
@ -4592,85 +4598,57 @@ check_termcode(
# if defined(FEAT_MOUSE_URXVT) || defined(FEAT_MOUSE_SGR)
if (key_name[0] == KS_URXVT_MOUSE
|| key_name[0] == KS_SGR_MOUSE)
|| key_name[0] == KS_SGR_MOUSE
|| key_name[0] == KS_SGR_MOUSE_RELEASE)
{
for (;;)
{
/* URXVT 1015 mouse reporting mode:
* Almost identical to xterm mouse mode, except the values
* are decimal instead of bytes.
*
* \033[%d;%d;%dM
* ^-- row
* ^----- column
* ^-------- code
*
* SGR 1006 mouse reporting mode:
* Almost identical to xterm mouse mode, except the values
* are decimal instead of bytes.
*
* \033[<%d;%d;%dM
* ^-- row
* ^----- column
* ^-------- code
*
* \033[<%d;%d;%dm : mouse release event
* ^-- row
* ^----- column
* ^-------- code
*/
p = tp + slen;
/* URXVT 1015 mouse reporting mode:
* Almost identical to xterm mouse mode, except the values
* are decimal instead of bytes.
*
* \033[%d;%d;%dM
* ^-- row
* ^----- column
* ^-------- code
*
* SGR 1006 mouse reporting mode:
* Almost identical to xterm mouse mode, except the values
* are decimal instead of bytes.
*
* \033[<%d;%d;%dM
* ^-- row
* ^----- column
* ^-------- code
*
* \033[<%d;%d;%dm : mouse release event
* ^-- row
* ^----- column
* ^-------- code
*/
p = modifiers_start;
if (p == NULL)
return -1;
mouse_code = getdigits(&p);
if (*p++ != ';')
return -1;
mouse_code = getdigits(&p);
if (*p++ != ';')
return -1;
/* when mouse reporting is SGR, add 32 to mouse code */
if (key_name[0] == KS_SGR_MOUSE)
mouse_code += 32;
/* when mouse reporting is SGR, add 32 to mouse code */
if (key_name[0] == KS_SGR_MOUSE
|| key_name[0] == KS_SGR_MOUSE_RELEASE)
mouse_code += 32;
mouse_col = getdigits(&p) - 1;
if (*p++ != ';')
return -1;
if (key_name[0] == KS_SGR_MOUSE_RELEASE)
mouse_code |= MOUSE_RELEASE;
mouse_row = getdigits(&p) - 1;
if (key_name[0] == KS_SGR_MOUSE && *p == 'm')
mouse_code |= MOUSE_RELEASE;
else if (*p != 'M')
return -1;
p++;
mouse_col = getdigits(&p) - 1;
if (*p++ != ';')
return -1;
slen += (int)(p - (tp + slen));
mouse_row = getdigits(&p) - 1;
/* skip this one if next one has same code (like xterm
* case) */
j = termcodes[idx].len;
if (STRNCMP(tp, tp + slen, (size_t)j) == 0)
{
int slen2;
int cmd_complete = 0;
/* check if the command is complete by looking for the
* 'M' */
for (slen2 = slen; slen2 < len; slen2++)
{
if (tp[slen2] == 'M'
|| (key_name[0] == KS_SGR_MOUSE
&& tp[slen2] == 'm'))
{
cmd_complete = 1;
break;
}
}
p += j;
if (cmd_complete && getdigits(&p) == mouse_code)
{
slen += j; /* skip the \033[ */
continue;
}
}
break;
}
/* The modifiers were the mouse coordinates, not the
* modifier keys (alt/shift/ctrl/meta) state. */
modifiers = 0;
}
# endif
@ -4680,6 +4658,7 @@ check_termcode(
#endif
#ifdef FEAT_MOUSE_SGR
|| key_name[0] == KS_SGR_MOUSE
|| key_name[0] == KS_SGR_MOUSE_RELEASE
#endif
)
{

View File

@ -115,7 +115,6 @@ SCRIPTS_MORE4 = \
test17.out \
test30.out \
test32.out \
test58.out \
test59.out \
test72.out \
test78.out \

View File

@ -123,7 +123,7 @@ SCRIPT = test1.out test3.out test4.out test5.out \
# (this should be changed in order to preserve the original filename) - should
# be fixed. VMS allows just one dot in the filename
#
# test58, test59: Failed/Hangs - VMS does not support spell files (file names
# test59: Failed/Hangs - VMS does not support spell files (file names
# with too many dots).
#
# test72: bug - Vim hangs at :rename (while rename works well otherwise)
@ -148,7 +148,7 @@ SCRIPT_WIN = test50.out test52.out
.ENDIF
.IFDEF WANT_SPELL
SCRIPT_SPELL = test58.out test59.out
SCRIPT_SPELL = test59.out
.ENDIF
.IFDEF WANT_MZSCH

View File

@ -1,656 +0,0 @@
Tests for spell checking. vim: set ft=vim :
STARTTEST
:so small.vim
:"
:" Don't want to depend on the locale from the environment
:set enc=latin1
:e!
:"
:" Check using z= in new buffer (crash fixed by patch 7.4a.028).
:set maxmem=512 spell
iasdz=:"
:"
:" Function to test .aff/.dic with list of good and bad words.
:func TestOne(aff, dic)
set spellfile=
$put =''
$put ='test '. a:aff . '-' . a:dic
" Generate a .spl file from a .dic and .aff file.
exe '1;/^' . a:aff . 'affstart/+1,/^' . a:aff . 'affend/-1w! Xtest.aff'
exe '1;/^' . a:dic . 'dicstart/+1,/^' . a:dic . 'dicend/-1w! Xtest.dic'
mkspell! Xtest Xtest
" use that spell file
set spl=Xtest.latin1.spl spell
" list all valid words
spelldump
%yank
quit
$put
$put ='-------'
" find all bad words and suggestions for them
exe '1;/^' . a:aff . 'good:'
normal 0f:]s
let prevbad = ''
while 1
let [bad, a] = spellbadword()
if bad == '' || bad == prevbad || bad == 'badend'
break
endif
let prevbad = bad
let lst = spellsuggest(bad, 3)
normal mm
$put =bad
$put =string(lst)
normal `m]s
endwhile
endfunc
:"
:call TestOne('1', '1')
:$put =soundfold('goobledygoook')
:$put =soundfold('k<>op<6F>r<EFBFBD>n<EFBFBD>ven')
:$put =soundfold('oeverloos gezwets edale')
:"
:"
:" and now with SAL instead of SOFO items; test automatic reloading
gg:/^affstart_sal/+1,/^affend_sal/-1w! Xtest.aff
:mkspell! Xtest Xtest
:$put =soundfold('goobledygoook')
:$put =soundfold('k<>op<6F>r<EFBFBD>n<EFBFBD>ven')
:$put =soundfold('oeverloos gezwets edale')
:"
:" also use an addition file
gg:/^addstart/+1,/^addend/-1w! Xtest.latin1.add
:mkspell! Xtest.latin1.add.spl Xtest.latin1.add
:set spellfile=Xtest.latin1.add
/^test2:
]s:let [str, a] = spellbadword()
:$put =str
:set spl=Xtest_us.latin1.spl
/^test2:
]smm:let [str, a] = spellbadword()
:$put =str
`m]s:let [str, a] = spellbadword()
:$put =str
:set spl=Xtest_gb.latin1.spl
/^test2:
]smm:let [str, a] = spellbadword()
:$put =str
`m]s:let [str, a] = spellbadword()
:$put =str
:set spl=Xtest_nz.latin1.spl
/^test2:
]smm:let [str, a] = spellbadword()
:$put =str
`m]s:let [str, a] = spellbadword()
:$put =str
:set spl=Xtest_ca.latin1.spl
/^test2:
]smm:let [str, a] = spellbadword()
:$put =str
`m]s:let [str, a] = spellbadword()
:$put =str
:unlet str a
:"
:" Postponed prefixes
:call TestOne('2', '1')
:"
:" Compound words
:call TestOne('3', '3')
:call TestOne('4', '4')
:call TestOne('5', '5')
:call TestOne('6', '6')
:call TestOne('7', '7')
:"
:" NOSLITSUGS
:call TestOne('8', '8')
:" Numbers
:call TestOne('9', '9')
:"
:" clean up for valgrind
:delfunc TestOne
:set spl= enc=latin1
:"
gg:/^test output:/,$wq! test.out
ENDTEST
1affstart
SET ISO8859-1
TRY esianrtolcdugmphbyfvkwjkqxz-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'ESIANRTOLCDUGMPHBYFVKWJKQXZ
FOL <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
LOW <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPP <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SOFOFROM abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ<59><5A><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޿
SOFOTO ebctefghejklnnepkrstevvkesebctefghejklnnepkrstevvkeseeeeeeeceeeeeeeedneeeeeeeeeeepseeeeeeeeceeeeeeeedneeeeeeeeeeep?
MIDWORD '-
KEP =
RAR ?
BAD !
PFX I N 1
PFX I 0 in .
PFX O Y 1
PFX O 0 out .
SFX S Y 2
SFX S 0 s [^s]
SFX S 0 es s
SFX N N 3
SFX N 0 en [^n]
SFX N 0 nen n
SFX N 0 n .
REP 3
REP g ch
REP ch g
REP svp s.v.p.
MAP 9
MAP a<><61><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
MAP e<><65><EFBFBD><EFBFBD>
MAP i<><69><EFBFBD><EFBFBD>
MAP o<><6F><EFBFBD><EFBFBD><EFBFBD>
MAP u<><75><EFBFBD><EFBFBD>
MAP n<>
MAP c<>
MAP y<><79>
MAP s<>
1affend
1good: wrong OK puts. Test the end
bad: inputs comment ok Ok. test d<><64>l end the
badend
1dicstart
123456
test/NO
# comment
wrong
Comment
OK
uk
put/ISO
the end
deol
d<EFBFBD><EFBFBD>r
1dicend
affstart_sal
SET ISO8859-1
TRY esianrtolcdugmphbyfvkwjkqxz-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'ESIANRTOLCDUGMPHBYFVKWJKQXZ
FOL <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
LOW <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPP <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
MIDWORD '-
KEP =
RAR ?
BAD !
PFX I N 1
PFX I 0 in .
PFX O Y 1
PFX O 0 out .
SFX S Y 2
SFX S 0 s [^s]
SFX S 0 es s
SFX N N 3
SFX N 0 en [^n]
SFX N 0 nen n
SFX N 0 n .
REP 3
REP g ch
REP ch g
REP svp s.v.p.
MAP 9
MAP a<><61><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
MAP e<><65><EFBFBD><EFBFBD>
MAP i<><69><EFBFBD><EFBFBD>
MAP o<><6F><EFBFBD><EFBFBD><EFBFBD>
MAP u<><75><EFBFBD><EFBFBD>
MAP n<>
MAP c<>
MAP y<><79>
MAP s<>
SAL AH(AEIOUY)-^ *H
SAL AR(AEIOUY)-^ *R
SAL A(HR)^ *
SAL A^ *
SAL AH(AEIOUY)- H
SAL AR(AEIOUY)- R
SAL A(HR) _
SAL <20>^ *
SAL <20>^ *
SAL BB- _
SAL B B
SAL CQ- _
SAL CIA X
SAL CH X
SAL C(EIY)- S
SAL CK K
SAL COUGH^ KF
SAL CC< C
SAL C K
SAL DG(EIY) K
SAL DD- _
SAL D T
SAL <20>< E
SAL EH(AEIOUY)-^ *H
SAL ER(AEIOUY)-^ *R
SAL E(HR)^ *
SAL ENOUGH^$ *NF
SAL E^ *
SAL EH(AEIOUY)- H
SAL ER(AEIOUY)- R
SAL E(HR) _
SAL FF- _
SAL F F
SAL GN^ N
SAL GN$ N
SAL GNS$ NS
SAL GNED$ N
SAL GH(AEIOUY)- K
SAL GH _
SAL GG9 K
SAL G K
SAL H H
SAL IH(AEIOUY)-^ *H
SAL IR(AEIOUY)-^ *R
SAL I(HR)^ *
SAL I^ *
SAL ING6 N
SAL IH(AEIOUY)- H
SAL IR(AEIOUY)- R
SAL I(HR) _
SAL J K
SAL KN^ N
SAL KK- _
SAL K K
SAL LAUGH^ LF
SAL LL- _
SAL L L
SAL MB$ M
SAL MM M
SAL M M
SAL NN- _
SAL N N
SAL OH(AEIOUY)-^ *H
SAL OR(AEIOUY)-^ *R
SAL O(HR)^ *
SAL O^ *
SAL OH(AEIOUY)- H
SAL OR(AEIOUY)- R
SAL O(HR) _
SAL PH F
SAL PN^ N
SAL PP- _
SAL P P
SAL Q K
SAL RH^ R
SAL ROUGH^ RF
SAL RR- _
SAL R R
SAL SCH(EOU)- SK
SAL SC(IEY)- S
SAL SH X
SAL SI(AO)- X
SAL SS- _
SAL S S
SAL TI(AO)- X
SAL TH @
SAL TCH-- _
SAL TOUGH^ TF
SAL TT- _
SAL T T
SAL UH(AEIOUY)-^ *H
SAL UR(AEIOUY)-^ *R
SAL U(HR)^ *
SAL U^ *
SAL UH(AEIOUY)- H
SAL UR(AEIOUY)- R
SAL U(HR) _
SAL V^ W
SAL V F
SAL WR^ R
SAL WH^ W
SAL W(AEIOU)- W
SAL X^ S
SAL X KS
SAL Y(AEIOU)- Y
SAL ZZ- _
SAL Z S
affend_sal
2affstart
SET ISO8859-1
FOL <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
LOW <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPP <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PFXPOSTPONE
MIDWORD '-
KEP =
RAR ?
BAD !
PFX I N 1
PFX I 0 in .
PFX O Y 1
PFX O 0 out [a-z]
SFX S Y 2
SFX S 0 s [^s]
SFX S 0 es s
SFX N N 3
SFX N 0 en [^n]
SFX N 0 nen n
SFX N 0 n .
REP 3
REP g ch
REP ch g
REP svp s.v.p.
MAP 9
MAP a<><61><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
MAP e<><65><EFBFBD><EFBFBD>
MAP i<><69><EFBFBD><EFBFBD>
MAP o<><6F><EFBFBD><EFBFBD><EFBFBD>
MAP u<><75><EFBFBD><EFBFBD>
MAP n<>
MAP c<>
MAP y<><79>
MAP s<>
2affend
2good: puts
bad: inputs comment ok Ok end the. test d<><64>l
badend
addstart
/regions=usgbnz
elequint/2
elekwint/3
addend
test2:
elequint test elekwint test elekwent asdf
Test rules for compounding.
3affstart
SET ISO8859-1
COMPOUNDMIN 3
COMPOUNDRULE m*
NEEDCOMPOUND x
3affend
3dicstart
1234
foo/m
bar/mx
m<EFBFBD>/m
la/mx
3dicend
3good: foo m<> foobar foofoobar barfoo barbarfoo
bad: bar la foom<6F> barm<72> m<>foo m<>bar m<>m<EFBFBD> lala m<>la lam<61> foola labar
badend
Tests for compounding.
4affstart
SET ISO8859-1
FOL <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
LOW <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPP <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
COMPOUNDRULE m+
COMPOUNDRULE sm*e
COMPOUNDRULE sm+
COMPOUNDMIN 3
COMPOUNDWORDMAX 3
COMPOUNDFORBIDFLAG t
COMPOUNDSYLMAX 5
SYLLABLE a<>e<EFBFBD>i<EFBFBD>o<EFBFBD><6F><EFBFBD>u<EFBFBD><75><EFBFBD>y/aa/au/ea/ee/ei/ie/oa/oe/oo/ou/uu/ui
MAP 9
MAP a<><61><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
MAP e<><65><EFBFBD><EFBFBD>
MAP i<><69><EFBFBD><EFBFBD>
MAP o<><6F><EFBFBD><EFBFBD><EFBFBD>
MAP u<><75><EFBFBD><EFBFBD>
MAP n<>
MAP c<>
MAP y<><79>
MAP s<>
NEEDAFFIX x
PFXPOSTPONE
MIDWORD '-
SFX q N 1
SFX q 0 -ok .
SFX a Y 2
SFX a 0 s .
SFX a 0 ize/t .
PFX p N 1
PFX p 0 pre .
PFX P N 1
PFX P 0 nou .
4affend
4dicstart
1234
word/mP
util/am
pro/xq
tomato/m
bork/mp
start/s
end/e
4dicend
4good: word util bork prebork start end wordutil wordutils pro-ok
bork borkbork borkborkbork borkborkborkbork borkborkborkborkbork
tomato tomatotomato startend startword startwordword startwordend
startwordwordend startwordwordwordend prebork preborkbork
preborkborkbork
nouword
bad: wordutilize pro borkborkborkborkborkbork tomatotomatotomato
endstart endend startstart wordend wordstart
preborkprebork preborkpreborkbork
startwordwordwordwordend borkpreborkpreborkbork
utilsbork startnouword
badend
Test affix flags with two characters
5affstart
SET ISO8859-1
FLAG long
NEEDAFFIX !!
COMPOUNDRULE ssmm*ee
NEEDCOMPOUND xx
COMPOUNDPERMITFLAG pp
SFX 13 Y 1
SFX 13 0 bork .
SFX a1 Y 1
SFX a1 0 a1 .
SFX a<> Y 1
SFX a<> 0 a<> .
PFX zz Y 1
PFX zz 0 pre/pp .
PFX yy Y 1
PFX yy 0 nou .
5affend
5dicstart
1234
foo/a1a<31>!!
bar/zz13ee
start/ss
end/eeyy
middle/mmxx
5dicend
5good: fooa1 fooa<6F> bar prebar barbork prebarbork startprebar
start end startend startmiddleend nouend
bad: foo fooa2 prabar probarbirk middle startmiddle middleend endstart
startprobar startnouend
badend
6affstart
SET ISO8859-1
FLAG caplong
NEEDAFFIX A!
COMPOUNDRULE sMm*Ee
NEEDCOMPOUND Xx
COMPOUNDPERMITFLAG p
SFX N3 Y 1
SFX N3 0 bork .
SFX A1 Y 1
SFX A1 0 a1 .
SFX A<> Y 1
SFX A<> 0 a<> .
PFX Zz Y 1
PFX Zz 0 pre/p .
6affend
6dicstart
1234
mee/A1A<31>A!
bar/ZzN3Ee
lead/s
end/Ee
middle/MmXx
6dicend
6good: meea1 meea<65> bar prebar barbork prebarbork leadprebar
lead end leadend leadmiddleend
bad: mee meea2 prabar probarbirk middle leadmiddle middleend endlead
leadprobar
badend
7affstart
SET ISO8859-1
FLAG num
NEEDAFFIX 9999
COMPOUNDRULE 2,77*123
NEEDCOMPOUND 1
COMPOUNDPERMITFLAG 432
SFX 61003 Y 1
SFX 61003 0 meat .
SFX 391 Y 1
SFX 391 0 a1 .
SFX 111 Y 1
SFX 111 0 a<> .
PFX 17 Y 1
PFX 17 0 pre/432 .
7affend
7dicstart
1234
mee/391,111,9999
bar/17,61003,123
lead/2
tail/123
middle/77,1
7dicend
7good: meea1 meea<65> bar prebar barmeat prebarmeat leadprebar
lead tail leadtail leadmiddletail
bad: mee meea2 prabar probarmaat middle leadmiddle middletail taillead
leadprobar
badend
Test NOSLITSUGS
8affstart
SET ISO8859-1
NOSPLITSUGS
8affend
8dicstart
1234
foo
bar
faabar
8dicend
8good: foo bar faabar
bad: foobar barfoo
badend
Test Numbers
9affstart
9affend
9dicstart
1234
foo
bar
9dicend
9good: 0b1011 0777 1234 0x01ff
badend
test output:

View File

@ -1,289 +0,0 @@
test output:
test 1-1
# file: Xtest.latin1.spl
Comment
deol
d<EFBFBD><EFBFBD>r
input
OK
output
outputs
outtest
put
puts
test
testen
testn
the end
uk
wrong
-------
bad
['put', 'uk', 'OK']
inputs
['input', 'puts', 'outputs']
comment
['Comment', 'outtest', 'the end']
ok
['OK', 'uk', 'put']
Ok
['OK', 'Uk', 'Put']
test
['Test', 'testn', 'testen']
d<EFBFBD><EFBFBD>l
['deol', 'd<><64>r', 'test']
end
['put', 'uk', 'test']
the
['put', 'uk', 'test']
gebletegek
kepereneven
everles gesvets etele
kbltykk
kprnfn
*fls kswts tl
elekwent
elequint
elekwint
elekwint
elekwent
elequint
elekwent
elequint
elekwint
test 2-1
# file: Xtest.latin1.spl
Comment
deol
d<EFBFBD><EFBFBD>r
OK
put
input
output
puts
outputs
test
outtest
testen
testn
the end
uk
wrong
-------
bad
['put', 'uk', 'OK']
inputs
['input', 'puts', 'outputs']
comment
['Comment']
ok
['OK', 'uk', 'put']
Ok
['OK', 'Uk', 'Put']
end
['put', 'uk', 'deol']
the
['put', 'uk', 'test']
test
['Test', 'testn', 'testen']
d<EFBFBD><EFBFBD>l
['deol', 'd<><64>r', 'test']
test 3-3
# file: Xtest.latin1.spl
foo
m<EFBFBD>
-------
bad
['foo', 'm<>']
bar
['barfoo', 'foobar', 'foo']
la
['m<>', 'foo']
foom<EFBFBD>
['foo m<>', 'foo', 'foofoo']
barm<EFBFBD>
['barfoo', 'm<>', 'barbar']
m<EFBFBD>foo
['m<> foo', 'foo', 'foofoo']
m<EFBFBD>bar
['foobar', 'barbar', 'm<>']
m<EFBFBD>m<EFBFBD>
['m<> m<>', 'm<>']
lala
[]
m<EFBFBD>la
['m<>', 'm<> m<>']
lam<EFBFBD>
['m<>', 'm<> m<>']
foola
['foo', 'foobar', 'foofoo']
labar
['barbar', 'foobar']
test 4-4
# file: Xtest.latin1.spl
bork
prebork
end
pro-ok
start
tomato
util
utilize
utils
word
nouword
-------
bad
['end', 'bork', 'word']
wordutilize
['word utilize', 'wordutils', 'wordutil']
pro
['bork', 'word', 'end']
borkborkborkborkborkbork
['bork borkborkborkborkbork', 'borkbork borkborkborkbork', 'borkborkbork borkborkbork']
tomatotomatotomato
['tomato tomatotomato', 'tomatotomato tomato', 'tomato tomato tomato']
endstart
['end start', 'start']
endend
['end end', 'end']
startstart
['start start']
wordend
['word end', 'word', 'wordword']
wordstart
['word start', 'bork start']
preborkprebork
['prebork prebork', 'preborkbork', 'preborkborkbork']
preborkpreborkbork
['prebork preborkbork', 'preborkborkbork', 'preborkborkborkbork']
startwordwordwordwordend
['startwordwordwordword end', 'startwordwordwordword', 'start wordwordwordword end']
borkpreborkpreborkbork
['bork preborkpreborkbork', 'bork prebork preborkbork', 'bork preborkprebork bork']
utilsbork
['utilbork', 'utils bork', 'util bork']
startnouword
['start nouword', 'startword', 'startborkword']
test 5-5
# file: Xtest.latin1.spl
bar
barbork
end
fooa1
fooa<EFBFBD>
nouend
prebar
prebarbork
start
-------
bad
['bar', 'end', 'fooa1']
foo
['fooa1', 'fooa<6F>', 'bar']
fooa2
['fooa1', 'fooa<6F>', 'bar']
prabar
['prebar', 'bar', 'bar bar']
probarbirk
['prebarbork']
middle
[]
startmiddle
['startmiddleend', 'startmiddlebar']
middleend
[]
endstart
['end start', 'start']
startprobar
['startprebar', 'start prebar', 'startbar']
startnouend
['start nouend', 'startend']
test 6-6
# file: Xtest.latin1.spl
bar
barbork
end
lead
meea1
meea<EFBFBD>
prebar
prebarbork
-------
bad
['bar', 'end', 'lead']
mee
['meea1', 'meea<65>', 'bar']
meea2
['meea1', 'meea<65>', 'lead']
prabar
['prebar', 'bar', 'leadbar']
probarbirk
['prebarbork']
middle
[]
leadmiddle
['leadmiddleend', 'leadmiddlebar']
middleend
[]
endlead
['end lead', 'lead', 'end end']
leadprobar
['leadprebar', 'lead prebar', 'leadbar']
test 7-7
# file: Xtest.latin1.spl
bar
barmeat
lead
meea1
meea<EFBFBD>
prebar
prebarmeat
tail
-------
bad
['bar', 'lead', 'tail']
mee
['meea1', 'meea<65>', 'bar']
meea2
['meea1', 'meea<65>', 'lead']
prabar
['prebar', 'bar', 'leadbar']
probarmaat
['prebarmeat']
middle
[]
leadmiddle
['leadmiddlebar']
middletail
[]
taillead
['tail lead', 'tail']
leadprobar
['leadprebar', 'lead prebar', 'leadbar']
test 8-8
# file: Xtest.latin1.spl
bar
faabar
foo
-------
bad
['bar', 'foo']
foobar
['faabar', 'foo bar', 'bar']
barfoo
['bar foo', 'bar', 'foo']
test 9-9
# file: Xtest.latin1.spl
bar
foo
-------

View File

@ -1835,6 +1835,73 @@ func Xproperty_tests(cchar)
call test_garbagecollect_now()
let m = g:Xgetlist({'context' : 1})
call assert_equal(["red", "blue", "green"], m.context)
" Test for setting/getting items
Xexpr ""
let qfprev = g:Xgetlist({'nr':0})
call g:Xsetlist([], ' ', {'title':'Green',
\ 'items' : [{'filename':'F1', 'lnum':10}]})
let qfcur = g:Xgetlist({'nr':0})
call assert_true(qfcur.nr == qfprev.nr + 1)
let l = g:Xgetlist({'items':1})
call assert_equal('F1', bufname(l.items[0].bufnr))
call assert_equal(10, l.items[0].lnum)
call g:Xsetlist([], 'a', {'items' : [{'filename':'F2', 'lnum':20},
\ {'filename':'F2', 'lnum':30}]})
let l = g:Xgetlist({'items':1})
call assert_equal('F2', bufname(l.items[2].bufnr))
call assert_equal(30, l.items[2].lnum)
call g:Xsetlist([], 'r', {'items' : [{'filename':'F3', 'lnum':40}]})
let l = g:Xgetlist({'items':1})
call assert_equal('F3', bufname(l.items[0].bufnr))
call assert_equal(40, l.items[0].lnum)
call g:Xsetlist([], 'r', {'items' : []})
let l = g:Xgetlist({'items':1})
call assert_equal(0, len(l.items))
" Save and restore the quickfix stack
call g:Xsetlist([], 'f')
call assert_equal(0, g:Xgetlist({'nr':'$'}).nr)
Xexpr "File1:10:Line1"
Xexpr "File2:20:Line2"
Xexpr "File3:30:Line3"
let last_qf = g:Xgetlist({'nr':'$'}).nr
call assert_equal(3, last_qf)
let qstack = []
for i in range(1, last_qf)
let qstack = add(qstack, g:Xgetlist({'nr':i, 'all':1}))
endfor
call g:Xsetlist([], 'f')
for i in range(len(qstack))
call g:Xsetlist([], ' ', qstack[i])
endfor
call assert_equal(3, g:Xgetlist({'nr':'$'}).nr)
call assert_equal(10, g:Xgetlist({'nr':1, 'items':1}).items[0].lnum)
call assert_equal(20, g:Xgetlist({'nr':2, 'items':1}).items[0].lnum)
call assert_equal(30, g:Xgetlist({'nr':3, 'items':1}).items[0].lnum)
call g:Xsetlist([], 'f')
" Swap two quickfix lists
Xexpr "File1:10:Line10"
Xexpr "File2:20:Line20"
Xexpr "File3:30:Line30"
call g:Xsetlist([], 'r', {'nr':1,'title':'Colors','context':['Colors']})
call g:Xsetlist([], 'r', {'nr':2,'title':'Fruits','context':['Fruits']})
let l1=g:Xgetlist({'nr':1,'all':1})
let l2=g:Xgetlist({'nr':2,'all':1})
let l1.nr=2
let l2.nr=1
call g:Xsetlist([], 'r', l1)
call g:Xsetlist([], 'r', l2)
let newl1=g:Xgetlist({'nr':1,'all':1})
let newl2=g:Xgetlist({'nr':2,'all':1})
call assert_equal(':Fruits', newl1.title)
call assert_equal(['Fruits'], newl1.context)
call assert_equal('Line20', newl1.items[0].text)
call assert_equal(':Colors', newl2.title)
call assert_equal(['Colors'], newl2.context)
call assert_equal('Line10', newl2.items[0].text)
call g:Xsetlist([], 'f')
endfunc
func Test_qf_property()

View File

@ -1,5 +1,4 @@
" Test spell checking
" TODO: move test58 tests here
if !has('spell')
finish
@ -33,7 +32,7 @@ func Test_spellreall()
set spell
call assert_fails('spellrepall', 'E752:')
call setline(1, ['A speling mistake. The same speling mistake.',
\ 'Another speling mistake.'])
\ 'Another speling mistake.'])
call feedkeys(']s1z=', 'tx')
call assert_equal('A spelling mistake. The same speling mistake.', getline(1))
call assert_equal('Another speling mistake.', getline(2))
@ -44,3 +43,726 @@ func Test_spellreall()
set spell&
bwipe!
endfunc
func Test_zz_basic()
call LoadAffAndDic(g:test_data_aff1, g:test_data_dic1)
call RunGoodBad("wrong OK puts. Test the end",
\ "bad: inputs comment ok Ok. test d\xE9\xF4l end the",
\["Comment", "deol", "d\xE9\xF4r", "input", "OK", "output", "outputs", "outtest", "put", "puts",
\ "test", "testen", "testn", "the end", "uk", "wrong"],
\[
\ ["bad", ["put", "uk", "OK"]],
\ ["inputs", ["input", "puts", "outputs"]],
\ ["comment", ["Comment", "outtest", "the end"]],
\ ["ok", ["OK", "uk", "put"]],
\ ["Ok", ["OK", "Uk", "Put"]],
\ ["test", ["Test", "testn", "testen"]],
\ ["d\xE9\xF4l", ["deol", "d\xE9\xF4r", "test"]],
\ ["end", ["put", "uk", "test"]],
\ ["the", ["put", "uk", "test"]],
\ ]
\ )
call assert_equal("gebletegek", soundfold('goobledygoook'))
call assert_equal("kepereneven", soundfold('k<>op<6F>r<EFBFBD>n<EFBFBD>ven'))
call assert_equal("everles gesvets etele", soundfold('oeverloos gezwets edale'))
endfunc
" Postponed prefixes
func Test_zz_prefixes()
call LoadAffAndDic(g:test_data_aff2, g:test_data_dic1)
call RunGoodBad("puts",
\ "bad: inputs comment ok Ok end the. test d\xE9\xF4l",
\ ["Comment", "deol", "d\xE9\xF4r", "OK", "put", "input", "output", "puts", "outputs", "test", "outtest", "testen", "testn", "the end", "uk", "wrong"],
\ [
\ ["bad", ["put", "uk", "OK"]],
\ ["inputs", ["input", "puts", "outputs"]],
\ ["comment", ["Comment"]],
\ ["ok", ["OK", "uk", "put"]],
\ ["Ok", ["OK", "Uk", "Put"]],
\ ["end", ["put", "uk", "deol"]],
\ ["the", ["put", "uk", "test"]],
\ ["test", ["Test", "testn", "testen"]],
\ ["d\xE9\xF4l", ["deol", "d\xE9\xF4r", "test"]],
\ ])
endfunc
"Compound words
func Test_zz_compound()
call LoadAffAndDic(g:test_data_aff3, g:test_data_dic3)
call RunGoodBad("foo m\xEF foobar foofoobar barfoo barbarfoo",
\ "bad: bar la foom\xEF barm\xEF m\xEFfoo m\xEFbar m\xEFm\xEF lala m\xEFla lam\xEF foola labar",
\ ["foo", "m\xEF"],
\ [
\ ["bad", ["foo", "m\xEF"]],
\ ["bar", ["barfoo", "foobar", "foo"]],
\ ["la", ["m\xEF", "foo"]],
\ ["foom\xEF", ["foo m\xEF", "foo", "foofoo"]],
\ ["barm\xEF", ["barfoo", "m\xEF", "barbar"]],
\ ["m\xEFfoo", ["m\xEF foo", "foo", "foofoo"]],
\ ["m\xEFbar", ["foobar", "barbar", "m\xEF"]],
\ ["m\xEFm\xEF", ["m\xEF m\xEF", "m\xEF"]],
\ ["lala", []],
\ ["m\xEFla", ["m\xEF", "m\xEF m\xEF"]],
\ ["lam\xEF", ["m\xEF", "m\xEF m\xEF"]],
\ ["foola", ["foo", "foobar", "foofoo"]],
\ ["labar", ["barbar", "foobar"]],
\ ])
call LoadAffAndDic(g:test_data_aff4, g:test_data_dic4)
call RunGoodBad("word util bork prebork start end wordutil wordutils pro-ok bork borkbork borkborkbork borkborkborkbork borkborkborkborkbork tomato tomatotomato startend startword startwordword startwordend startwordwordend startwordwordwordend prebork preborkbork preborkborkbork nouword",
\ "bad: wordutilize pro borkborkborkborkborkbork tomatotomatotomato endstart endend startstart wordend wordstart preborkprebork preborkpreborkbork startwordwordwordwordend borkpreborkpreborkbork utilsbork startnouword",
\ ["bork", "prebork", "end", "pro-ok", "start", "tomato", "util", "utilize", "utils", "word", "nouword"],
\ [
\ ["bad", ["end", "bork", "word"]],
\ ["wordutilize", ["word utilize", "wordutils", "wordutil"]],
\ ["pro", ["bork", "word", "end"]],
\ ["borkborkborkborkborkbork", ["bork borkborkborkborkbork", "borkbork borkborkborkbork", "borkborkbork borkborkbork"]],
\ ["tomatotomatotomato", ["tomato tomatotomato", "tomatotomato tomato", "tomato tomato tomato"]],
\ ["endstart", ["end start", "start"]],
\ ["endend", ["end end", "end"]],
\ ["startstart", ["start start"]],
\ ["wordend", ["word end", "word", "wordword"]],
\ ["wordstart", ["word start", "bork start"]],
\ ["preborkprebork", ["prebork prebork", "preborkbork", "preborkborkbork"]],
\ ["preborkpreborkbork", ["prebork preborkbork", "preborkborkbork", "preborkborkborkbork"]],
\ ["startwordwordwordwordend", ["startwordwordwordword end", "startwordwordwordword", "start wordwordwordword end"]],
\ ["borkpreborkpreborkbork", ["bork preborkpreborkbork", "bork prebork preborkbork", "bork preborkprebork bork"]],
\ ["utilsbork", ["utilbork", "utils bork", "util bork"]],
\ ["startnouword", ["start nouword", "startword", "startborkword"]],
\ ])
endfunc
"Test affix flags with two characters
func Test_zz_affix()
call LoadAffAndDic(g:test_data_aff5, g:test_data_dic5)
call RunGoodBad("fooa1 fooa\xE9 bar prebar barbork prebarbork startprebar start end startend startmiddleend nouend",
\ "bad: foo fooa2 prabar probarbirk middle startmiddle middleend endstart startprobar startnouend",
\ ["bar", "barbork", "end", "fooa1", "fooa\xE9", "nouend", "prebar", "prebarbork", "start"],
\ [
\ ["bad", ["bar", "end", "fooa1"]],
\ ["foo", ["fooa1", "fooa\xE9", "bar"]],
\ ["fooa2", ["fooa1", "fooa\xE9", "bar"]],
\ ["prabar", ["prebar", "bar", "bar bar"]],
\ ["probarbirk", ["prebarbork"]],
\ ["middle", []],
\ ["startmiddle", ["startmiddleend", "startmiddlebar"]],
\ ["middleend", []],
\ ["endstart", ["end start", "start"]],
\ ["startprobar", ["startprebar", "start prebar", "startbar"]],
\ ["startnouend", ["start nouend", "startend"]],
\ ])
call LoadAffAndDic(g:test_data_aff6, g:test_data_dic6)
call RunGoodBad("meea1 meea\xE9 bar prebar barbork prebarbork leadprebar lead end leadend leadmiddleend",
\ "bad: mee meea2 prabar probarbirk middle leadmiddle middleend endlead leadprobar",
\ ["bar", "barbork", "end", "lead", "meea1", "meea\xE9", "prebar", "prebarbork"],
\ [
\ ["bad", ["bar", "end", "lead"]],
\ ["mee", ["meea1", "meea\xE9", "bar"]],
\ ["meea2", ["meea1", "meea\xE9", "lead"]],
\ ["prabar", ["prebar", "bar", "leadbar"]],
\ ["probarbirk", ["prebarbork"]],
\ ["middle", []],
\ ["leadmiddle", ["leadmiddleend", "leadmiddlebar"]],
\ ["middleend", []],
\ ["endlead", ["end lead", "lead", "end end"]],
\ ["leadprobar", ["leadprebar", "lead prebar", "leadbar"]],
\ ])
call LoadAffAndDic(g:test_data_aff7, g:test_data_dic7)
call RunGoodBad("meea1 meea\xE9 bar prebar barmeat prebarmeat leadprebar lead tail leadtail leadmiddletail",
\ "bad: mee meea2 prabar probarmaat middle leadmiddle middletail taillead leadprobar",
\ ["bar", "barmeat", "lead", "meea1", "meea\xE9", "prebar", "prebarmeat", "tail"],
\ [
\ ["bad", ["bar", "lead", "tail"]],
\ ["mee", ["meea1", "meea\xE9", "bar"]],
\ ["meea2", ["meea1", "meea\xE9", "lead"]],
\ ["prabar", ["prebar", "bar", "leadbar"]],
\ ["probarmaat", ["prebarmeat"]],
\ ["middle", []],
\ ["leadmiddle", ["leadmiddlebar"]],
\ ["middletail", []],
\ ["taillead", ["tail lead", "tail"]],
\ ["leadprobar", ["leadprebar", "lead prebar", "leadbar"]],
\ ])
endfunc
func Test_zz_NOSLITSUGS()
call LoadAffAndDic(g:test_data_aff8, g:test_data_dic8)
call RunGoodBad("foo bar faabar", "bad: foobar barfoo",
\ ["bar", "faabar", "foo"],
\ [
\ ["bad", ["bar", "foo"]],
\ ["foobar", ["faabar", "foo bar", "bar"]],
\ ["barfoo", ["bar foo", "bar", "foo"]],
\ ])
endfunc
" Numbers
func Test_zz_Numbers()
call LoadAffAndDic(g:test_data_aff9, g:test_data_dic9)
call RunGoodBad("0b1011 0777 1234 0x01ff", "",
\ ["bar", "foo"],
\ [
\ ])
endfunc
function FirstSpellWord()
call feedkeys("/^start:\n", 'tx')
normal ]smm
let [str, a] = spellbadword()
return str
endfunc
function SecondSpellWord()
normal `m]s
let [str, a] = spellbadword()
return str
endfunc
"Test with SAL instead of SOFO items; test automatic reloading
func Test_zz_sal_and_addition()
set enc=latin1
set spellfile=
call writefile(g:test_data_aff_sal, "Xtest.aff")
mkspell! Xtest Xtest
set spl=Xtest.latin1.spl spell
call assert_equal('kbltykk', soundfold('goobledygoook'))
call assert_equal('kprnfn', soundfold('k<>op<6F>r<EFBFBD>n<EFBFBD>ven'))
call assert_equal('*fls kswts tl', soundfold('oeverloos gezwets edale'))
"also use an addition file
call writefile(["/regions=usgbnz", "elequint/2", "elekwint/3"], "Xtest.latin1.add")
mkspell! Xtest.latin1.add.spl Xtest.latin1.add
bwipe!
call setline(1, ["start: elequint test elekwint test elekwent asdf"])
set spellfile=Xtest.latin1.add
call assert_equal("elekwent", FirstSpellWord())
set spl=Xtest_us.latin1.spl
call assert_equal("elequint", FirstSpellWord())
call assert_equal("elekwint", SecondSpellWord())
set spl=Xtest_gb.latin1.spl
call assert_equal("elekwint", FirstSpellWord())
call assert_equal("elekwent", SecondSpellWord())
set spl=Xtest_nz.latin1.spl
call assert_equal("elequint", FirstSpellWord())
call assert_equal("elekwent", SecondSpellWord())
set spl=Xtest_ca.latin1.spl
call assert_equal("elequint", FirstSpellWord())
call assert_equal("elekwint", SecondSpellWord())
endfunc
" Check using z= in new buffer (crash fixed by patch 7.4a.028).
func Test_zeq_crash()
new
set maxmem=512 spell
call feedkeys('iasdz=:\"', 'tx')
bwipe!
endfunc
func LoadAffAndDic(aff_contents, dic_contents)
set enc=latin1
set spellfile=
call writefile(a:aff_contents, "Xtest.aff")
call writefile(a:dic_contents, "Xtest.dic")
" Generate a .spl file from a .dic and .aff file.
mkspell! Xtest Xtest
" use that spell file
set spl=Xtest.latin1.spl spell
endfunc
func ListWords()
spelldump
%yank
quit
return split(@", "\n")
endfunc
func TestGoodBadBase()
exe '1;/^good:'
normal 0f:]s
let prevbad = ''
let result = []
while 1
let [bad, a] = spellbadword()
if bad == '' || bad == prevbad || bad == 'badend'
break
endif
let prevbad = bad
let lst = spellsuggest(bad, 3)
normal mm
call add(result, [bad, lst])
normal `m]s
endwhile
return result
endfunc
func RunGoodBad(good, bad, expected_words, expected_bad_words)
bwipe!
call setline(1, ["good: ", a:good, a:bad, " badend "])
let words = ListWords()
call assert_equal(a:expected_words, words[1:-1])
let bad_words = TestGoodBadBase()
call assert_equal(a:expected_bad_words, bad_words)
bwipe!
endfunc
let g:test_data_aff1 = [
\"SET ISO8859-1",
\"TRY esianrtolcdugmphbyfvkwjkqxz-\xEB\xE9\xE8\xEA\xEF\xEE\xE4\xE0\xE2\xF6\xFC\xFB'ESIANRTOLCDUGMPHBYFVKWJKQXZ",
\"",
\"FOL \xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xDF\xFF",
\"LOW \xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xDF\xFF",
\"UPP \xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xFF",
\"",
\"SOFOFROM abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xDF\xFF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xBF",
\"SOFOTO ebctefghejklnnepkrstevvkesebctefghejklnnepkrstevvkeseeeeeeeceeeeeeeedneeeeeeeeeeepseeeeeeeeceeeeeeeedneeeeeeeeeeep?",
\"",
\"MIDWORD\t'-",
\"",
\"KEP =",
\"RAR ?",
\"BAD !",
\"",
\"PFX I N 1",
\"PFX I 0 in .",
\"",
\"PFX O Y 1",
\"PFX O 0 out .",
\"",
\"SFX S Y 2",
\"SFX S 0 s [^s]",
\"SFX S 0 es s",
\"",
\"SFX N N 3",
\"SFX N 0 en [^n]",
\"SFX N 0 nen n",
\"SFX N 0 n .",
\"",
\"REP 3",
\"REP g ch",
\"REP ch g",
\"REP svp s.v.p.",
\"",
\"MAP 9",
\"MAP a\xE0\xE1\xE2\xE3\xE4\xE5",
\"MAP e\xE8\xE9\xEA\xEB",
\"MAP i\xEC\xED\xEE\xEF",
\"MAP o\xF2\xF3\xF4\xF5\xF6",
\"MAP u\xF9\xFA\xFB\xFC",
\"MAP n\xF1",
\"MAP c\xE7",
\"MAP y\xFF\xFD",
\"MAP s\xDF",
\ ]
let g:test_data_dic1 = [
\"123456",
\"test/NO",
\"# comment",
\"wrong",
\"Comment",
\"OK",
\"uk",
\"put/ISO",
\"the end",
\"deol",
\"d\xE9\xF4r",
\ ]
let g:test_data_aff2 = [
\"SET ISO8859-1",
\"",
\"FOL \xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xDF\xFF",
\"LOW \xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xDF\xFF",
\"UPP \xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xFF",
\"",
\"PFXPOSTPONE",
\"",
\"MIDWORD\t'-",
\"",
\"KEP =",
\"RAR ?",
\"BAD !",
\"",
\"PFX I N 1",
\"PFX I 0 in .",
\"",
\"PFX O Y 1",
\"PFX O 0 out [a-z]",
\"",
\"SFX S Y 2",
\"SFX S 0 s [^s]",
\"SFX S 0 es s",
\"",
\"SFX N N 3",
\"SFX N 0 en [^n]",
\"SFX N 0 nen n",
\"SFX N 0 n .",
\"",
\"REP 3",
\"REP g ch",
\"REP ch g",
\"REP svp s.v.p.",
\"",
\"MAP 9",
\"MAP a\xE0\xE1\xE2\xE3\xE4\xE5",
\"MAP e\xE8\xE9\xEA\xEB",
\"MAP i\xEC\xED\xEE\xEF",
\"MAP o\xF2\xF3\xF4\xF5\xF6",
\"MAP u\xF9\xFA\xFB\xFC",
\"MAP n\xF1",
\"MAP c\xE7",
\"MAP y\xFF\xFD",
\"MAP s\xDF",
\ ]
let g:test_data_aff3 = [
\"SET ISO8859-1",
\"",
\"COMPOUNDMIN 3",
\"COMPOUNDRULE m*",
\"NEEDCOMPOUND x",
\ ]
let g:test_data_dic3 = [
\"1234",
\"foo/m",
\"bar/mx",
\"m\xEF/m",
\"la/mx",
\ ]
let g:test_data_aff4 = [
\"SET ISO8859-1",
\"",
\"FOL \xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xDF\xFF",
\"LOW \xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xDF\xFF",
\"UPP \xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xFF",
\"",
\"COMPOUNDRULE m+",
\"COMPOUNDRULE sm*e",
\"COMPOUNDRULE sm+",
\"COMPOUNDMIN 3",
\"COMPOUNDWORDMAX 3",
\"COMPOUNDFORBIDFLAG t",
\"",
\"COMPOUNDSYLMAX 5",
\"SYLLABLE a\xE1e\xE9i\xEDo\xF3\xF6\xF5u\xFA\xFC\xFBy/aa/au/ea/ee/ei/ie/oa/oe/oo/ou/uu/ui",
\"",
\"MAP 9",
\"MAP a\xE0\xE1\xE2\xE3\xE4\xE5",
\"MAP e\xE8\xE9\xEA\xEB",
\"MAP i\xEC\xED\xEE\xEF",
\"MAP o\xF2\xF3\xF4\xF5\xF6",
\"MAP u\xF9\xFA\xFB\xFC",
\"MAP n\xF1",
\"MAP c\xE7",
\"MAP y\xFF\xFD",
\"MAP s\xDF",
\"",
\"NEEDAFFIX x",
\"",
\"PFXPOSTPONE",
\"",
\"MIDWORD '-",
\"",
\"SFX q N 1",
\"SFX q 0 -ok .",
\"",
\"SFX a Y 2",
\"SFX a 0 s .",
\"SFX a 0 ize/t .",
\"",
\"PFX p N 1",
\"PFX p 0 pre .",
\"",
\"PFX P N 1",
\"PFX P 0 nou .",
\ ]
let g:test_data_dic4 = [
\"1234",
\"word/mP",
\"util/am",
\"pro/xq",
\"tomato/m",
\"bork/mp",
\"start/s",
\"end/e",
\ ]
let g:test_data_aff5 = [
\"SET ISO8859-1",
\"",
\"FLAG long",
\"",
\"NEEDAFFIX !!",
\"",
\"COMPOUNDRULE ssmm*ee",
\"",
\"NEEDCOMPOUND xx",
\"COMPOUNDPERMITFLAG pp",
\"",
\"SFX 13 Y 1",
\"SFX 13 0 bork .",
\"",
\"SFX a1 Y 1",
\"SFX a1 0 a1 .",
\"",
\"SFX a\xE9 Y 1",
\"SFX a\xE9 0 a\xE9 .",
\"",
\"PFX zz Y 1",
\"PFX zz 0 pre/pp .",
\"",
\"PFX yy Y 1",
\"PFX yy 0 nou .",
\ ]
let g:test_data_dic5 = [
\"1234",
\"foo/a1a\xE9!!",
\"bar/zz13ee",
\"start/ss",
\"end/eeyy",
\"middle/mmxx",
\ ]
let g:test_data_aff6 = [
\"SET ISO8859-1",
\"",
\"FLAG caplong",
\"",
\"NEEDAFFIX A!",
\"",
\"COMPOUNDRULE sMm*Ee",
\"",
\"NEEDCOMPOUND Xx",
\"",
\"COMPOUNDPERMITFLAG p",
\"",
\"SFX N3 Y 1",
\"SFX N3 0 bork .",
\"",
\"SFX A1 Y 1",
\"SFX A1 0 a1 .",
\"",
\"SFX A\xE9 Y 1",
\"SFX A\xE9 0 a\xE9 .",
\"",
\"PFX Zz Y 1",
\"PFX Zz 0 pre/p .",
\ ]
let g:test_data_dic6 = [
\"1234",
\"mee/A1A\xE9A!",
\"bar/ZzN3Ee",
\"lead/s",
\"end/Ee",
\"middle/MmXx",
\ ]
let g:test_data_aff7 = [
\"SET ISO8859-1",
\"",
\"FLAG num",
\"",
\"NEEDAFFIX 9999",
\"",
\"COMPOUNDRULE 2,77*123",
\"",
\"NEEDCOMPOUND 1",
\"COMPOUNDPERMITFLAG 432",
\"",
\"SFX 61003 Y 1",
\"SFX 61003 0 meat .",
\"",
\"SFX 391 Y 1",
\"SFX 391 0 a1 .",
\"",
\"SFX 111 Y 1",
\"SFX 111 0 a\xE9 .",
\"",
\"PFX 17 Y 1",
\"PFX 17 0 pre/432 .",
\ ]
let g:test_data_dic7 = [
\"1234",
\"mee/391,111,9999",
\"bar/17,61003,123",
\"lead/2",
\"tail/123",
\"middle/77,1",
\ ]
let g:test_data_aff8 = [
\"SET ISO8859-1",
\"",
\"NOSPLITSUGS",
\ ]
let g:test_data_dic8 = [
\"1234",
\"foo",
\"bar",
\"faabar",
\ ]
let g:test_data_aff9 = [
\ ]
let g:test_data_dic9 = [
\"1234",
\"foo",
\"bar",
\ ]
let g:test_data_aff_sal = [
\"SET ISO8859-1",
\"TRY esianrtolcdugmphbyfvkwjkqxz-\xEB\xE9\xE8\xEA\xEF\xEE\xE4\xE0\xE2\xF6\xFC\xFB'ESIANRTOLCDUGMPHBYFVKWJKQXZ",
\"",
\"FOL \xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xDF\xFF",
\"LOW \xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xDF\xFF",
\"UPP \xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xFF",
\"",
\"MIDWORD\t'-",
\"",
\"KEP =",
\"RAR ?",
\"BAD !",
\"",
\"PFX I N 1",
\"PFX I 0 in .",
\"",
\"PFX O Y 1",
\"PFX O 0 out .",
\"",
\"SFX S Y 2",
\"SFX S 0 s [^s]",
\"SFX S 0 es s",
\"",
\"SFX N N 3",
\"SFX N 0 en [^n]",
\"SFX N 0 nen n",
\"SFX N 0 n .",
\"",
\"REP 3",
\"REP g ch",
\"REP ch g",
\"REP svp s.v.p.",
\"",
\"MAP 9",
\"MAP a\xE0\xE1\xE2\xE3\xE4\xE5",
\"MAP e\xE8\xE9\xEA\xEB",
\"MAP i\xEC\xED\xEE\xEF",
\"MAP o\xF2\xF3\xF4\xF5\xF6",
\"MAP u\xF9\xFA\xFB\xFC",
\"MAP n\xF1",
\"MAP c\xE7",
\"MAP y\xFF\xFD",
\"MAP s\xDF",
\"",
\"SAL AH(AEIOUY)-^ *H",
\"SAL AR(AEIOUY)-^ *R",
\"SAL A(HR)^ *",
\"SAL A^ *",
\"SAL AH(AEIOUY)- H",
\"SAL AR(AEIOUY)- R",
\"SAL A(HR) _",
\"SAL \xC0^ *",
\"SAL \xC5^ *",
\"SAL BB- _",
\"SAL B B",
\"SAL CQ- _",
\"SAL CIA X",
\"SAL CH X",
\"SAL C(EIY)- S",
\"SAL CK K",
\"SAL COUGH^ KF",
\"SAL CC< C",
\"SAL C K",
\"SAL DG(EIY) K",
\"SAL DD- _",
\"SAL D T",
\"SAL \xC9< E",
\"SAL EH(AEIOUY)-^ *H",
\"SAL ER(AEIOUY)-^ *R",
\"SAL E(HR)^ *",
\"SAL ENOUGH^$ *NF",
\"SAL E^ *",
\"SAL EH(AEIOUY)- H",
\"SAL ER(AEIOUY)- R",
\"SAL E(HR) _",
\"SAL FF- _",
\"SAL F F",
\"SAL GN^ N",
\"SAL GN$ N",
\"SAL GNS$ NS",
\"SAL GNED$ N",
\"SAL GH(AEIOUY)- K",
\"SAL GH _",
\"SAL GG9 K",
\"SAL G K",
\"SAL H H",
\"SAL IH(AEIOUY)-^ *H",
\"SAL IR(AEIOUY)-^ *R",
\"SAL I(HR)^ *",
\"SAL I^ *",
\"SAL ING6 N",
\"SAL IH(AEIOUY)- H",
\"SAL IR(AEIOUY)- R",
\"SAL I(HR) _",
\"SAL J K",
\"SAL KN^ N",
\"SAL KK- _",
\"SAL K K",
\"SAL LAUGH^ LF",
\"SAL LL- _",
\"SAL L L",
\"SAL MB$ M",
\"SAL MM M",
\"SAL M M",
\"SAL NN- _",
\"SAL N N",
\"SAL OH(AEIOUY)-^ *H",
\"SAL OR(AEIOUY)-^ *R",
\"SAL O(HR)^ *",
\"SAL O^ *",
\"SAL OH(AEIOUY)- H",
\"SAL OR(AEIOUY)- R",
\"SAL O(HR) _",
\"SAL PH F",
\"SAL PN^ N",
\"SAL PP- _",
\"SAL P P",
\"SAL Q K",
\"SAL RH^ R",
\"SAL ROUGH^ RF",
\"SAL RR- _",
\"SAL R R",
\"SAL SCH(EOU)- SK",
\"SAL SC(IEY)- S",
\"SAL SH X",
\"SAL SI(AO)- X",
\"SAL SS- _",
\"SAL S S",
\"SAL TI(AO)- X",
\"SAL TH @",
\"SAL TCH-- _",
\"SAL TOUGH^ TF",
\"SAL TT- _",
\"SAL T T",
\"SAL UH(AEIOUY)-^ *H",
\"SAL UR(AEIOUY)-^ *R",
\"SAL U(HR)^ *",
\"SAL U^ *",
\"SAL UH(AEIOUY)- H",
\"SAL UR(AEIOUY)- R",
\"SAL U(HR) _",
\"SAL V^ W",
\"SAL V F",
\"SAL WR^ R",
\"SAL WH^ W",
\"SAL W(AEIOU)- W",
\"SAL X^ S",
\"SAL X KS",
\"SAL Y(AEIOU)- Y",
\"SAL ZZ- _",
\"SAL Z S",
\ ]

View File

@ -4,6 +4,8 @@ if !has("syntax")
finish
endif
source view_util.vim
func GetSyntaxItem(pat)
let c = ''
let a = ['a', getreg('a'), getregtype('a')]
@ -458,3 +460,40 @@ func Test_syntax_hangs()
set redrawtime&
bwipe!
endfunc
func Test_conceal()
if !has('conceal')
return
endif
new
call setline(1, ['', '123456'])
syn match test23 "23" conceal cchar=X
syn match test45 "45" conceal
set conceallevel=0
call assert_equal('123456 ', ScreenLines(2, 7)[0])
call assert_equal([[0, ''], [0, ''], [0, ''], [0, ''], [0, ''], [0, '']], map(range(1, 6), 'synconcealed(2, v:val)[0:1]'))
set conceallevel=1
call assert_equal('1X 6 ', ScreenLines(2, 7)[0])
call assert_equal([[0, ''], [1, 'X'], [1, 'X'], [1, ' '], [1, ' '], [0, '']], map(range(1, 6), 'synconcealed(2, v:val)[0:1]'))
set conceallevel=1
set listchars=conceal:Y
call assert_equal([[0, ''], [1, 'X'], [1, 'X'], [1, 'Y'], [1, 'Y'], [0, '']], map(range(1, 6), 'synconcealed(2, v:val)[0:1]'))
call assert_equal('1XY6 ', ScreenLines(2, 7)[0])
set conceallevel=2
call assert_match('1X6 ', ScreenLines(2, 7)[0])
call assert_equal([[0, ''], [1, 'X'], [1, 'X'], [1, ''], [1, ''], [0, '']], map(range(1, 6), 'synconcealed(2, v:val)[0:1]'))
set conceallevel=3
call assert_match('16 ', ScreenLines(2, 7)[0])
call assert_equal([[0, ''], [1, ''], [1, ''], [1, ''], [1, ''], [0, '']], map(range(1, 6), 'synconcealed(2, v:val)[0:1]'))
syn clear
set conceallevel&
bw!
endfunc

View File

@ -1381,10 +1381,12 @@ func Test_endfunction_trailing()
set verbose=1
exe "func Xtest()\necho 'hello'\nendfunc \" garbage"
call assert_notmatch('W22:', split(execute('1messages'), "\n")[0])
call assert_true(exists('*Xtest'))
delfunc Xtest
call assert_fails("func Xtest()\necho 'hello'\nendfunc garbage", 'E946')
exe "func Xtest()\necho 'hello'\nendfunc garbage"
call assert_match('W22:', split(execute('1messages'), "\n")[0])
call assert_true(exists('*Xtest'))
delfunc Xtest
set verbose=0
@ -1400,6 +1402,15 @@ func Test_delfunction_force()
delfunc! Xtest
endfunc
" Test using bang after user command {{{1
func Test_user_command_with_bang()
command -bang Nieuw let nieuw = 1
Ni!
call assert_equal(1, nieuw)
unlet nieuw
delcommand Nieuw
endfunc
"-------------------------------------------------------------------------------
" Modelines {{{1
" vim: ts=8 sw=4 tw=80 fdm=marker

View File

@ -2137,7 +2137,9 @@ ex_function(exarg_T *eap)
/* Another command follows. */
eap->nextcmd = line_arg;
else if (*p != NUL && *p != '"' && p_verbose > 0)
EMSG2((char_u *)_("E946: Text found after :endfunction: %s"), p);
give_warning2(
(char_u *)_("W22: Text found after :endfunction: %s"),
p, TRUE);
if (line_arg == NULL)
vim_free(theline);
break;

View File

@ -764,6 +764,28 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
666,
/**/
665,
/**/
664,
/**/
663,
/**/
662,
/**/
661,
/**/
660,
/**/
659,
/**/
658,
/**/
657,
/**/
656,
/**/
655,
/**/