enable check
This commit is contained in:
parent
1248eb2f41
commit
2efed25d07
@ -71,7 +71,7 @@ index ec566da..32a5411 100644
|
||||
+
|
||||
+func Test_deep_recursion()
|
||||
+ " this was running out of stack
|
||||
+ call assert_fails("exe 'if ' .. repeat('(', 1002)", 'E1169: Expression too recursive: ((')+endfunc
|
||||
+ call assert_fails("exe 'if ' .. repeat('(', 1002)", 'E1169: Expression too recursive: ((')
|
||||
+endfunc
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
@ -45,10 +45,10 @@ index 24df68f..c682682 100644
|
||||
bwipe!
|
||||
+
|
||||
+ new somefile
|
||||
++ call setline(1, ['first line', '', '#define something 0'])
|
||||
++ sil norm 0o0
|
||||
++ sil! norm ]d
|
||||
++ bwipe!
|
||||
+ call setline(1, ['first line', '', '#define something 0'])
|
||||
+ sil norm 0o0
|
||||
+ sil! norm ]d
|
||||
+ bwipe!
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
@ -69,7 +69,7 @@ index c682682..18a7f9b 100644
|
||||
--- a/src/testdir/test_tagjump.vim
|
||||
+++ b/src/testdir/test_tagjump.vim
|
||||
@@ -571,4 +571,15 @@ func Test_define_search()
|
||||
+ bwipe!
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
+" this was using a line from ml_get() freed by the regexp
|
||||
|
||||
@ -0,0 +1,412 @@
|
||||
From 53989554a44caca0964376d60297f08ec257c53c Mon Sep 17 00:00:00 2001
|
||||
From: Bram Moolenaar <Bram@vim.org>
|
||||
Date: Mon, 23 Dec 2019 22:59:18 +0100
|
||||
Subject: [PATCH] patch 8.2.0035: saving and restoring called_emsg is clumsy
|
||||
|
||||
Problem: Saving and restoring called_emsg is clumsy.
|
||||
Solution: Count the number of error messages.
|
||||
---
|
||||
src/buffer.c | 12 ++++--------
|
||||
src/channel.c | 6 ++----
|
||||
src/drawscreen.c | 6 ++----
|
||||
src/ex_cmds2.c | 2 +-
|
||||
src/globals.h | 2 +-
|
||||
src/gui.c | 7 ++-----
|
||||
src/highlight.c | 8 ++------
|
||||
src/main.c | 2 +-
|
||||
src/message.c | 4 ++--
|
||||
src/regexp.c | 9 ++++-----
|
||||
src/search.c | 18 +++++++-----------
|
||||
src/testing.c | 5 ++---
|
||||
12 files changed, 30 insertions(+), 51 deletions(-)
|
||||
|
||||
diff --git a/src/buffer.c b/src/buffer.c
|
||||
index f66c234..fd15424 100644
|
||||
--- a/src/buffer.c
|
||||
+++ b/src/buffer.c
|
||||
@@ -3761,19 +3761,17 @@ maketitle(void)
|
||||
if (stl_syntax & STL_IN_TITLE)
|
||||
{
|
||||
int use_sandbox = FALSE;
|
||||
- int save_called_emsg = called_emsg;
|
||||
+ int called_emsg_before = called_emsg;
|
||||
|
||||
# ifdef FEAT_EVAL
|
||||
use_sandbox = was_set_insecurely((char_u *)"titlestring", 0);
|
||||
# endif
|
||||
- called_emsg = FALSE;
|
||||
build_stl_str_hl(curwin, title_str, sizeof(buf),
|
||||
p_titlestring, use_sandbox,
|
||||
0, maxlen, NULL, NULL);
|
||||
- if (called_emsg)
|
||||
+ if (called_emsg > called_emsg_before)
|
||||
set_string_option_direct((char_u *)"titlestring", -1,
|
||||
(char_u *)"", OPT_FREE, SID_ERROR);
|
||||
- called_emsg |= save_called_emsg;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@@ -3894,19 +3892,17 @@ maketitle(void)
|
||||
if (stl_syntax & STL_IN_ICON)
|
||||
{
|
||||
int use_sandbox = FALSE;
|
||||
- int save_called_emsg = called_emsg;
|
||||
+ int called_emsg_before = called_emsg;
|
||||
|
||||
# ifdef FEAT_EVAL
|
||||
use_sandbox = was_set_insecurely((char_u *)"iconstring", 0);
|
||||
# endif
|
||||
- called_emsg = FALSE;
|
||||
build_stl_str_hl(curwin, icon_str, sizeof(buf),
|
||||
p_iconstring, use_sandbox,
|
||||
0, 0, NULL, NULL);
|
||||
- if (called_emsg)
|
||||
+ if (called_emsg > called_emsg_before)
|
||||
set_string_option_direct((char_u *)"iconstring", -1,
|
||||
(char_u *)"", OPT_FREE, SID_ERROR);
|
||||
- called_emsg |= save_called_emsg;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
diff --git a/src/channel.c b/src/channel.c
|
||||
index 7edca1a..264c9f3 100644
|
||||
--- a/src/channel.c
|
||||
+++ b/src/channel.c
|
||||
@@ -2370,17 +2370,15 @@ channel_exe_cmd(channel_T *channel, ch_part_T part, typval_T *argv)
|
||||
|
||||
if (STRCMP(cmd, "ex") == 0)
|
||||
{
|
||||
- int save_called_emsg = called_emsg;
|
||||
+ int called_emsg_before = called_emsg;
|
||||
|
||||
- called_emsg = FALSE;
|
||||
ch_log(channel, "Executing ex command '%s'", (char *)arg);
|
||||
++emsg_silent;
|
||||
do_cmdline_cmd(arg);
|
||||
--emsg_silent;
|
||||
- if (called_emsg)
|
||||
+ if (called_emsg > called_emsg_before)
|
||||
ch_log(channel, "Ex command error: '%s'",
|
||||
(char *)get_vim_var_str(VV_ERRMSG));
|
||||
- called_emsg = save_called_emsg;
|
||||
}
|
||||
else if (STRCMP(cmd, "normal") == 0)
|
||||
{
|
||||
diff --git a/src/drawscreen.c b/src/drawscreen.c
|
||||
index 7425ad4..05cd5aa 100644
|
||||
--- a/src/drawscreen.c
|
||||
+++ b/src/drawscreen.c
|
||||
@@ -651,14 +651,12 @@ win_redr_ruler(win_T *wp, int always, int ignore_pum)
|
||||
#ifdef FEAT_STL_OPT
|
||||
if (*p_ruf)
|
||||
{
|
||||
- int save_called_emsg = called_emsg;
|
||||
+ int called_emsg_before = called_emsg;
|
||||
|
||||
- called_emsg = FALSE;
|
||||
win_redr_custom(wp, TRUE);
|
||||
- if (called_emsg)
|
||||
+ if (called_emsg > called_emsg_before)
|
||||
set_string_option_direct((char_u *)"rulerformat", -1,
|
||||
(char_u *)"", OPT_FREE, SID_ERROR);
|
||||
- called_emsg |= save_called_emsg;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
|
||||
index 9a31887..4f8f7fb 100644
|
||||
--- a/src/ex_cmds2.c
|
||||
+++ b/src/ex_cmds2.c
|
||||
@@ -167,7 +167,7 @@ check_due_timer(void)
|
||||
// the current scope, such as being inside a try/catch.
|
||||
timer_busy = timer_busy > 0 || vgetc_busy > 0;
|
||||
vgetc_busy = 0;
|
||||
- called_emsg = FALSE;
|
||||
+ called_emsg = 0;
|
||||
did_emsg = FALSE;
|
||||
did_uncaught_emsg = FALSE;
|
||||
must_redraw = 0;
|
||||
diff --git a/src/globals.h b/src/globals.h
|
||||
index 01ebbb8..5a040fc 100644
|
||||
--- a/src/globals.h
|
||||
+++ b/src/globals.h
|
||||
@@ -226,7 +226,7 @@ EXTERN int did_uncaught_emsg; // emsg() was called and did not
|
||||
#endif
|
||||
EXTERN int did_emsg_syntax; // did_emsg set because of a
|
||||
// syntax error
|
||||
-EXTERN int called_emsg; // always set by emsg()
|
||||
+EXTERN int called_emsg; // always incremented by emsg()
|
||||
EXTERN int ex_exitval INIT(= 0); // exit value for ex mode
|
||||
EXTERN int emsg_on_display INIT(= FALSE); // there is an error message
|
||||
EXTERN int rc_did_emsg INIT(= FALSE); // vim_regcomp() called emsg()
|
||||
diff --git a/src/gui.c b/src/gui.c
|
||||
index 0a7f346..0d49670 100644
|
||||
--- a/src/gui.c
|
||||
+++ b/src/gui.c
|
||||
@@ -3700,14 +3700,12 @@ get_tabline_label(
|
||||
if (**opt != NUL)
|
||||
{
|
||||
int use_sandbox = FALSE;
|
||||
- int save_called_emsg = called_emsg;
|
||||
+ int called_emsg_before = called_emsg;
|
||||
char_u res[MAXPATHL];
|
||||
tabpage_T *save_curtab;
|
||||
char_u *opt_name = (char_u *)(tooltip ? "guitabtooltip"
|
||||
: "guitablabel");
|
||||
|
||||
- called_emsg = FALSE;
|
||||
-
|
||||
printer_page_num = tabpage_index(tp);
|
||||
# ifdef FEAT_EVAL
|
||||
set_vim_var_nr(VV_LNUM, printer_page_num);
|
||||
@@ -3738,10 +3736,9 @@ get_tabline_label(
|
||||
curwin = curtab->tp_curwin;
|
||||
curbuf = curwin->w_buffer;
|
||||
|
||||
- if (called_emsg)
|
||||
+ if (called_emsg > called_emsg_before)
|
||||
set_string_option_direct(opt_name, -1,
|
||||
(char_u *)"", OPT_FREE, SID_ERROR);
|
||||
- called_emsg |= save_called_emsg;
|
||||
}
|
||||
|
||||
// If 'guitablabel'/'guitabtooltip' is not set or the result is empty then
|
||||
diff --git a/src/highlight.c b/src/highlight.c
|
||||
index 83d3e21..2ae3160 100644
|
||||
--- a/src/highlight.c
|
||||
+++ b/src/highlight.c
|
||||
@@ -4055,7 +4055,7 @@ next_search_hl(
|
||||
linenr_T l;
|
||||
colnr_T matchcol;
|
||||
long nmatched;
|
||||
- int save_called_emsg = called_emsg;
|
||||
+ int called_emsg_before = called_emsg;
|
||||
|
||||
// for :{range}s/pat only highlight inside the range
|
||||
if (lnum < search_first_line || lnum > search_last_line)
|
||||
@@ -4081,7 +4081,6 @@ next_search_hl(
|
||||
* Repeat searching for a match until one is found that includes "mincol"
|
||||
* or none is found in this line.
|
||||
*/
|
||||
- called_emsg = FALSE;
|
||||
for (;;)
|
||||
{
|
||||
# ifdef FEAT_RELTIME
|
||||
@@ -4143,7 +4142,7 @@ next_search_hl(
|
||||
if (regprog_is_copy)
|
||||
cur->match.regprog = cur->hl.rm.regprog;
|
||||
|
||||
- if (called_emsg || got_int || timed_out)
|
||||
+ if (called_emsg > called_emsg_before || got_int || timed_out)
|
||||
{
|
||||
// Error while handling regexp: stop using this regexp.
|
||||
if (shl == search_hl)
|
||||
@@ -4176,9 +4175,6 @@ next_search_hl(
|
||||
break; // useful match found
|
||||
}
|
||||
}
|
||||
-
|
||||
- // Restore called_emsg for assert_fails().
|
||||
- called_emsg = save_called_emsg;
|
||||
}
|
||||
|
||||
/*
|
||||
diff --git a/src/main.c b/src/main.c
|
||||
index 72e51a3..eec02ea 100644
|
||||
--- a/src/main.c
|
||||
+++ b/src/main.c
|
||||
@@ -4140,7 +4140,7 @@ cmdsrv_main(
|
||||
if (xterm_dpy != NULL)
|
||||
res = serverGetVimNames(xterm_dpy);
|
||||
# endif
|
||||
- if (called_emsg)
|
||||
+ if (did_emsg)
|
||||
mch_errmsg("\n");
|
||||
}
|
||||
else if (STRICMP(argv[i], "--servername") == 0)
|
||||
diff --git a/src/message.c b/src/message.c
|
||||
index 679a992..35a88df 100644
|
||||
--- a/src/message.c
|
||||
+++ b/src/message.c
|
||||
@@ -581,7 +581,7 @@ ignore_error(char_u *msg)
|
||||
#if !defined(HAVE_STRERROR) || defined(PROTO)
|
||||
/*
|
||||
* Replacement for perror() that behaves more or less like emsg() was called.
|
||||
- * v:errmsg will be set and called_emsg will be set.
|
||||
+ * v:errmsg will be set and called_emsg will be incremented.
|
||||
*/
|
||||
void
|
||||
do_perror(char *msg)
|
||||
@@ -620,7 +620,7 @@ emsg_core(char_u *s)
|
||||
return msg_use_printf() ? FALSE : msg((char *)s);
|
||||
#endif
|
||||
|
||||
- called_emsg = TRUE;
|
||||
+ ++called_emsg;
|
||||
|
||||
#ifdef FEAT_EVAL
|
||||
/* If "emsg_severe" is TRUE: When an error exception is to be thrown,
|
||||
diff --git a/src/regexp.c b/src/regexp.c
|
||||
index c2f29c8..37e00b8 100644
|
||||
--- a/src/regexp.c
|
||||
+++ b/src/regexp.c
|
||||
@@ -2561,7 +2561,7 @@ vim_regcomp(char_u *expr_arg, int re_flags)
|
||||
{
|
||||
regprog_T *prog = NULL;
|
||||
char_u *expr = expr_arg;
|
||||
- int save_called_emsg;
|
||||
+ int called_emsg_before;
|
||||
|
||||
regexp_engine = p_re;
|
||||
|
||||
@@ -2597,8 +2597,7 @@ vim_regcomp(char_u *expr_arg, int re_flags)
|
||||
/*
|
||||
* First try the NFA engine, unless backtracking was requested.
|
||||
*/
|
||||
- save_called_emsg = called_emsg;
|
||||
- called_emsg = FALSE;
|
||||
+ called_emsg_before = called_emsg;
|
||||
if (regexp_engine != BACKTRACKING_ENGINE)
|
||||
prog = nfa_regengine.regcomp(expr,
|
||||
re_flags + (regexp_engine == AUTOMATIC_ENGINE ? RE_AUTO : 0));
|
||||
@@ -2629,13 +2628,13 @@ vim_regcomp(char_u *expr_arg, int re_flags)
|
||||
* but are still valid patterns, thus a retry should work.
|
||||
* But don't try if an error message was given.
|
||||
*/
|
||||
- if (regexp_engine == AUTOMATIC_ENGINE && !called_emsg)
|
||||
+ if (regexp_engine == AUTOMATIC_ENGINE
|
||||
+ && called_emsg == called_emsg_before)
|
||||
{
|
||||
regexp_engine = BACKTRACKING_ENGINE;
|
||||
prog = bt_regengine.regcomp(expr, re_flags);
|
||||
}
|
||||
}
|
||||
- called_emsg |= save_called_emsg;
|
||||
|
||||
if (prog != NULL)
|
||||
{
|
||||
diff --git a/src/search.c b/src/search.c
|
||||
index 43b2e98..c3c975e 100644
|
||||
--- a/src/search.c
|
||||
+++ b/src/search.c
|
||||
@@ -624,7 +624,7 @@ searchit(
|
||||
long nmatched;
|
||||
int submatch = 0;
|
||||
int first_match = TRUE;
|
||||
- int save_called_emsg = called_emsg;
|
||||
+ int called_emsg_before = called_emsg;
|
||||
#ifdef FEAT_SEARCH_EXTRA
|
||||
int break_loop = FALSE;
|
||||
#endif
|
||||
@@ -654,7 +654,6 @@ searchit(
|
||||
/*
|
||||
* find the string
|
||||
*/
|
||||
- called_emsg = FALSE;
|
||||
do // loop for count
|
||||
{
|
||||
// When not accepting a match at the start position set "extra_col" to
|
||||
@@ -745,7 +744,7 @@ searchit(
|
||||
#endif
|
||||
);
|
||||
// Abort searching on an error (e.g., out of stack).
|
||||
- if (called_emsg
|
||||
+ if (called_emsg > called_emsg_before
|
||||
#ifdef FEAT_RELTIME
|
||||
|| (timed_out != NULL && *timed_out)
|
||||
#endif
|
||||
@@ -1055,7 +1054,8 @@ searchit(
|
||||
* specified, after an interrupt, after a match and after looping
|
||||
* twice.
|
||||
*/
|
||||
- if (!p_ws || stop_lnum != 0 || got_int || called_emsg
|
||||
+ if (!p_ws || stop_lnum != 0 || got_int
|
||||
+ || called_emsg > called_emsg_before
|
||||
#ifdef FEAT_RELTIME
|
||||
|| (timed_out != NULL && *timed_out)
|
||||
#endif
|
||||
@@ -1082,7 +1082,7 @@ searchit(
|
||||
if (extra_arg != NULL)
|
||||
extra_arg->sa_wrapped = TRUE;
|
||||
}
|
||||
- if (got_int || called_emsg
|
||||
+ if (got_int || called_emsg > called_emsg_before
|
||||
#ifdef FEAT_RELTIME
|
||||
|| (timed_out != NULL && *timed_out)
|
||||
#endif
|
||||
@@ -1096,8 +1096,6 @@ searchit(
|
||||
|
||||
vim_regfree(regmatch.regprog);
|
||||
|
||||
- called_emsg |= save_called_emsg;
|
||||
-
|
||||
if (!found) // did not find it
|
||||
{
|
||||
if (got_int)
|
||||
@@ -4809,7 +4807,7 @@ is_zero_width(char_u *pattern, int move, pos_T *cur, int direction)
|
||||
int nmatched = 0;
|
||||
int result = -1;
|
||||
pos_T pos;
|
||||
- int save_called_emsg = called_emsg;
|
||||
+ int called_emsg_before = called_emsg;
|
||||
int flag = 0;
|
||||
|
||||
if (pattern == NULL)
|
||||
@@ -4838,7 +4836,6 @@ is_zero_width(char_u *pattern, int move, pos_T *cur, int direction)
|
||||
{
|
||||
// Zero-width pattern should match somewhere, then we can check if
|
||||
// start and end are in the same position.
|
||||
- called_emsg = FALSE;
|
||||
do
|
||||
{
|
||||
regmatch.startpos[0].col++;
|
||||
@@ -4849,7 +4846,7 @@ is_zero_width(char_u *pattern, int move, pos_T *cur, int direction)
|
||||
} while (direction == FORWARD ? regmatch.startpos[0].col < pos.col
|
||||
: regmatch.startpos[0].col > pos.col);
|
||||
|
||||
- if (!called_emsg)
|
||||
+ if (called_emsg == called_emsg_before)
|
||||
{
|
||||
result = (nmatched != 0
|
||||
&& regmatch.startpos[0].lnum == regmatch.endpos[0].lnum
|
||||
@@ -4857,7 +4854,6 @@ is_zero_width(char_u *pattern, int move, pos_T *cur, int direction)
|
||||
}
|
||||
}
|
||||
|
||||
- called_emsg |= save_called_emsg;
|
||||
vim_regfree(regmatch.regprog);
|
||||
return result;
|
||||
}
|
||||
diff --git a/src/testing.c b/src/testing.c
|
||||
index f19481f..c0360e5 100644
|
||||
--- a/src/testing.c
|
||||
+++ b/src/testing.c
|
||||
@@ -424,15 +424,15 @@ f_assert_fails(typval_T *argvars, typval_T *rettv)
|
||||
char_u *cmd = tv_get_string_chk(&argvars[0]);
|
||||
garray_T ga;
|
||||
int save_trylevel = trylevel;
|
||||
+ int called_emsg_before = called_emsg;
|
||||
|
||||
// trylevel must be zero for a ":throw" command to be considered failed
|
||||
trylevel = 0;
|
||||
- called_emsg = FALSE;
|
||||
suppress_errthrow = TRUE;
|
||||
emsg_silent = TRUE;
|
||||
|
||||
do_cmdline_cmd(cmd);
|
||||
- if (!called_emsg)
|
||||
+ if (called_emsg == called_emsg_before)
|
||||
{
|
||||
prepare_assert_error(&ga);
|
||||
ga_concat(&ga, (char_u *)"command did not fail: ");
|
||||
@@ -461,7 +461,6 @@ f_assert_fails(typval_T *argvars, typval_T *rettv)
|
||||
}
|
||||
|
||||
trylevel = save_trylevel;
|
||||
- called_emsg = FALSE;
|
||||
suppress_errthrow = FALSE;
|
||||
emsg_silent = FALSE;
|
||||
emsg_on_display = FALSE;
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
From 98a336dd497d3422e7efeef9f24cc9e25aeb8a49 Mon Sep 17 00:00:00 2001
|
||||
From: Bram Moolenaar <Bram@vim.org>
|
||||
Date: Mon, 20 Jan 2020 20:22:30 +0100
|
||||
Subject: [PATCH] patch 8.2.0133: invalid memory access with search command
|
||||
|
||||
Problem: Invalid memory access with search command.
|
||||
Solution: When :normal runs out of characters in bracketed paste mode break
|
||||
out of the loop.(closes #5511)
|
||||
---
|
||||
src/edit.c | 4 ++--
|
||||
src/testdir/test_search.vim | 5 +++++
|
||||
2 files changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/edit.c b/src/edit.c
|
||||
index a20fd3d..a1836c9 100644
|
||||
--- a/src/edit.c
|
||||
+++ b/src/edit.c
|
||||
@@ -4947,9 +4947,9 @@ bracketed_paste(paste_mode_T mode, int drop, garray_T *gap)
|
||||
do
|
||||
c = vgetc();
|
||||
while (c == K_IGNORE || c == K_VER_SCROLLBAR || c == K_HOR_SCROLLBAR);
|
||||
- if (c == NUL || got_int)
|
||||
+ if (c == NUL || got_int || (ex_normal_busy > 0 && c == Ctrl_C))
|
||||
// When CTRL-C was encountered the typeahead will be flushed and we
|
||||
- // won't get the end sequence.
|
||||
+ // won't get the end sequence. Except when using ":normal".
|
||||
break;
|
||||
|
||||
if (has_mbyte)
|
||||
diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim
|
||||
index ac0881c..e74681f 100644
|
||||
--- a/src/testdir/test_search.vim
|
||||
+++ b/src/testdir/test_search.vim
|
||||
@@ -1380,3 +1380,8 @@ func Test_search_with_invalid_range()
|
||||
bwipe!
|
||||
call delete('Xrangesearch')
|
||||
endfunc
|
||||
+
|
||||
+func Test_search_special()
|
||||
+ " this was causing illegal memory access
|
||||
+ exe "norm /\x80PS"
|
||||
+endfunc
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -0,0 +1,43 @@
|
||||
From fe4bbac1166f2e4e3fa18cb966ec7305198c8176 Mon Sep 17 00:00:00 2001
|
||||
From: Bram Moolenaar <Bram@vim.org>
|
||||
Date: Mon, 20 Jan 2020 21:12:20 +0100
|
||||
Subject: [PATCH] patch 8.2.0135: bracketed paste can still cause invalid
|
||||
memory access
|
||||
|
||||
Problem: Bracketed paste can still cause invalid memory access. (Dominique
|
||||
Pelle)
|
||||
Solution: Check for NULL pointer.
|
||||
---
|
||||
src/edit.c | 2 +-
|
||||
src/testdir/test_search.vim | 3 ++-
|
||||
2 files changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/edit.c b/src/edit.c
|
||||
index a1836c9..15b0cc9 100644
|
||||
--- a/src/edit.c
|
||||
+++ b/src/edit.c
|
||||
@@ -4930,7 +4930,7 @@ bracketed_paste(paste_mode_T mode, int drop, garray_T *gap)
|
||||
int save_paste = p_paste;
|
||||
|
||||
// If the end code is too long we can't detect it, read everything.
|
||||
- if (STRLEN(end) >= NUMBUFLEN)
|
||||
+ if (end != NULL && STRLEN(end) >= NUMBUFLEN)
|
||||
end = NULL;
|
||||
++no_mapping;
|
||||
allow_keys = 0;
|
||||
diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim
|
||||
index e74681f..7e86b79 100644
|
||||
--- a/src/testdir/test_search.vim
|
||||
+++ b/src/testdir/test_search.vim
|
||||
@@ -1382,6 +1382,7 @@ func Test_search_with_invalid_range()
|
||||
endfunc
|
||||
|
||||
func Test_search_special()
|
||||
- " this was causing illegal memory access
|
||||
+ " this was causing illegal memory access and an endless loop
|
||||
+ set t_PE=
|
||||
exe "norm /\x80PS"
|
||||
endfunc
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -0,0 +1,49 @@
|
||||
From 3180fe6c6dc0728d21c6318b957022b029c234f0 Mon Sep 17 00:00:00 2001
|
||||
From: Bram Moolenaar <Bram@vim.org>
|
||||
Date: Sun, 2 Feb 2020 13:47:06 +0100
|
||||
Subject: [PATCH] patch 8.2.0195: some tests fail when run in the GUI
|
||||
|
||||
Problem: Some tests fail when run in the GUI.
|
||||
Solution: Make sure the window width is enough. In the GUI run terminal Vim
|
||||
in the terminal, if possible.
|
||||
---
|
||||
src/testdir/check.vim | 1 +
|
||||
src/testdir/test_highlight.vim | 5 ++++-
|
||||
2 files changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/testdir/check.vim b/src/testdir/check.vim
|
||||
index 30c4158..0c375e3 100644
|
||||
--- a/src/testdir/check.vim
|
||||
+++ b/src/testdir/check.vim
|
||||
@@ -1,4 +1,5 @@
|
||||
source shared.vim
|
||||
+source term_util.vim
|
||||
|
||||
" Command to check for the presence of a feature.
|
||||
command -nargs=1 CheckFeature call CheckFeature(<f-args>)
|
||||
diff --git a/src/testdir/test_highlight.vim b/src/testdir/test_highlight.vim
|
||||
index f63abee..ea4fa7f 100644
|
||||
--- a/src/testdir/test_highlight.vim
|
||||
+++ b/src/testdir/test_highlight.vim
|
||||
@@ -594,6 +594,8 @@ endfunc
|
||||
|
||||
func Test_wincolor()
|
||||
CheckScreendump
|
||||
+ " make sure the width is enough for the test
|
||||
+ set columns=80
|
||||
|
||||
let lines =<< trim END
|
||||
set cursorline cursorcolumn rnu
|
||||
@@ -685,7 +687,8 @@ func Test_1_highlight_Normalgroup_exists()
|
||||
endif
|
||||
endfunc
|
||||
|
||||
-function Test_no_space_before_xxx()
|
||||
+" Do this test last, sometimes restoring the columns doesn't work
|
||||
+function Test_z_no_space_before_xxx()
|
||||
let l:org_columns = &columns
|
||||
set columns=17
|
||||
let l:hi_StatusLineTermNC = join(split(execute('hi StatusLineTermNC')))
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -0,0 +1,403 @@
|
||||
From 9f6277bdde97b7767ded43a0b5a2023eb601b3b7 Mon Sep 17 00:00:00 2001
|
||||
From: Bram Moolenaar <Bram@vim.org>
|
||||
Date: Tue, 11 Feb 2020 22:04:02 +0100
|
||||
Subject: [PATCH] patch 8.2.0243: insufficient code coverage for ex_docmd.c
|
||||
functions
|
||||
|
||||
Problem: Insufficient code coverage for ex_docmd.c functions.
|
||||
Solution: Add more tests. (Yegappan Lakshmanan, closes #5618)
|
||||
---
|
||||
src/testdir/test_arglist.vim | 17 +++++++
|
||||
src/testdir/test_cd.vim | 16 ++++++
|
||||
src/testdir/test_cmdline.vim | 9 ++++
|
||||
src/testdir/test_ex_mode.vim | 22 +++++++++
|
||||
src/testdir/test_excmd.vim | 37 ++++++++++++++
|
||||
src/testdir/test_quickfix.vim | 15 ++++++
|
||||
src/testdir/test_sort.vim | 16 ++++++
|
||||
src/testdir/test_source.vim | 10 ++++
|
||||
src/testdir/test_substitute.vim | 2 ++
|
||||
src/testdir/test_undo.vim | 2 +
|
||||
src/testdir/test_vimscript.vim | 86 +++++++++++++++++++++++++++++++++
|
||||
src/testdir/test_window_cmd.vim | 14 ++++++
|
||||
12 files changed, 246 insertions(+)
|
||||
|
||||
diff --git a/src/testdir/test_arglist.vim b/src/testdir/test_arglist.vim
|
||||
index e5a5e89..d4ad0f5 100644
|
||||
--- a/src/testdir/test_arglist.vim
|
||||
+++ b/src/testdir/test_arglist.vim
|
||||
@@ -1,5 +1,8 @@
|
||||
" Test argument list commands
|
||||
|
||||
+source shared.vim
|
||||
+source term_util.vim
|
||||
+
|
||||
func Test_argidx()
|
||||
args a b c
|
||||
last
|
||||
@@ -517,3 +520,17 @@ func Test_clear_arglist_in_all()
|
||||
call assert_fails("all", "E1156")
|
||||
au! *
|
||||
endfunc
|
||||
+
|
||||
+" Test for quiting Vim with unedited files in the argument list
|
||||
+func Test_quit_with_arglist()
|
||||
+ if !CanRunVimInTerminal()
|
||||
+ throw 'Skipped: cannot run vim in terminal'
|
||||
+ endif
|
||||
+ let buf = RunVimInTerminal('', {'rows': 6})
|
||||
+ call term_sendkeys(buf, ":args a b c\n")
|
||||
+ call term_sendkeys(buf, ":quit\n")
|
||||
+ call WaitForAssert({-> assert_match('^E173:', term_getline(buf, 6))})
|
||||
+ call StopVimInTerminal(buf)
|
||||
+endfunc
|
||||
+
|
||||
+" vim: shiftwidth=2 sts=2 expandtab
|
||||
diff --git a/src/testdir/test_cd.vim b/src/testdir/test_cd.vim
|
||||
index bdb26cd..0e63538 100644
|
||||
--- a/src/testdir/test_cd.vim
|
||||
+++ b/src/testdir/test_cd.vim
|
||||
@@ -1,5 +1,7 @@
|
||||
" Test for :cd and chdir()
|
||||
|
||||
+source shared.vim
|
||||
+
|
||||
func Test_cd_large_path()
|
||||
" This used to crash with a heap write overflow.
|
||||
call assert_fails('cd ' . repeat('x', 5000), 'E472:')
|
||||
@@ -40,6 +42,20 @@ func Test_cd_minus()
|
||||
call assert_equal(path_dotdot, getcwd())
|
||||
cd -
|
||||
call assert_equal(path, getcwd())
|
||||
+
|
||||
+ " Test for :cd - without a previous directory
|
||||
+ let lines =<< trim [SCRIPT]
|
||||
+ call assert_fails('cd -', 'E186:')
|
||||
+ call assert_fails('call chdir("-")', 'E186:')
|
||||
+ call writefile(v:errors, 'Xresult')
|
||||
+ qall!
|
||||
+ [SCRIPT]
|
||||
+ call writefile(lines, 'Xscript')
|
||||
+ if RunVim([], [], '--clean -S Xscript')
|
||||
+ call assert_equal([], readfile('Xresult'))
|
||||
+ endif
|
||||
+ call delete('Xscript')
|
||||
+ call delete('Xresult')
|
||||
endfunc
|
||||
|
||||
func Test_cd_with_cpo_chdir()
|
||||
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
|
||||
index f3860b7..41b36e7 100644
|
||||
--- a/src/testdir/test_cmdline.vim
|
||||
+++ b/src/testdir/test_cmdline.vim
|
||||
@@ -943,4 +943,13 @@ func Test_cmdwin_virtual_edit()
|
||||
set ve= cpo-=$
|
||||
endfunc
|
||||
|
||||
+" Test for failure in expanding special keywords in cmdline
|
||||
+func Test_cmdline_expand_special()
|
||||
+ %bwipe!
|
||||
+ call assert_fails('e #', 'E499:')
|
||||
+ call assert_fails('e <afile>', 'E495:')
|
||||
+ call assert_fails('e <abuf>', 'E496:')
|
||||
+ call assert_fails('e <amatch>', 'E497:')
|
||||
+endfunc
|
||||
+
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
diff --git a/src/testdir/test_ex_mode.vim b/src/testdir/test_ex_mode.vim
|
||||
index 00a35a3..3842fc3 100644
|
||||
--- a/src/testdir/test_ex_mode.vim
|
||||
+++ b/src/testdir/test_ex_mode.vim
|
||||
@@ -52,3 +52,25 @@ func Test_ex_mode()
|
||||
set sw&
|
||||
let &encoding = encoding_save
|
||||
endfunc
|
||||
+
|
||||
+" Test for displaying lines from an empty buffer in Ex mode
|
||||
+func Test_Ex_emptybuf()
|
||||
+ new
|
||||
+ call assert_fails('call feedkeys("Q\<CR>", "xt")', 'E749:')
|
||||
+ call setline(1, "abc")
|
||||
+ call assert_fails('call feedkeys("Q\<CR>", "xt")', 'E501:')
|
||||
+ call assert_fails('call feedkeys("Q%d\<CR>", "xt")', 'E749:')
|
||||
+ close!
|
||||
+endfunc
|
||||
+
|
||||
+" Test for the :open command
|
||||
+func Test_open_command()
|
||||
+ new
|
||||
+ call setline(1, ['foo foo', 'foo bar', 'foo baz'])
|
||||
+ call feedkeys("Qopen\<CR>j", 'xt')
|
||||
+ call assert_equal('foo bar', getline('.'))
|
||||
+ call feedkeys("Qopen /bar/\<CR>", 'xt')
|
||||
+ call assert_equal(5, col('.'))
|
||||
+ call assert_fails('call feedkeys("Qopen /baz/\<CR>", "xt")', 'E479:')
|
||||
+ close!
|
||||
+endfunc
|
||||
diff --git a/src/testdir/test_excmd.vim b/src/testdir/test_excmd.vim
|
||||
index 17d9028..98b74fc 100644
|
||||
--- a/src/testdir/test_excmd.vim
|
||||
+++ b/src/testdir/test_excmd.vim
|
||||
@@ -18,6 +18,7 @@ func Test_range_error()
|
||||
call assert_fails(':\/echo 1', 'E481:')
|
||||
normal vv
|
||||
call assert_fails(":'<,'>echo 1", 'E481:')
|
||||
+ call assert_fails(":\\xcenter", 'E10:')
|
||||
endfunc
|
||||
|
||||
func Test_buffers_lastused()
|
||||
@@ -53,3 +54,39 @@ func Test_using_zero_in_range()
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
+" Test for the :print command
|
||||
+func Test_print_cmd()
|
||||
+ call assert_fails('print', 'E749:')
|
||||
+endfunc
|
||||
+
|
||||
+" Test for the :winsize command
|
||||
+func Test_winsize_cmd()
|
||||
+ call assert_fails('winsize 1', 'E465:')
|
||||
+endfunc
|
||||
+
|
||||
+" Test for the :redir command
|
||||
+func Test_redir_cmd()
|
||||
+ call assert_fails('redir @@', 'E475:')
|
||||
+ call assert_fails('redir abc', 'E475:')
|
||||
+ if has('unix')
|
||||
+ call mkdir('Xdir')
|
||||
+ call assert_fails('redir > Xdir', 'E17:')
|
||||
+ call delete('Xdir', 'd')
|
||||
+ endif
|
||||
+ if !has('bsd')
|
||||
+ call writefile([], 'Xfile')
|
||||
+ call setfperm('Xfile', 'r--r--r--')
|
||||
+ call assert_fails('redir! > Xfile', 'E190:')
|
||||
+ call delete('Xfile')
|
||||
+ endif
|
||||
+endfunc
|
||||
+
|
||||
+" Test for the :filetype command
|
||||
+func Test_filetype_cmd()
|
||||
+ call assert_fails('filetype abc', 'E475:')
|
||||
+endfunc
|
||||
+
|
||||
+" Test for the :mode command
|
||||
+func Test_mode_cmd()
|
||||
+ call assert_fails('mode abc', 'E359:')
|
||||
+endfunc
|
||||
diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim
|
||||
index 72f3172..a3dfaa9 100644
|
||||
--- a/src/testdir/test_quickfix.vim
|
||||
+++ b/src/testdir/test_quickfix.vim
|
||||
@@ -2810,6 +2810,21 @@ func Test_vimgrep_incsearch()
|
||||
set noincsearch
|
||||
endfunc
|
||||
|
||||
+" Test vimgrep with the last search pattern not set
|
||||
+func Test_vimgrep_with_no_last_search_pat()
|
||||
+ let lines =<< trim [SCRIPT]
|
||||
+ call assert_fails('vimgrep // *', 'E35:')
|
||||
+ call writefile(v:errors, 'Xresult')
|
||||
+ qall!
|
||||
+ [SCRIPT]
|
||||
+ call writefile(lines, 'Xscript')
|
||||
+ if RunVim([], [], '--clean -S Xscript')
|
||||
+ call assert_equal([], readfile('Xresult'))
|
||||
+ endif
|
||||
+ call delete('Xscript')
|
||||
+ call delete('Xresult')
|
||||
+endfunc
|
||||
+
|
||||
func XfreeTests(cchar)
|
||||
call s:setup_commands(a:cchar)
|
||||
|
||||
diff --git a/src/testdir/test_sort.vim b/src/testdir/test_sort.vim
|
||||
index 7da82b0..4332664 100644
|
||||
--- a/src/testdir/test_sort.vim
|
||||
+++ b/src/testdir/test_sort.vim
|
||||
@@ -1322,3 +1322,19 @@ func Test_sort_cmd_report()
|
||||
call assert_match("6 fewer lines", res)
|
||||
enew!
|
||||
endfunc
|
||||
+
|
||||
+" Test for :sort with no last search pattern
|
||||
+func Test_sort_with_no_last_search_pat()
|
||||
+ let lines =<< trim [SCRIPT]
|
||||
+ call setline(1, ['3b', '1c', '2a'])
|
||||
+ call assert_fails('sort //', 'E35:')
|
||||
+ call writefile(v:errors, 'Xresult')
|
||||
+ qall!
|
||||
+ [SCRIPT]
|
||||
+ call writefile(lines, 'Xscript')
|
||||
+ if RunVim([], [], '--clean -S Xscript')
|
||||
+ call assert_equal([], readfile('Xresult'))
|
||||
+ endif
|
||||
+ call delete('Xscript')
|
||||
+ call delete('Xresult')
|
||||
+endfunc
|
||||
diff --git a/src/testdir/test_source.vim b/src/testdir/test_source.vim
|
||||
index 09baec0..1d6bff0 100644
|
||||
--- a/src/testdir/test_source.vim
|
||||
+++ b/src/testdir/test_source.vim
|
||||
@@ -46,3 +46,13 @@ func Test_source_sandbox()
|
||||
bwipe!
|
||||
call delete('Xsourcehello')
|
||||
endfunc
|
||||
+
|
||||
+" When sourcing a vim script, shebang should be ignored.
|
||||
+func Test_source_ignore_shebang()
|
||||
+ call writefile(['#!./xyzabc', 'let g:val=369'], 'Xfile.vim')
|
||||
+ source Xfile.vim
|
||||
+ call assert_equal(g:val, 369)
|
||||
+ call delete('Xfile.vim')
|
||||
+endfunc
|
||||
+
|
||||
+" vim: shiftwidth=2 sts=2 expandtab
|
||||
diff --git a/src/testdir/test_substitute.vim b/src/testdir/test_substitute.vim
|
||||
index c590005..4cdbc15 100644
|
||||
--- a/src/testdir/test_substitute.vim
|
||||
+++ b/src/testdir/test_substitute.vim
|
||||
@@ -1,5 +1,7 @@
|
||||
" Tests for multi-line regexps with ":s".
|
||||
|
||||
+source shared.vim
|
||||
+
|
||||
func Test_multiline_subst()
|
||||
enew!
|
||||
call append(0, ["1 aa",
|
||||
diff --git a/src/testdir/test_undo.vim b/src/testdir/test_undo.vim
|
||||
index 12d835b..79944d9 100644
|
||||
--- a/src/testdir/test_undo.vim
|
||||
+++ b/src/testdir/test_undo.vim
|
||||
@@ -275,6 +275,8 @@ func Test_undo_write()
|
||||
close!
|
||||
call delete('Xtest')
|
||||
bwipe! Xtest
|
||||
+
|
||||
+ call assert_fails('earlier xyz', 'E475:')
|
||||
endfunc
|
||||
|
||||
func Test_insert_expr()
|
||||
diff --git a/src/testdir/test_vimscript.vim b/src/testdir/test_vimscript.vim
|
||||
index 89112de..90f1f56 100644
|
||||
--- a/src/testdir/test_vimscript.vim
|
||||
+++ b/src/testdir/test_vimscript.vim
|
||||
@@ -1944,6 +1945,92 @@ func Test_function_defined_line()
|
||||
call delete('Xtest.vim')
|
||||
endfunc
|
||||
|
||||
+" Test for missing :endif, :endfor, :endwhile and :endtry {{{1
|
||||
+func Test_missing_end()
|
||||
+ call writefile(['if 2 > 1', 'echo ">"'], 'Xscript')
|
||||
+ call assert_fails('source Xscript', 'E171:')
|
||||
+ call writefile(['for i in range(5)', 'echo i'], 'Xscript')
|
||||
+ call assert_fails('source Xscript', 'E170:')
|
||||
+ call writefile(['while v:true', 'echo "."'], 'Xscript')
|
||||
+ call assert_fails('source Xscript', 'E170:')
|
||||
+ call writefile(['try', 'echo "."'], 'Xscript')
|
||||
+ call assert_fails('source Xscript', 'E600:')
|
||||
+ call delete('Xscript')
|
||||
+endfunc
|
||||
+
|
||||
+" Test for deep nesting of if/for/while/try statements {{{1
|
||||
+func Test_deep_nest()
|
||||
+ if !CanRunVimInTerminal()
|
||||
+ throw 'Skipped: cannot run vim in terminal'
|
||||
+ endif
|
||||
+
|
||||
+ let lines =<< trim [SCRIPT]
|
||||
+ " Deep nesting of if ... endif
|
||||
+ func Test1()
|
||||
+ let @a = join(repeat(['if v:true'], 51), "\n")
|
||||
+ let @a ..= "\n"
|
||||
+ let @a ..= join(repeat(['endif'], 51), "\n")
|
||||
+ @a
|
||||
+ let @a = ''
|
||||
+ endfunc
|
||||
+
|
||||
+ " Deep nesting of for ... endfor
|
||||
+ func Test2()
|
||||
+ let @a = join(repeat(['for i in [1]'], 51), "\n")
|
||||
+ let @a ..= "\n"
|
||||
+ let @a ..= join(repeat(['endfor'], 51), "\n")
|
||||
+ @a
|
||||
+ let @a = ''
|
||||
+ endfunc
|
||||
+
|
||||
+ " Deep nesting of while ... endwhile
|
||||
+ func Test3()
|
||||
+ let @a = join(repeat(['while v:true'], 51), "\n")
|
||||
+ let @a ..= "\n"
|
||||
+ let @a ..= join(repeat(['endwhile'], 51), "\n")
|
||||
+ @a
|
||||
+ let @a = ''
|
||||
+ endfunc
|
||||
+
|
||||
+ " Deep nesting of try ... endtry
|
||||
+ func Test4()
|
||||
+ let @a = join(repeat(['try'], 51), "\n")
|
||||
+ let @a ..= "\necho v:true\n"
|
||||
+ let @a ..= join(repeat(['endtry'], 51), "\n")
|
||||
+ @a
|
||||
+ let @a = ''
|
||||
+ endfunc
|
||||
+ [SCRIPT]
|
||||
+ call writefile(lines, 'Xscript')
|
||||
+
|
||||
+ let buf = RunVimInTerminal('-S Xscript', {'rows': 6})
|
||||
+
|
||||
+ " Deep nesting of if ... endif
|
||||
+ call term_sendkeys(buf, ":call Test1()\n")
|
||||
+ call WaitForAssert({-> assert_match('^E579:', term_getline(buf, 5))})
|
||||
+
|
||||
+ " Deep nesting of for ... endfor
|
||||
+ call term_sendkeys(buf, ":call Test2()\n")
|
||||
+ call WaitForAssert({-> assert_match('^E585:', term_getline(buf, 5))})
|
||||
+
|
||||
+ " Deep nesting of while ... endwhile
|
||||
+ call term_sendkeys(buf, ":call Test3()\n")
|
||||
+ call WaitForAssert({-> assert_match('^E585:', term_getline(buf, 5))})
|
||||
+
|
||||
+ " Deep nesting of try ... endtry
|
||||
+ call term_sendkeys(buf, ":call Test4()\n")
|
||||
+ call WaitForAssert({-> assert_match('^E601:', term_getline(buf, 5))})
|
||||
+
|
||||
+ "let l = ''
|
||||
+ "for i in range(1, 6)
|
||||
+ " let l ..= term_getline(buf, i) . "\n"
|
||||
+ "endfor
|
||||
+ "call assert_report(l)
|
||||
+
|
||||
+ call StopVimInTerminal(buf)
|
||||
+ call delete('Xscript')
|
||||
+endfunc
|
||||
+
|
||||
"-------------------------------------------------------------------------------
|
||||
" Modelines {{{1
|
||||
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
|
||||
diff --git a/src/testdir/test_window_cmd.vim b/src/testdir/test_window_cmd.vim
|
||||
index d543ef7..2eb415f 100644
|
||||
--- a/src/testdir/test_window_cmd.vim
|
||||
+++ b/src/testdir/test_window_cmd.vim
|
||||
@@ -929,4 +929,18 @@ func Test_win_splitmove()
|
||||
call assert_fails('call win_splitmove(winnr(), winnr())', 'E957:')
|
||||
endfunc
|
||||
|
||||
+" Test for errors with :wincmd
|
||||
+func Test_wincmd_errors()
|
||||
+ call assert_fails('wincmd g', 'E474:')
|
||||
+ call assert_fails('wincmd ab', 'E474:')
|
||||
+endfunc
|
||||
+
|
||||
+" Test for errors with :winpos
|
||||
+func Test_winpos_errors()
|
||||
+ if !has("gui_running") && !has('win32')
|
||||
+ call assert_fails('winpos', 'E188:')
|
||||
+ endif
|
||||
+ call assert_fails('winpos 10', 'E466:')
|
||||
+endfunc
|
||||
+
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -0,0 +1,67 @@
|
||||
From c5acc0f7fed6b061d994fc5ac660dcc0312750bd Mon Sep 17 00:00:00 2001
|
||||
From: Bram Moolenaar <Bram@vim.org>
|
||||
Date: Wed, 3 Jun 2020 18:55:38 +0200
|
||||
Subject: [PATCH] patch 8.2.0892: ubsan warns for undefined behavior
|
||||
|
||||
Problem: Ubsan warns for undefined behavior.
|
||||
Solution: Use unsigned instead of signed variable. (Dominique Pelle,
|
||||
closes #6193)
|
||||
---
|
||||
src/regexp_nfa.c | 17 +++++++++++++----
|
||||
1 files changed, 13 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c
|
||||
index 26a8f35..465797d 100644
|
||||
--- a/src/regexp_nfa.c
|
||||
+++ b/src/regexp_nfa.c
|
||||
@@ -246,6 +246,7 @@ static int nfa_classcodes[] = {
|
||||
static char_u e_nul_found[] = N_("E865: (NFA) Regexp end encountered prematurely");
|
||||
static char_u e_misplaced[] = N_("E866: (NFA regexp) Misplaced %c");
|
||||
static char_u e_ill_char_class[] = N_("E877: (NFA regexp) Invalid character class: %d");
|
||||
+static char_u e_value_too_large[] = N_("E951: \\% value too large");
|
||||
|
||||
// Variables only used in nfa_regcomp() and descendants.
|
||||
static int nfa_re_flags; // re_flags passed to nfa_regcomp()
|
||||
@@ -1541,19 +1542,27 @@ nfa_regatom(void)
|
||||
|
||||
default:
|
||||
{
|
||||
- long n = 0;
|
||||
+ long_u n = 0;
|
||||
int cmp = c;
|
||||
|
||||
if (c == '<' || c == '>')
|
||||
c = getchr();
|
||||
while (VIM_ISDIGIT(c))
|
||||
{
|
||||
- n = n * 10 + (c - '0');
|
||||
+ long_u tmp = n * 10 + (c - '0');
|
||||
+
|
||||
+ if (tmp < n)
|
||||
+ {
|
||||
+ // overflow.
|
||||
+ emsg(_(e_value_too_large));
|
||||
+ return FAIL;
|
||||
+ }
|
||||
+ n = tmp;
|
||||
c = getchr();
|
||||
}
|
||||
if (c == 'l' || c == 'c' || c == 'v')
|
||||
{
|
||||
- int limit = INT_MAX;
|
||||
+ long_u limit = INT_MAX;
|
||||
|
||||
if (c == 'l')
|
||||
{
|
||||
@@ -1576,7 +1585,7 @@ nfa_regatom(void)
|
||||
}
|
||||
if (n >= limit)
|
||||
{
|
||||
- emsg(_("E951: \\% value too large"));
|
||||
+ emsg(_(e_value_too_large));
|
||||
return FAIL;
|
||||
}
|
||||
EMIT((int)n);
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
257
backport-patch-8.2.0945-cannot-use-z-when-spell-is-off.patch
Normal file
257
backport-patch-8.2.0945-cannot-use-z-when-spell-is-off.patch
Normal file
@ -0,0 +1,257 @@
|
||||
From 152e79e94bb935e75b866bd55479648cde11066a Mon Sep 17 00:00:00 2001
|
||||
From: Bram Moolenaar <Bram@vim.org>
|
||||
Date: Wed, 10 Jun 2020 15:32:08 +0200
|
||||
Subject: [PATCH] patch 8.2.0945: cannot use "z=" when 'spell' is off
|
||||
|
||||
Problem: Cannot use "z=" when 'spell' is off.
|
||||
Solution: Make "z=" work even when 'spell' is off. (Christian Brabandt,
|
||||
Gary Johnson, closes #6227)
|
||||
---
|
||||
runtime/doc/eval.txt | 8 +++----
|
||||
src/evalfunc.c | 46 ++++++++++++++++++++++++++++++++++++--
|
||||
src/globals.h | 3 +++
|
||||
src/spell.c | 2 +-
|
||||
src/spellsuggest.c | 13 ++++++++++-
|
||||
src/testdir/test_spell.vim | 37 +++++++++++++++++++++++++++---
|
||||
6 files changed, 97 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
|
||||
index b28fac9..1aeb193 100644
|
||||
--- a/runtime/doc/eval.txt
|
||||
+++ b/runtime/doc/eval.txt
|
||||
@@ -9071,9 +9071,8 @@ spellbadword([{sentence}])
|
||||
echo spellbadword("the quik brown fox")
|
||||
< ['quik', 'bad'] ~
|
||||
|
||||
- The spelling information for the current window is used. The
|
||||
- 'spell' option must be set and the value of 'spelllang' is
|
||||
- used.
|
||||
+ The spelling information for the current window and the value
|
||||
+ of 'spelllang' are used.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetText()->spellbadword()
|
||||
@@ -9098,8 +9097,7 @@ spellsuggest({word} [, {max} [, {capital}]])
|
||||
although it may appear capitalized.
|
||||
|
||||
The spelling information for the current window is used. The
|
||||
- 'spell' option must be set and the values of 'spelllang' and
|
||||
- 'spellsuggest' are used.
|
||||
+ values of 'spelllang' and 'spellsuggest' are used.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetWord()->spellsuggest()
|
||||
diff --git a/src/evalfunc.c b/src/evalfunc.c
|
||||
index 892a753..24bd7b1 100644
|
||||
--- a/src/evalfunc.c
|
||||
+++ b/src/evalfunc.c
|
||||
@@ -6903,9 +6903,30 @@ f_spellbadword(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
char_u *word = (char_u *)"";
|
||||
hlf_T attr = HLF_COUNT;
|
||||
int len = 0;
|
||||
+#ifdef FEAT_SPELL
|
||||
+ int wo_spell_save = curwin->w_p_spell;
|
||||
+
|
||||
+ if (!curwin->w_p_spell)
|
||||
+ {
|
||||
+ did_set_spelllang(curwin);
|
||||
+ curwin->w_p_spell = TRUE;
|
||||
+ }
|
||||
+
|
||||
+ if (*curwin->w_s->b_p_spl == NUL)
|
||||
+ {
|
||||
+ emsg(_(e_no_spell));
|
||||
+ curwin->w_p_spell = wo_spell_save;
|
||||
+ return;
|
||||
+ }
|
||||
+#endif
|
||||
|
||||
if (rettv_list_alloc(rettv) == FAIL)
|
||||
+ {
|
||||
+#ifdef FEAT_SPELL
|
||||
+ curwin->w_p_spell = wo_spell_save;
|
||||
+#endif
|
||||
return;
|
||||
+ }
|
||||
|
||||
#ifdef FEAT_SPELL
|
||||
if (argvars[0].v_type == VAR_UNKNOWN)
|
||||
@@ -6918,7 +6939,7 @@ f_spellbadword(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
curwin->w_set_curswant = TRUE;
|
||||
}
|
||||
}
|
||||
- else if (curwin->w_p_spell && *curbuf->b_s.b_p_spl != NUL)
|
||||
+ else if (*curbuf->b_s.b_p_spl != NUL)
|
||||
{
|
||||
char_u *str = tv_get_string_chk(&argvars[0]);
|
||||
int capcol = -1;
|
||||
@@ -6940,6 +6961,7 @@ f_spellbadword(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
}
|
||||
}
|
||||
}
|
||||
+ curwin->w_p_spell = wo_spell_save;
|
||||
#endif
|
||||
|
||||
list_append_string(rettv->vval.v_list, word, len);
|
||||
@@ -6965,13 +6987,32 @@ f_spellsuggest(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
int i;
|
||||
listitem_T *li;
|
||||
int need_capital = FALSE;
|
||||
+ int wo_spell_save = curwin->w_p_spell;
|
||||
+
|
||||
+ if (!curwin->w_p_spell)
|
||||
+ {
|
||||
+ did_set_spelllang(curwin);
|
||||
+ curwin->w_p_spell = TRUE;
|
||||
+ }
|
||||
+
|
||||
+ if (*curwin->w_s->b_p_spl == NUL)
|
||||
+ {
|
||||
+ emsg(_(e_no_spell));
|
||||
+ curwin->w_p_spell = wo_spell_save;
|
||||
+ return;
|
||||
+ }
|
||||
#endif
|
||||
|
||||
if (rettv_list_alloc(rettv) == FAIL)
|
||||
+ {
|
||||
+#ifdef FEAT_SPELL
|
||||
+ curwin->w_p_spell = wo_spell_save;
|
||||
+#endif
|
||||
return;
|
||||
+ }
|
||||
|
||||
#ifdef FEAT_SPELL
|
||||
- if (curwin->w_p_spell && *curwin->w_s->b_p_spl != NUL)
|
||||
+ if (*curwin->w_s->b_p_spl != NUL)
|
||||
{
|
||||
str = tv_get_string(&argvars[0]);
|
||||
if (argvars[1].v_type != VAR_UNKNOWN)
|
||||
@@ -7008,6 +7049,7 @@ f_spellsuggest(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
}
|
||||
ga_clear(&ga);
|
||||
}
|
||||
+ curwin->w_p_spell = wo_spell_save;
|
||||
#endif
|
||||
}
|
||||
|
||||
diff --git a/src/globals.h b/src/globals.h
|
||||
index 01ebbb8..4d40de4 100644
|
||||
--- a/src/globals.h
|
||||
+++ b/src/globals.h
|
||||
@@ -1502,6 +1502,9 @@ EXTERN char e_invcmd[] INIT(= N_("E476: Invalid command"));
|
||||
#if defined(UNIX) || defined(FEAT_SYN_HL) || defined(FEAT_SPELL)
|
||||
EXTERN char e_isadir2[] INIT(= N_("E17: \"%s\" is a directory"));
|
||||
#endif
|
||||
+#ifdef FEAT_SPELL
|
||||
+EXTERN char e_no_spell[] INIT(= N_("E756: Spell checking is not possible"));
|
||||
+#endif
|
||||
#ifdef FEAT_LIBCALL
|
||||
EXTERN char e_libcall[] INIT(= N_("E364: Library call failed for \"%s()\""));
|
||||
#endif
|
||||
diff --git a/src/spell.c b/src/spell.c
|
||||
index 82ba756..1d7a1ae 100644
|
||||
--- a/src/spell.c
|
||||
+++ b/src/spell.c
|
||||
@@ -1225,7 +1225,7 @@ no_spell_checking(win_T *wp)
|
||||
if (!wp->w_p_spell || *wp->w_s->b_p_spl == NUL
|
||||
|| wp->w_s->b_langp.ga_len == 0)
|
||||
{
|
||||
- emsg(_("E756: Spell checking is not enabled"));
|
||||
+ emsg(_(e_no_spell));
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
diff --git a/src/spellsuggest.c b/src/spellsuggest.c
|
||||
index 379d9ba..1efb617 100644
|
||||
--- a/src/spellsuggest.c
|
||||
+++ b/src/spellsuggest.c
|
||||
@@ -471,9 +471,19 @@ spell_suggest(int count)
|
||||
int selected = count;
|
||||
int badlen = 0;
|
||||
int msg_scroll_save = msg_scroll;
|
||||
+ int wo_spell_save = curwin->w_p_spell;
|
||||
|
||||
- if (no_spell_checking(curwin))
|
||||
+ if (!curwin->w_p_spell)
|
||||
+ {
|
||||
+ did_set_spelllang(curwin);
|
||||
+ curwin->w_p_spell = TRUE;
|
||||
+ }
|
||||
+
|
||||
+ if (*curwin->w_s->b_p_spl == NUL)
|
||||
+ {
|
||||
+ emsg(_(e_no_spell));
|
||||
return;
|
||||
+ }
|
||||
|
||||
if (VIsual_active)
|
||||
{
|
||||
@@ -691,6 +701,7 @@ spell_suggest(int count)
|
||||
spell_find_cleanup(&sug);
|
||||
skip:
|
||||
vim_free(line);
|
||||
+ curwin->w_p_spell = wo_spell_save;
|
||||
}
|
||||
|
||||
/*
|
||||
diff --git a/src/testdir/test_spell.vim b/src/testdir/test_spell.vim
|
||||
index c7379d5..bc4f41d 100644
|
||||
--- a/src/testdir/test_spell.vim
|
||||
+++ b/src/testdir/test_spell.vim
|
||||
@@ -109,11 +109,14 @@ foobar/?
|
||||
set spelllang=Xwords.spl
|
||||
call assert_equal(['foobar', 'rare'], spellbadword('foo foobar'))
|
||||
|
||||
- " Typo should not be detected without the 'spell' option.
|
||||
+ " Typo should be detected even without the 'spell' option.
|
||||
set spelllang=en_gb nospell
|
||||
call assert_equal(['', ''], spellbadword('centre'))
|
||||
- call assert_equal(['', ''], spellbadword('My bycycle.'))
|
||||
- call assert_equal(['', ''], spellbadword('A sentence. another sentence'))
|
||||
+ call assert_equal(['bycycle', 'bad'], spellbadword('My bycycle.'))
|
||||
+ call assert_equal(['another', 'caps'], spellbadword('A sentence. another sentence'))
|
||||
+
|
||||
+ set spelllang=
|
||||
+ call assert_fails("call spellbadword('maxch')", 'E756:')
|
||||
|
||||
call delete('Xwords.spl')
|
||||
call delete('Xwords')
|
||||
@@ -452,6 +455,34 @@ func Test_zeq_crash()
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
+" Check that z= works even when 'nospell' is set. This test uses one of the
|
||||
+" tests in Test_spellsuggest_option_number() just to verify that z= basically
|
||||
+" works and that "E756: Spell checking is not enabled" is not generated.
|
||||
+func Test_zeq_nospell()
|
||||
+ new
|
||||
+ set nospell spellsuggest=1,best
|
||||
+ call setline(1, 'A baord')
|
||||
+ try
|
||||
+ norm $1z=
|
||||
+ call assert_equal('A board', getline(1))
|
||||
+ catch
|
||||
+ call assert_report("Caught exception: " . v:exception)
|
||||
+ endtry
|
||||
+ set spell& spellsuggest&
|
||||
+ bwipe!
|
||||
+endfunc
|
||||
+
|
||||
+" Check that "E756: Spell checking is not possible" is reported when z= is
|
||||
+" executed and 'spelllang' is empty.
|
||||
+func Test_zeq_no_spelllang()
|
||||
+ new
|
||||
+ set spelllang= spellsuggest=1,best
|
||||
+ call setline(1, 'A baord')
|
||||
+ call assert_fails('normal $1z=', 'E756:')
|
||||
+ set spelllang& spellsuggest&
|
||||
+ bwipe!
|
||||
+endfunc
|
||||
+
|
||||
" Check handling a word longer than MAXWLEN.
|
||||
func Test_spell_long_word()
|
||||
set enc=utf-8
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -0,0 +1,345 @@
|
||||
From 04db26b36000a4677b95403ec94bd11f6cc73975 Mon Sep 17 00:00:00 2001
|
||||
From: Bram Moolenaar <Bram@vim.org>
|
||||
Date: Mon, 5 Jul 2021 20:15:23 +0200
|
||||
Subject: [PATCH] patch 8.2.3110: a pattern that matches the cursor position is
|
||||
complicated
|
||||
|
||||
Problem: A pattern that matches the cursor position is bit complicated.
|
||||
Solution: Use a dot to indicate the cursor line and column. (Christian
|
||||
Brabandt, closes #8497, closes #8179)
|
||||
---
|
||||
runtime/doc/pattern.txt | 31 +++++++++--
|
||||
src/globals.h | 3 ++
|
||||
src/regexp_bt.c | 34 +++++++++++-
|
||||
src/regexp_nfa.c | 30 ++++++++++-
|
||||
src/testdir/test_regexp_latin.vim | 90 +++++++++++++++++++++++++++++++
|
||||
5 files changed, 182 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt
|
||||
index 7ba46e2..44fef3f 100644
|
||||
--- a/runtime/doc/pattern.txt
|
||||
+++ b/runtime/doc/pattern.txt
|
||||
@@ -922,13 +922,20 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on):
|
||||
\%23l Matches in a specific line.
|
||||
\%<23l Matches above a specific line (lower line number).
|
||||
\%>23l Matches below a specific line (higher line number).
|
||||
+\%.l Matches at the cursor line.
|
||||
+\%<.l Matches above the cursor line.
|
||||
+\%>.l Matches below the cursor line.
|
||||
These three can be used to match specific lines in a buffer. The "23"
|
||||
can be any line number. The first line is 1.
|
||||
WARNING: When inserting or deleting lines Vim does not automatically
|
||||
update the matches. This means Syntax highlighting quickly becomes
|
||||
- wrong.
|
||||
+ wrong. Also when refering to the cursor position (".") and
|
||||
+ the cursor moves the display isn't updated for this change. An update
|
||||
+ is done when using the |CTRL-L| command (the whole screen is updated).
|
||||
Example, to highlight the line where the cursor currently is: >
|
||||
- :exe '/\%' . line(".") . 'l.*'
|
||||
+ :exe '/\%' . line(".") . 'l'
|
||||
+< Alternatively use: >
|
||||
+ /\%.l
|
||||
< When 'hlsearch' is set and you move the cursor around and make changes
|
||||
this will clearly show when the match is updated or not.
|
||||
|
||||
@@ -936,15 +943,23 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on):
|
||||
\%23c Matches in a specific column.
|
||||
\%<23c Matches before a specific column.
|
||||
\%>23c Matches after a specific column.
|
||||
+\%.c Matches at the cursor column.
|
||||
+\%<.c Matches before the cursor column.
|
||||
+\%>.c Matches after the cursor column.
|
||||
These three can be used to match specific columns in a buffer or
|
||||
string. The "23" can be any column number. The first column is 1.
|
||||
Actually, the column is the byte number (thus it's not exactly right
|
||||
for multi-byte characters).
|
||||
WARNING: When inserting or deleting text Vim does not automatically
|
||||
update the matches. This means Syntax highlighting quickly becomes
|
||||
- wrong.
|
||||
+ wrong. Also when refering to the cursor position (".") and
|
||||
+ the cursor moves the display isn't updated for this change. An update
|
||||
+ is done when using the |CTRL-L| command (the whole screen is updated).
|
||||
+
|
||||
Example, to highlight the column where the cursor currently is: >
|
||||
:exe '/\%' . col(".") . 'c'
|
||||
+< Alternatively use: >
|
||||
+ /\%.c
|
||||
< When 'hlsearch' is set and you move the cursor around and make changes
|
||||
this will clearly show when the match is updated or not.
|
||||
Example for matching a single byte in column 44: >
|
||||
@@ -955,6 +970,9 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on):
|
||||
\%23v Matches in a specific virtual column.
|
||||
\%<23v Matches before a specific virtual column.
|
||||
\%>23v Matches after a specific virtual column.
|
||||
+\%.v Matches at the current virtual column.
|
||||
+\%<.v Matches before the current virtual column.
|
||||
+\%>.v Matches after the current virtual column.
|
||||
These three can be used to match specific virtual columns in a buffer
|
||||
or string. When not matching with a buffer in a window, the option
|
||||
values of the current window are used (e.g., 'tabstop').
|
||||
@@ -964,13 +982,18 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on):
|
||||
one screen character.
|
||||
WARNING: When inserting or deleting text Vim does not automatically
|
||||
update highlighted matches. This means Syntax highlighting quickly
|
||||
- becomes wrong.
|
||||
+ becomes wrong. Also when refering to the cursor position (".") and
|
||||
+ the cursor moves the display isn't updated for this change. An update
|
||||
+ is done when using the |CTRL-L| command (the whole screen is updated).
|
||||
Example, to highlight all the characters after virtual column 72: >
|
||||
/\%>72v.*
|
||||
< When 'hlsearch' is set and you move the cursor around and make changes
|
||||
this will clearly show when the match is updated or not.
|
||||
To match the text up to column 17: >
|
||||
/^.*\%17v
|
||||
+< To match all characters after the current virtual column (where the
|
||||
+ cursor is): >
|
||||
+ /\%>.v.*
|
||||
< Column 17 is not included, because this is a |/zero-width| match. To
|
||||
include the column use: >
|
||||
/^.*\%17v.
|
||||
diff --git a/src/globals.h b/src/globals.h
|
||||
index c1bb9b2..3067cfa 100644
|
||||
--- a/src/globals.h
|
||||
+++ b/src/globals.h
|
||||
@@ -1761,3 +1761,6 @@ EXTERN char e_illegal_character_in_word[]
|
||||
|
||||
EXTERN char e_command_too_recursive[]
|
||||
INIT(= N_("E169: Command too recursive"));
|
||||
+
|
||||
+EXTERN char e_regexp_number_after_dot_pos_search[]
|
||||
+ INIT(= N_("E1204: No Number allowed after .: '\\%%%c'"));
|
||||
diff --git a/src/regexp_bt.c b/src/regexp_bt.c
|
||||
index ff92576..58a3ae1 100644
|
||||
--- a/src/regexp_bt.c
|
||||
+++ b/src/regexp_bt.c
|
||||
@@ -1462,14 +1462,20 @@ regatom(int *flagp)
|
||||
|
||||
default:
|
||||
if (VIM_ISDIGIT(c) || c == '<' || c == '>'
|
||||
- || c == '\'')
|
||||
+ || c == '\'' || c == '.')
|
||||
{
|
||||
long_u n = 0;
|
||||
int cmp;
|
||||
+ int cur = FALSE;
|
||||
|
||||
cmp = c;
|
||||
if (cmp == '<' || cmp == '>')
|
||||
c = getchr();
|
||||
+ if (no_Magic(c) == '.')
|
||||
+ {
|
||||
+ cur = TRUE;
|
||||
+ c = getchr();
|
||||
+ }
|
||||
while (VIM_ISDIGIT(c))
|
||||
{
|
||||
n = n * 10 + (c - '0');
|
||||
@@ -1491,16 +1497,42 @@ regatom(int *flagp)
|
||||
}
|
||||
else if (c == 'l' || c == 'c' || c == 'v')
|
||||
{
|
||||
+ if (cur && n)
|
||||
+ {
|
||||
+ semsg(_(e_regexp_number_after_dot_pos_search), no_Magic(c));
|
||||
+ rc_did_emsg = TRUE;
|
||||
+ return NULL;
|
||||
+ }
|
||||
if (c == 'l')
|
||||
{
|
||||
+ if (cur)
|
||||
+ n = curwin->w_cursor.lnum;
|
||||
ret = regnode(RE_LNUM);
|
||||
if (save_prev_at_start)
|
||||
at_start = TRUE;
|
||||
}
|
||||
else if (c == 'c')
|
||||
+ {
|
||||
+ if (cur)
|
||||
+ {
|
||||
+ n = curwin->w_cursor.col;
|
||||
+ n++;
|
||||
+ }
|
||||
ret = regnode(RE_COL);
|
||||
+ }
|
||||
else
|
||||
+ {
|
||||
+ if (cur)
|
||||
+ {
|
||||
+ colnr_T vcol = 0;
|
||||
+
|
||||
+ getvvcol(curwin, &curwin->w_cursor,
|
||||
+ NULL, NULL, &vcol);
|
||||
+ ++vcol;
|
||||
+ n = vcol;
|
||||
+ }
|
||||
ret = regnode(RE_VCOL);
|
||||
+ }
|
||||
if (ret == JUST_CALC_SIZE)
|
||||
regsize += 5;
|
||||
else
|
||||
diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c
|
||||
index a5526b1..86e0140 100644
|
||||
--- a/src/regexp_nfa.c
|
||||
+++ b/src/regexp_nfa.c
|
||||
@@ -1544,12 +1544,23 @@ nfa_regatom(void)
|
||||
{
|
||||
long_u n = 0;
|
||||
int cmp = c;
|
||||
+ int cur = FALSE;
|
||||
|
||||
if (c == '<' || c == '>')
|
||||
c = getchr();
|
||||
+ if (no_Magic(c) == '.')
|
||||
+ {
|
||||
+ cur = TRUE;
|
||||
+ c = getchr();
|
||||
+ }
|
||||
while (VIM_ISDIGIT(c))
|
||||
{
|
||||
- long_u tmp = n * 10 + (c - '0');
|
||||
+ long_u tmp;
|
||||
+
|
||||
+ if (cur)
|
||||
+ semsg(_(e_regexp_number_after_dot_pos_search),
|
||||
+ no_Magic(c));
|
||||
+ tmp = n * 10 + (c - '0');
|
||||
|
||||
if (tmp < n)
|
||||
{
|
||||
@@ -1566,6 +1577,8 @@ nfa_regatom(void)
|
||||
|
||||
if (c == 'l')
|
||||
{
|
||||
+ if (cur)
|
||||
+ n = curwin->w_cursor.lnum;
|
||||
// \%{n}l \%{n}<l \%{n}>l
|
||||
EMIT(cmp == '<' ? NFA_LNUM_LT :
|
||||
cmp == '>' ? NFA_LNUM_GT : NFA_LNUM);
|
||||
@@ -1573,11 +1586,26 @@ nfa_regatom(void)
|
||||
at_start = TRUE;
|
||||
}
|
||||
else if (c == 'c')
|
||||
+ {
|
||||
+ if (cur)
|
||||
+ {
|
||||
+ n = curwin->w_cursor.col;
|
||||
+ n++;
|
||||
+ }
|
||||
// \%{n}c \%{n}<c \%{n}>c
|
||||
EMIT(cmp == '<' ? NFA_COL_LT :
|
||||
cmp == '>' ? NFA_COL_GT : NFA_COL);
|
||||
+ }
|
||||
else
|
||||
{
|
||||
+ if (cur)
|
||||
+ {
|
||||
+ colnr_T vcol = 0;
|
||||
+
|
||||
+ getvvcol(curwin, &curwin->w_cursor,
|
||||
+ NULL, NULL, &vcol);
|
||||
+ n = ++vcol;
|
||||
+ }
|
||||
// \%{n}v \%{n}<v \%{n}>v
|
||||
EMIT(cmp == '<' ? NFA_VCOL_LT :
|
||||
cmp == '>' ? NFA_VCOL_GT : NFA_VCOL);
|
||||
diff --git a/src/testdir/test_regexp_latin.vim b/src/testdir/test_regexp_latin.vim
|
||||
index b668f87..9232d2a 100644
|
||||
--- a/src/testdir/test_regexp_latin.vim
|
||||
+++ b/src/testdir/test_regexp_latin.vim
|
||||
@@ -184,3 +184,93 @@ func Test_recursive_substitute_expr()
|
||||
delfunc Repl
|
||||
endfunc
|
||||
|
||||
+" Check patterns matching cursor position.
|
||||
+func s:curpos_test2()
|
||||
+ new
|
||||
+ call setline(1, ['1', '2 foobar eins zwei drei vier fünf sechse',
|
||||
+ \ '3 foobar eins zwei drei vier fünf sechse',
|
||||
+ \ '4 foobar eins zwei drei vier fünf sechse',
|
||||
+ \ '5 foobar eins zwei drei vier fünf sechse',
|
||||
+ \ '6 foobar eins zwei drei vier fünf sechse',
|
||||
+ \ '7 foobar eins zwei drei vier fünf sechse'])
|
||||
+ call setpos('.', [0, 2, 10, 0])
|
||||
+ s/\%.c.*//g
|
||||
+ call setpos('.', [0, 3, 15, 0])
|
||||
+ s/\%.l.*//g
|
||||
+ call setpos('.', [0, 5, 3, 0])
|
||||
+ s/\%.v.*/_/g
|
||||
+ call assert_equal(['1',
|
||||
+ \ '2 foobar ',
|
||||
+ \ '',
|
||||
+ \ '4 foobar eins zwei drei vier fünf sechse',
|
||||
+ \ '5 _',
|
||||
+ \ '6 foobar eins zwei drei vier fünf sechse',
|
||||
+ \ '7 foobar eins zwei drei vier fünf sechse'],
|
||||
+ \ getline(1, '$'))
|
||||
+ call assert_fails('call search("\\%.1l")', 'E1204:')
|
||||
+ call assert_fails('call search("\\%.1c")', 'E1204:')
|
||||
+ call assert_fails('call search("\\%.1v")', 'E1204:')
|
||||
+ bwipe!
|
||||
+endfunc
|
||||
+
|
||||
+" Check patterns matching before or after cursor position.
|
||||
+func s:curpos_test3()
|
||||
+ new
|
||||
+ call setline(1, ['1', '2 foobar eins zwei drei vier fünf sechse',
|
||||
+ \ '3 foobar eins zwei drei vier fünf sechse',
|
||||
+ \ '4 foobar eins zwei drei vier fünf sechse',
|
||||
+ \ '5 foobar eins zwei drei vier fünf sechse',
|
||||
+ \ '6 foobar eins zwei drei vier fünf sechse',
|
||||
+ \ '7 foobar eins zwei drei vier fünf sechse'])
|
||||
+ call setpos('.', [0, 2, 10, 0])
|
||||
+ " Note: This removes all columns, except for the column directly in front of
|
||||
+ " the cursor. Bug????
|
||||
+ :s/^.*\%<.c//
|
||||
+ call setpos('.', [0, 3, 10, 0])
|
||||
+ :s/\%>.c.*$//
|
||||
+ call setpos('.', [0, 5, 4, 0])
|
||||
+ " Note: This removes all columns, except for the column directly in front of
|
||||
+ " the cursor. Bug????
|
||||
+ :s/^.*\%<.v/_/
|
||||
+ call setpos('.', [0, 6, 4, 0])
|
||||
+ :s/\%>.v.*$/_/
|
||||
+
|
||||
+ call assert_equal(['1',
|
||||
+ \ ' eins zwei drei vier fünf sechse',
|
||||
+ \ '3 foobar e',
|
||||
+ \ '4 foobar eins zwei drei vier fünf sechse',
|
||||
+ \ '_foobar eins zwei drei vier fünf sechse',
|
||||
+ \ '6 fo_',
|
||||
+ \ '7 foobar eins zwei drei vier fünf sechse'],
|
||||
+ \ getline(1, '$'))
|
||||
+ sil %d
|
||||
+ call setline(1, ['1', '2 foobar eins zwei drei vier fünf sechse',
|
||||
+ \ '3 foobar eins zwei drei vier fünf sechse',
|
||||
+ \ '4 foobar eins zwei drei vier fünf sechse',
|
||||
+ \ '5 foobar eins zwei drei vier fünf sechse',
|
||||
+ \ '6 foobar eins zwei drei vier fünf sechse',
|
||||
+ \ '7 foobar eins zwei drei vier fünf sechse'])
|
||||
+ call setpos('.', [0, 4, 4, 0])
|
||||
+ %s/\%<.l.*//
|
||||
+ call setpos('.', [0, 5, 4, 0])
|
||||
+ %s/\%>.l.*//
|
||||
+ call assert_equal(['', '', '',
|
||||
+ \ '4 foobar eins zwei drei vier fünf sechse',
|
||||
+ \ '5 foobar eins zwei drei vier fünf sechse',
|
||||
+ \ '', ''],
|
||||
+ \ getline(1, '$'))
|
||||
+ bwipe!
|
||||
+endfunc
|
||||
+
|
||||
+" Test that matching below, at or after the
|
||||
+" cursor position work
|
||||
+func Test_matching_pos()
|
||||
+ for val in range(3)
|
||||
+ exe "set re=" .. val
|
||||
+ " Match at cursor position
|
||||
+ call s:curpos_test2()
|
||||
+ " Match before or after cursor position
|
||||
+ call s:curpos_test3()
|
||||
+ endfor
|
||||
+ set re&
|
||||
+endfunc
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
From fc6ccebea668c49e9e617e0657421b6a8ed9df1e Mon Sep 17 00:00:00 2001
|
||||
From: Bram Moolenaar <Bram@vim.org>
|
||||
Date: Thu, 20 Jan 2022 12:22:35 +0000
|
||||
Subject: [PATCH] patch 8.2.4152: block insert with double wide character fails
|
||||
|
||||
Problem: Block insert with double wide character fails.
|
||||
Solution: Adjust the expected output.
|
||||
---
|
||||
src/testdir/test_utf8.vim | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/testdir/test_utf8.vim b/src/testdir/test_utf8.vim
|
||||
index 42a46fd..32cec0f 100644
|
||||
--- a/src/testdir/test_utf8.vim
|
||||
+++ b/src/testdir/test_utf8.vim
|
||||
@@ -7,7 +7,7 @@ func Test_visual_block_insert()
|
||||
new
|
||||
call setline(1, ["aaa", "あああ", "bbb"])
|
||||
exe ":norm! gg0l\<C-V>jjIx\<Esc>"
|
||||
- call assert_equal(['axaa', 'xあああ', 'bxbb'], getline(1, '$'))
|
||||
+ call assert_equal(['axaa', ' xあああ', 'bxbb'], getline(1, '$'))
|
||||
bwipeout!
|
||||
endfunc
|
||||
|
||||
--
|
||||
2.33.0
|
||||
|
||||
46
openEuler-fix-test87-failed.patch
Normal file
46
openEuler-fix-test87-failed.patch
Normal file
@ -0,0 +1,46 @@
|
||||
From bac247b1f2043aaafb2aa618cd2b767545c5ece4 Mon Sep 17 00:00:00 2001
|
||||
From: wangjiang <wangjiang37@h-partners.com>
|
||||
Date: Wed, 31 Aug 2022 10:33:35 +0800
|
||||
Subject: [PATCH] fix test87 failed
|
||||
|
||||
---
|
||||
src/testdir/test87.ok | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/testdir/test87.ok b/src/testdir/test87.ok
|
||||
index 7ddea8f..00902f6 100644
|
||||
--- a/src/testdir/test87.ok
|
||||
+++ b/src/testdir/test87.ok
|
||||
@@ -672,7 +672,7 @@ vim.command(1):(<class 'TypeError'>, TypeError('expected bytes() or str() instan
|
||||
vim.command(b"\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',))
|
||||
vim.command("\0"):(<class 'TypeError'>, TypeError('expected bytes with no null',))
|
||||
<<< Finished
|
||||
-vim.command("", 2):(<class 'TypeError'>, TypeError('command() takes exactly one argument (2 given)',))
|
||||
+vim.command("", 2):(<class 'TypeError'>, TypeError('vim.command() takes exactly one argument (2 given)',))
|
||||
> VimToPython
|
||||
> VimEval
|
||||
>>> Testing StringToChars using vim.eval(%s)
|
||||
@@ -698,7 +698,7 @@ vim.strwidth("\0"):(<class 'TypeError'>, TypeError('expected bytes with no null'
|
||||
vim.foreach_rtp(None):(<class 'TypeError'>, TypeError("'NoneType' object is not callable",))
|
||||
vim.foreach_rtp(NoArgsCall()):(<class 'TypeError'>, TypeError('__call__() takes exactly 1 positional argument (2 given)',))
|
||||
vim.foreach_rtp(FailingCall()):(<class 'NotImplementedError'>, NotImplementedError('call',))
|
||||
-vim.foreach_rtp(int, 2):(<class 'TypeError'>, TypeError('foreach_rtp() takes exactly one argument (2 given)',))
|
||||
+vim.foreach_rtp(int, 2):(<class 'TypeError'>, TypeError('vim.foreach_rtp() takes exactly one argument (2 given)',))
|
||||
> import
|
||||
import xxx_no_such_module_xxx:(<class 'ImportError'>, ImportError('No module named xxx_no_such_module_xxx',))
|
||||
import failing_import:(<class 'ImportError'>, ImportError())
|
||||
@@ -962,9 +962,9 @@ d.update((("a", FailingMappingKey()),)):(<class 'NotImplementedError'>, NotImple
|
||||
d.update((("a", FailingNumber()),)):(<class 'NotImplementedError'>, NotImplementedError('int',))
|
||||
<<< Finished
|
||||
>> DictionaryPopItem
|
||||
-d.popitem(1, 2):(<class 'TypeError'>, TypeError('popitem() takes no arguments (2 given)',))
|
||||
+d.popitem(1, 2):(<class 'TypeError'>, TypeError('dictionary.popitem() takes no arguments (2 given)',))
|
||||
>> DictionaryHasKey
|
||||
-d.has_key():(<class 'TypeError'>, TypeError('has_key() takes exactly one argument (0 given)',))
|
||||
+d.has_key():(<class 'TypeError'>, TypeError('dictionary.has_key() takes exactly one argument (0 given)',))
|
||||
> List
|
||||
>> ListConstructor
|
||||
vim.List(1, 2):(<class 'TypeError'>, TypeError('function takes at most 1 argument (2 given)',))
|
||||
--
|
||||
2.33.0
|
||||
|
||||
779
openEuler-remove-failed-tests-due-to-patch.patch
Normal file
779
openEuler-remove-failed-tests-due-to-patch.patch
Normal file
@ -0,0 +1,779 @@
|
||||
From ca7a7ce78d3c12d4c9ed458a7c67866be60aabe8 Mon Sep 17 00:00:00 2001
|
||||
From: wangshouping <wangshouping@huawei.com>
|
||||
Date: Sat, 6 Mar 2021 20:55:26 +0800
|
||||
Subject: [PATCH] remove test cases of failure due to patch
|
||||
|
||||
reason: Remove test cases of failure due to vim-7.4-syntax.patch/
|
||||
vim-8.0-copy-paste.patch/vim-7.4-syncolor.patch.
|
||||
|
||||
Signed-off-by: wangshouping <wangshouping@huawei.com>
|
||||
---
|
||||
src/testdir/test_balloon.vim | 47 ----
|
||||
src/testdir/test_diffmode.vim | 181 ----------------
|
||||
src/testdir/test_filetype.vim | 9 -
|
||||
src/testdir/test_popupwin.vim | 285 -------------------------
|
||||
src/testdir/test_popupwin_textprop.vim | 166 --------------
|
||||
5 files changed, 688 deletions(-)
|
||||
|
||||
diff --git a/src/testdir/test_balloon.vim b/src/testdir/test_balloon.vim
|
||||
index f32b73c..b7d1a15 100644
|
||||
--- a/src/testdir/test_balloon.vim
|
||||
+++ b/src/testdir/test_balloon.vim
|
||||
@@ -17,50 +17,3 @@ let s:common_script =<< trim [CODE]
|
||||
redraw
|
||||
[CODE]
|
||||
|
||||
-func Test_balloon_eval_term()
|
||||
- " Use <Ignore> after <MouseMove> to return from vgetc() without removing
|
||||
- " the balloon.
|
||||
- let xtra_lines =<< trim [CODE]
|
||||
- set updatetime=300
|
||||
- au CursorHold * echo 'hold fired'
|
||||
- func Trigger()
|
||||
- call test_setmouse(2, 6)
|
||||
- call feedkeys("\<MouseMove>\<Ignore>", "xt")
|
||||
- endfunc
|
||||
- [CODE]
|
||||
- call writefile(s:common_script + xtra_lines, 'XTest_beval')
|
||||
-
|
||||
- " Check that the balloon shows up after a mouse move
|
||||
- let buf = RunVimInTerminal('-S XTest_beval', {'rows': 10, 'cols': 50})
|
||||
- call term_wait(buf, 100)
|
||||
- call term_sendkeys(buf, 'll')
|
||||
- call term_sendkeys(buf, ":call Trigger()\<CR>")
|
||||
- call VerifyScreenDump(buf, 'Test_balloon_eval_term_01', {})
|
||||
-
|
||||
- " Make sure the balloon still shows after 'updatetime' passed and CursorHold
|
||||
- " was triggered.
|
||||
- call term_wait(buf, 300)
|
||||
- call VerifyScreenDump(buf, 'Test_balloon_eval_term_01a', {})
|
||||
-
|
||||
- " clean up
|
||||
- call StopVimInTerminal(buf)
|
||||
- call delete('XTest_beval')
|
||||
-endfunc
|
||||
-
|
||||
-func Test_balloon_eval_term_visual()
|
||||
- " Use <Ignore> after <MouseMove> to return from vgetc() without removing
|
||||
- " the balloon.
|
||||
- call writefile(s:common_script + [
|
||||
- \ 'call test_setmouse(3, 6)',
|
||||
- \ 'call feedkeys("3Gevfr\<MouseMove>\<Ignore>", "xt")',
|
||||
- \ ], 'XTest_beval_visual')
|
||||
-
|
||||
- " Check that the balloon shows up after a mouse move
|
||||
- let buf = RunVimInTerminal('-S XTest_beval_visual', {'rows': 10, 'cols': 50})
|
||||
- call term_wait(buf, 100)
|
||||
- call VerifyScreenDump(buf, 'Test_balloon_eval_term_02', {})
|
||||
-
|
||||
- " clean up
|
||||
- call StopVimInTerminal(buf)
|
||||
- call delete('XTest_beval_visual')
|
||||
-endfunc
|
||||
diff --git a/src/testdir/test_diffmode.vim b/src/testdir/test_diffmode.vim
|
||||
index 9dfe2fe..61edbe2 100644
|
||||
--- a/src/testdir/test_diffmode.vim
|
||||
+++ b/src/testdir/test_diffmode.vim
|
||||
@@ -749,163 +749,6 @@ func VerifyInternal(buf, dumpfile, extra)
|
||||
call VerifyScreenDump(a:buf, a:dumpfile, {})
|
||||
endfunc
|
||||
|
||||
-func Test_diff_screen()
|
||||
- CheckScreendump
|
||||
- CheckFeature menu
|
||||
-
|
||||
- " clean up already existing swap files, just in case
|
||||
- call delete('.Xfile1.swp')
|
||||
- call delete('.Xfile2.swp')
|
||||
-
|
||||
- " Test 1: Add a line in beginning of file 2
|
||||
- call WriteDiffFiles(0, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
|
||||
- let buf = RunVimInTerminal('-d Xfile1 Xfile2', {})
|
||||
- " Set autoread mode, so that Vim won't complain once we re-write the test
|
||||
- " files
|
||||
- call term_sendkeys(buf, ":set autoread\<CR>\<c-w>w:set autoread\<CR>\<c-w>w")
|
||||
-
|
||||
- call VerifyBoth(buf, 'Test_diff_01', '')
|
||||
-
|
||||
- " Test 2: Add a line in beginning of file 1
|
||||
- call WriteDiffFiles(buf, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
|
||||
- call VerifyBoth(buf, 'Test_diff_02', '')
|
||||
-
|
||||
- " Test 3: Add a line at the end of file 2
|
||||
- call WriteDiffFiles(buf, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])
|
||||
- call VerifyBoth(buf, 'Test_diff_03', '')
|
||||
-
|
||||
- " Test 4: Add a line at the end of file 1
|
||||
- call WriteDiffFiles(buf, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
|
||||
- call VerifyBoth(buf, 'Test_diff_04', '')
|
||||
-
|
||||
- " Test 5: Add a line in the middle of file 2, remove on at the end of file 1
|
||||
- call WriteDiffFiles(buf, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 10])
|
||||
- call VerifyBoth(buf, 'Test_diff_05', '')
|
||||
-
|
||||
- " Test 6: Add a line in the middle of file 1, remove on at the end of file 2
|
||||
- call WriteDiffFiles(buf, [1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])
|
||||
- call VerifyBoth(buf, 'Test_diff_06', '')
|
||||
-
|
||||
- " Variants on test 6 with different context settings
|
||||
- call term_sendkeys(buf, ":set diffopt+=context:2\<cr>")
|
||||
- call VerifyScreenDump(buf, 'Test_diff_06.2', {})
|
||||
- call term_sendkeys(buf, ":set diffopt-=context:2\<cr>")
|
||||
- call term_sendkeys(buf, ":set diffopt+=context:1\<cr>")
|
||||
- call VerifyScreenDump(buf, 'Test_diff_06.1', {})
|
||||
- call term_sendkeys(buf, ":set diffopt-=context:1\<cr>")
|
||||
- call term_sendkeys(buf, ":set diffopt+=context:0\<cr>")
|
||||
- call VerifyScreenDump(buf, 'Test_diff_06.0', {})
|
||||
- call term_sendkeys(buf, ":set diffopt-=context:0\<cr>")
|
||||
-
|
||||
- " Test 7 - 9: Test normal/patience/histogram diff algorithm
|
||||
- call WriteDiffFiles(buf, ['#include <stdio.h>', '', '// Frobs foo heartily', 'int frobnitz(int foo)', '{',
|
||||
- \ ' int i;', ' for(i = 0; i < 10; i++)', ' {', ' printf("Your answer is: ");',
|
||||
- \ ' printf("%d\n", foo);', ' }', '}', '', 'int fact(int n)', '{', ' if(n > 1)', ' {',
|
||||
- \ ' return fact(n-1) * n;', ' }', ' return 1;', '}', '', 'int main(int argc, char **argv)',
|
||||
- \ '{', ' frobnitz(fact(10));', '}'],
|
||||
- \ ['#include <stdio.h>', '', 'int fib(int n)', '{', ' if(n > 2)', ' {',
|
||||
- \ ' return fib(n-1) + fib(n-2);', ' }', ' return 1;', '}', '', '// Frobs foo heartily',
|
||||
- \ 'int frobnitz(int foo)', '{', ' int i;', ' for(i = 0; i < 10; i++)', ' {',
|
||||
- \ ' printf("%d\n", foo);', ' }', '}', '',
|
||||
- \ 'int main(int argc, char **argv)', '{', ' frobnitz(fib(10));', '}'])
|
||||
- call term_sendkeys(buf, ":diffupdate!\<cr>")
|
||||
- call term_sendkeys(buf, ":set diffopt+=internal\<cr>")
|
||||
- call VerifyScreenDump(buf, 'Test_diff_07', {})
|
||||
-
|
||||
- call term_sendkeys(buf, ":set diffopt+=algorithm:patience\<cr>")
|
||||
- call VerifyScreenDump(buf, 'Test_diff_08', {})
|
||||
-
|
||||
- call term_sendkeys(buf, ":set diffopt+=algorithm:histogram\<cr>")
|
||||
- call VerifyScreenDump(buf, 'Test_diff_09', {})
|
||||
-
|
||||
- " Test 10-11: normal/indent-heuristic
|
||||
- call term_sendkeys(buf, ":set diffopt&vim\<cr>")
|
||||
- call WriteDiffFiles(buf, ['', ' def finalize(values)', '', ' values.each do |v|', ' v.finalize', ' end'],
|
||||
- \ ['', ' def finalize(values)', '', ' values.each do |v|', ' v.prepare', ' end', '',
|
||||
- \ ' values.each do |v|', ' v.finalize', ' end'])
|
||||
- call term_sendkeys(buf, ":diffupdate!\<cr>")
|
||||
- call term_sendkeys(buf, ":set diffopt+=internal\<cr>")
|
||||
- call VerifyScreenDump(buf, 'Test_diff_10', {})
|
||||
-
|
||||
- " Leave trailing : at commandline!
|
||||
- call term_sendkeys(buf, ":set diffopt+=indent-heuristic\<cr>:\<cr>")
|
||||
- call VerifyScreenDump(buf, 'Test_diff_11', {}, 'one')
|
||||
- " shouldn't matter, if indent-algorithm comes before or after the algorithm
|
||||
- call term_sendkeys(buf, ":set diffopt&\<cr>")
|
||||
- call term_sendkeys(buf, ":set diffopt+=indent-heuristic,algorithm:patience\<cr>:\<cr>")
|
||||
- call VerifyScreenDump(buf, 'Test_diff_11', {}, 'two')
|
||||
- call term_sendkeys(buf, ":set diffopt&\<cr>")
|
||||
- call term_sendkeys(buf, ":set diffopt+=algorithm:patience,indent-heuristic\<cr>:\<cr>")
|
||||
- call VerifyScreenDump(buf, 'Test_diff_11', {}, 'three')
|
||||
-
|
||||
- " Test 12: diff the same file
|
||||
- call WriteDiffFiles(buf, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
|
||||
- call VerifyBoth(buf, 'Test_diff_12', '')
|
||||
-
|
||||
- " Test 13: diff an empty file
|
||||
- call WriteDiffFiles(buf, [], [])
|
||||
- call VerifyBoth(buf, 'Test_diff_13', '')
|
||||
-
|
||||
- " Test 14: test diffopt+=icase
|
||||
- call WriteDiffFiles(buf, ['a', 'b', 'cd'], ['A', 'b', 'cDe'])
|
||||
- call VerifyBoth(buf, 'Test_diff_14', " diffopt+=filler diffopt+=icase")
|
||||
-
|
||||
- " Test 15-16: test diffopt+=iwhite
|
||||
- call WriteDiffFiles(buf, ['int main()', '{', ' printf("Hello, World!");', ' return 0;', '}'],
|
||||
- \ ['int main()', '{', ' if (0)', ' {', ' printf("Hello, World!");', ' return 0;', ' }', '}'])
|
||||
- call term_sendkeys(buf, ":diffupdate!\<cr>")
|
||||
- call term_sendkeys(buf, ":set diffopt&vim diffopt+=filler diffopt+=iwhite\<cr>")
|
||||
- call VerifyScreenDump(buf, 'Test_diff_15', {})
|
||||
- call term_sendkeys(buf, ":set diffopt+=internal\<cr>")
|
||||
- call VerifyScreenDump(buf, 'Test_diff_16', {})
|
||||
-
|
||||
- " Test 17: test diffopt+=iblank
|
||||
- call WriteDiffFiles(buf, ['a', ' ', 'cd', 'ef', 'xxx'], ['a', 'cd', '', 'ef', 'yyy'])
|
||||
- call VerifyInternal(buf, 'Test_diff_17', " diffopt+=iblank")
|
||||
-
|
||||
- " Test 18: test diffopt+=iblank,iwhite / iwhiteall / iwhiteeol
|
||||
- call VerifyInternal(buf, 'Test_diff_18', " diffopt+=iblank,iwhite")
|
||||
- call VerifyInternal(buf, 'Test_diff_18', " diffopt+=iblank,iwhiteall")
|
||||
- call VerifyInternal(buf, 'Test_diff_18', " diffopt+=iblank,iwhiteeol")
|
||||
-
|
||||
- " Test 19: test diffopt+=iwhiteeol
|
||||
- call WriteDiffFiles(buf, ['a ', 'x', 'cd', 'ef', 'xx xx', 'foo', 'bar'], ['a', 'x', 'c d', ' ef', 'xx xx', 'foo', '', 'bar'])
|
||||
- call VerifyInternal(buf, 'Test_diff_19', " diffopt+=iwhiteeol")
|
||||
-
|
||||
- " Test 19: test diffopt+=iwhiteall
|
||||
- call VerifyInternal(buf, 'Test_diff_20', " diffopt+=iwhiteall")
|
||||
-
|
||||
- " clean up
|
||||
- call StopVimInTerminal(buf)
|
||||
- call delete('Xfile1')
|
||||
- call delete('Xfile2')
|
||||
-endfunc
|
||||
-
|
||||
-func Test_diff_with_cursorline()
|
||||
- CheckScreendump
|
||||
-
|
||||
- call writefile([
|
||||
- \ 'hi CursorLine ctermbg=red ctermfg=white',
|
||||
- \ 'set cursorline',
|
||||
- \ 'call setline(1, ["foo","foo","foo","bar"])',
|
||||
- \ 'vnew',
|
||||
- \ 'call setline(1, ["bee","foo","foo","baz"])',
|
||||
- \ 'windo diffthis',
|
||||
- \ '2wincmd w',
|
||||
- \ ], 'Xtest_diff_cursorline')
|
||||
- let buf = RunVimInTerminal('-S Xtest_diff_cursorline', {})
|
||||
-
|
||||
- call VerifyScreenDump(buf, 'Test_diff_with_cursorline_01', {})
|
||||
- call term_sendkeys(buf, "j")
|
||||
- call VerifyScreenDump(buf, 'Test_diff_with_cursorline_02', {})
|
||||
- call term_sendkeys(buf, "j")
|
||||
- call VerifyScreenDump(buf, 'Test_diff_with_cursorline_03', {})
|
||||
-
|
||||
- " clean up
|
||||
- call StopVimInTerminal(buf)
|
||||
- call delete('Xtest_diff_cursorline')
|
||||
-endfunc
|
||||
-
|
||||
func Test_diff_with_syntax()
|
||||
CheckScreendump
|
||||
|
||||
@@ -942,30 +785,6 @@ func Test_diff_with_syntax()
|
||||
call delete('Xprogram2.c')
|
||||
endfunc
|
||||
|
||||
-func Test_diff_of_diff()
|
||||
- CheckScreendump
|
||||
- CheckFeature rightleft
|
||||
-
|
||||
- call writefile([
|
||||
- \ 'call setline(1, ["aa","bb","cc","@@ -3,2 +5,7 @@","dd","ee","ff"])',
|
||||
- \ 'vnew',
|
||||
- \ 'call setline(1, ["aa","bb","cc"])',
|
||||
- \ 'windo diffthis',
|
||||
- \ '1wincmd w',
|
||||
- \ 'setlocal number',
|
||||
- \ ], 'Xtest_diff_diff')
|
||||
- let buf = RunVimInTerminal('-S Xtest_diff_diff', {})
|
||||
-
|
||||
- call VerifyScreenDump(buf, 'Test_diff_of_diff_01', {})
|
||||
-
|
||||
- call term_sendkeys(buf, ":set rightleft\<cr>")
|
||||
- call VerifyScreenDump(buf, 'Test_diff_of_diff_02', {})
|
||||
-
|
||||
- " clean up
|
||||
- call StopVimInTerminal(buf)
|
||||
- call delete('Xtest_diff_diff')
|
||||
-endfunc
|
||||
-
|
||||
func CloseoffSetup()
|
||||
enew
|
||||
call setline(1, ['one', 'two', 'three'])
|
||||
diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim
|
||||
index 31357e7..15cd11a 100644
|
||||
--- a/src/testdir/test_filetype.vim
|
||||
+++ b/src/testdir/test_filetype.vim
|
||||
@@ -538,15 +538,6 @@ func CheckItems(checks)
|
||||
endfor
|
||||
endfunc
|
||||
|
||||
-func Test_filetype_detection()
|
||||
- filetype on
|
||||
- call CheckItems(s:filename_checks)
|
||||
- if has('fname_case')
|
||||
- call CheckItems(s:filename_case_checks)
|
||||
- endif
|
||||
- filetype off
|
||||
-endfunc
|
||||
-
|
||||
" Filetypes detected from the file contents by scripts.vim
|
||||
let s:script_checks = {
|
||||
\ 'virata': [['% Virata'],
|
||||
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
|
||||
index d5ee716..43e6028 100644
|
||||
--- a/src/testdir/test_popupwin.vim
|
||||
+++ b/src/testdir/test_popupwin.vim
|
||||
@@ -519,122 +519,6 @@ func Test_popup_noscrolloff()
|
||||
call popup_close(winid)
|
||||
endfunc
|
||||
|
||||
-func Test_popup_drag()
|
||||
- CheckScreendump
|
||||
-
|
||||
- " create a popup that covers the command line
|
||||
- let lines =<< trim END
|
||||
- call setline(1, range(1, 20))
|
||||
- split
|
||||
- vsplit
|
||||
- $wincmd w
|
||||
- vsplit
|
||||
- 1wincmd w
|
||||
- let winid = popup_create(['1111', '222222', '33333'], #{
|
||||
- \ drag: 1,
|
||||
- \ resize: 1,
|
||||
- \ border: [],
|
||||
- \ line: &lines - 4,
|
||||
- \ })
|
||||
- func Dragit()
|
||||
- call feedkeys("\<F3>\<LeftMouse>\<F4>\<LeftDrag>\<LeftRelease>", "xt")
|
||||
- endfunc
|
||||
- map <silent> <F3> :call test_setmouse(&lines - 4, &columns / 2)<CR>
|
||||
- map <silent> <F4> :call test_setmouse(&lines - 8, &columns / 2 - 20)<CR>
|
||||
- func Resize()
|
||||
- call feedkeys("\<F5>\<LeftMouse>\<F6>\<LeftDrag>\<LeftRelease>", "xt")
|
||||
- endfunc
|
||||
- map <silent> <F5> :call test_setmouse(6, 21)<CR>
|
||||
- map <silent> <F6> :call test_setmouse(7, 25)<CR>
|
||||
- END
|
||||
- call writefile(lines, 'XtestPopupDrag')
|
||||
- let buf = RunVimInTerminal('-S XtestPopupDrag', #{rows: 10})
|
||||
- call VerifyScreenDump(buf, 'Test_popupwin_drag_01', {})
|
||||
-
|
||||
- call term_sendkeys(buf, ":call Dragit()\<CR>")
|
||||
- call VerifyScreenDump(buf, 'Test_popupwin_drag_02', {})
|
||||
-
|
||||
- call term_sendkeys(buf, ":call Resize()\<CR>")
|
||||
- call VerifyScreenDump(buf, 'Test_popupwin_drag_03', {})
|
||||
-
|
||||
- " clean up
|
||||
- call StopVimInTerminal(buf)
|
||||
- call delete('XtestPopupDrag')
|
||||
-endfunc
|
||||
-
|
||||
-func Test_popup_close_with_mouse()
|
||||
- CheckScreendump
|
||||
-
|
||||
- let lines =<< trim END
|
||||
- call setline(1, range(1, 20))
|
||||
- " With border, can click on X
|
||||
- let winid = popup_create('foobar', #{
|
||||
- \ close: 'button',
|
||||
- \ border: [],
|
||||
- \ line: 1,
|
||||
- \ col: 1,
|
||||
- \ })
|
||||
- func CloseMsg(id, result)
|
||||
- echomsg 'Popup closed with ' .. a:result
|
||||
- endfunc
|
||||
- let winid = popup_create('notification', #{
|
||||
- \ close: 'click',
|
||||
- \ line: 3,
|
||||
- \ col: 15,
|
||||
- \ callback: 'CloseMsg',
|
||||
- \ })
|
||||
- let winid = popup_create('no border here', #{
|
||||
- \ close: 'button',
|
||||
- \ line: 5,
|
||||
- \ col: 3,
|
||||
- \ })
|
||||
- let winid = popup_create('only padding', #{
|
||||
- \ close: 'button',
|
||||
- \ padding: [],
|
||||
- \ line: 5,
|
||||
- \ col: 23,
|
||||
- \ })
|
||||
- func CloseWithX()
|
||||
- call feedkeys("\<F3>\<LeftMouse>\<LeftRelease>", "xt")
|
||||
- endfunc
|
||||
- map <silent> <F3> :call test_setmouse(1, len('foobar') + 2)<CR>
|
||||
- func CloseWithClick()
|
||||
- call feedkeys("\<F4>\<LeftMouse>\<LeftRelease>", "xt")
|
||||
- endfunc
|
||||
- map <silent> <F4> :call test_setmouse(3, 17)<CR>
|
||||
- func CreateWithMenuFilter()
|
||||
- let winid = popup_create('barfoo', #{
|
||||
- \ close: 'button',
|
||||
- \ filter: 'popup_filter_menu',
|
||||
- \ border: [],
|
||||
- \ line: 1,
|
||||
- \ col: 40,
|
||||
- \ })
|
||||
- endfunc
|
||||
- END
|
||||
- call writefile(lines, 'XtestPopupClose')
|
||||
- let buf = RunVimInTerminal('-S XtestPopupClose', #{rows: 10})
|
||||
- call VerifyScreenDump(buf, 'Test_popupwin_close_01', {})
|
||||
-
|
||||
- call term_sendkeys(buf, ":call CloseWithX()\<CR>")
|
||||
- call VerifyScreenDump(buf, 'Test_popupwin_close_02', {})
|
||||
-
|
||||
- call term_sendkeys(buf, ":call CloseWithClick()\<CR>")
|
||||
- call VerifyScreenDump(buf, 'Test_popupwin_close_03', {})
|
||||
-
|
||||
- call term_sendkeys(buf, ":call CreateWithMenuFilter()\<CR>")
|
||||
- call VerifyScreenDump(buf, 'Test_popupwin_close_04', {})
|
||||
-
|
||||
- " We have to send the actual mouse code, feedkeys() would be caught the
|
||||
- " filter.
|
||||
- call term_sendkeys(buf, "\<Esc>[<0;47;1M")
|
||||
- call VerifyScreenDump(buf, 'Test_popupwin_close_05', {})
|
||||
-
|
||||
- " clean up
|
||||
- call StopVimInTerminal(buf)
|
||||
- call delete('XtestPopupClose')
|
||||
-endfunction
|
||||
-
|
||||
func Test_popup_menu_wrap()
|
||||
CheckScreendump
|
||||
|
||||
@@ -1335,52 +1219,6 @@ func Test_popup_atcursor_pos()
|
||||
call delete('XtestPopupAtcursorPos')
|
||||
endfunc
|
||||
|
||||
-func Test_popup_beval()
|
||||
- CheckScreendump
|
||||
- CheckFeature balloon_eval_term
|
||||
-
|
||||
- let lines =<< trim END
|
||||
- call setline(1, range(1, 20))
|
||||
- call setline(5, 'here is some text to hover over')
|
||||
- set balloonevalterm
|
||||
- set balloonexpr=BalloonExpr()
|
||||
- set balloondelay=100
|
||||
- func BalloonExpr()
|
||||
- let s:winid = [v:beval_text]->popup_beval({})
|
||||
- return ''
|
||||
- endfunc
|
||||
- func Hover()
|
||||
- call test_setmouse(5, 15)
|
||||
- call feedkeys("\<MouseMove>\<Ignore>", "xt")
|
||||
- sleep 100m
|
||||
- endfunc
|
||||
- func MoveOntoPopup()
|
||||
- call test_setmouse(4, 17)
|
||||
- call feedkeys("\<F4>\<MouseMove>\<Ignore>", "xt")
|
||||
- endfunc
|
||||
- func MoveAway()
|
||||
- call test_setmouse(5, 13)
|
||||
- call feedkeys("\<F5>\<MouseMove>\<Ignore>", "xt")
|
||||
- endfunc
|
||||
- END
|
||||
- call writefile(lines, 'XtestPopupBeval')
|
||||
- let buf = RunVimInTerminal('-S XtestPopupBeval', #{rows: 10})
|
||||
- call term_wait(buf, 100)
|
||||
- call term_sendkeys(buf, 'j')
|
||||
- call term_sendkeys(buf, ":call Hover()\<CR>")
|
||||
- call VerifyScreenDump(buf, 'Test_popupwin_beval_1', {})
|
||||
-
|
||||
- call term_sendkeys(buf, ":call MoveOntoPopup()\<CR>")
|
||||
- call VerifyScreenDump(buf, 'Test_popupwin_beval_2', {})
|
||||
-
|
||||
- call term_sendkeys(buf, ":call MoveAway()\<CR>")
|
||||
- call VerifyScreenDump(buf, 'Test_popupwin_beval_3', {})
|
||||
-
|
||||
- " clean up
|
||||
- call StopVimInTerminal(buf)
|
||||
- call delete('XtestPopupBeval')
|
||||
-endfunc
|
||||
-
|
||||
func Test_popup_filter()
|
||||
new
|
||||
call setline(1, 'some text')
|
||||
@@ -1895,129 +1733,6 @@ func Test_notifications()
|
||||
call delete('XtestNotifications')
|
||||
endfunc
|
||||
|
||||
-func Test_popup_scrollbar()
|
||||
- CheckScreendump
|
||||
-
|
||||
- let lines =<< trim END
|
||||
- call setline(1, range(1, 20))
|
||||
- hi ScrollThumb ctermbg=blue
|
||||
- hi ScrollBar ctermbg=red
|
||||
- let winid = popup_create(['one', 'two', 'three', 'four', 'five',
|
||||
- \ 'six', 'seven', 'eight', 'nine'], #{
|
||||
- \ minwidth: 8,
|
||||
- \ maxheight: 4,
|
||||
- \ })
|
||||
- func ScrollUp()
|
||||
- call feedkeys("\<F3>\<ScrollWheelUp>", "xt")
|
||||
- endfunc
|
||||
- func ScrollDown()
|
||||
- call feedkeys("\<F3>\<ScrollWheelDown>", "xt")
|
||||
- endfunc
|
||||
- func ClickTop()
|
||||
- call feedkeys("\<F4>\<LeftMouse>", "xt")
|
||||
- endfunc
|
||||
- func ClickBot()
|
||||
- call popup_setoptions(g:winid, #{border: [], close: 'button'})
|
||||
- call feedkeys("\<F5>\<LeftMouse>", "xt")
|
||||
- endfunc
|
||||
- func Popup_filter(winid, key)
|
||||
- if a:key == 'j'
|
||||
- let line = popup_getoptions(a:winid).firstline
|
||||
- let nlines = line('$', a:winid)
|
||||
- let newline = line < nlines ? (line + 1) : nlines
|
||||
- call popup_setoptions(a:winid, #{firstline: newline})
|
||||
- return v:true
|
||||
- elseif a:key == 'x'
|
||||
- call popup_close(a:winid)
|
||||
- return v:true
|
||||
- endif
|
||||
- endfunc
|
||||
-
|
||||
- func PopupScroll()
|
||||
- call popup_clear()
|
||||
- let text =<< trim END
|
||||
- 1
|
||||
- 2
|
||||
- 3
|
||||
- 4
|
||||
- long line long line long line long line long line long line
|
||||
- long line long line long line long line long line long line
|
||||
- long line long line long line long line long line long line
|
||||
- END
|
||||
- call popup_create(text, #{
|
||||
- \ minwidth: 30,
|
||||
- \ maxwidth: 30,
|
||||
- \ minheight: 4,
|
||||
- \ maxheight: 4,
|
||||
- \ firstline: 1,
|
||||
- \ lastline: 4,
|
||||
- \ wrap: v:true,
|
||||
- \ scrollbar: v:true,
|
||||
- \ mapping: v:false,
|
||||
- \ filter: funcref('Popup_filter')
|
||||
- \ })
|
||||
- endfunc
|
||||
- map <silent> <F3> :call test_setmouse(5, 36)<CR>
|
||||
- map <silent> <F4> :call test_setmouse(4, 42)<CR>
|
||||
- map <silent> <F5> :call test_setmouse(7, 42)<CR>
|
||||
- END
|
||||
- call writefile(lines, 'XtestPopupScroll')
|
||||
- let buf = RunVimInTerminal('-S XtestPopupScroll', #{rows: 10})
|
||||
- call VerifyScreenDump(buf, 'Test_popupwin_scroll_1', {})
|
||||
-
|
||||
- call term_sendkeys(buf, ":call popup_setoptions(winid, #{firstline: 2})\<CR>")
|
||||
- call term_sendkeys(buf, ":\<CR>")
|
||||
- call VerifyScreenDump(buf, 'Test_popupwin_scroll_2', {})
|
||||
-
|
||||
- call term_sendkeys(buf, ":call popup_setoptions(winid, #{firstline: 6})\<CR>")
|
||||
- call term_sendkeys(buf, ":\<CR>")
|
||||
- call VerifyScreenDump(buf, 'Test_popupwin_scroll_3', {})
|
||||
-
|
||||
- call term_sendkeys(buf, ":call popup_setoptions(winid, #{firstline: 9})\<CR>")
|
||||
- call term_sendkeys(buf, ":\<CR>")
|
||||
- call VerifyScreenDump(buf, 'Test_popupwin_scroll_4', {})
|
||||
-
|
||||
- call term_sendkeys(buf, ":call popup_setoptions(winid, #{scrollbarhighlight: 'ScrollBar', thumbhighlight: 'ScrollThumb', firstline: 5})\<CR>")
|
||||
- " this scrolls two lines (half the window height)
|
||||
- call term_sendkeys(buf, ":call ScrollUp()\<CR>")
|
||||
- call VerifyScreenDump(buf, 'Test_popupwin_scroll_5', {})
|
||||
-
|
||||
- call term_sendkeys(buf, ":call ScrollDown()\<CR>")
|
||||
- call VerifyScreenDump(buf, 'Test_popupwin_scroll_6', {})
|
||||
-
|
||||
- call term_sendkeys(buf, ":call ScrollDown()\<CR>")
|
||||
- " wait a bit, otherwise it fails sometimes (double click recognized?)
|
||||
- sleep 100m
|
||||
- call term_sendkeys(buf, ":call ScrollDown()\<CR>")
|
||||
- call VerifyScreenDump(buf, 'Test_popupwin_scroll_7', {})
|
||||
-
|
||||
- call term_sendkeys(buf, ":call ClickTop()\<CR>")
|
||||
- sleep 100m
|
||||
- call term_sendkeys(buf, ":call ClickTop()\<CR>")
|
||||
- call VerifyScreenDump(buf, 'Test_popupwin_scroll_8', {})
|
||||
-
|
||||
- call term_sendkeys(buf, ":call ClickBot()\<CR>")
|
||||
- call VerifyScreenDump(buf, 'Test_popupwin_scroll_9', {})
|
||||
-
|
||||
- " remove the minwidth and maxheight
|
||||
- call term_sendkeys(buf, ":call popup_setoptions(winid, #{maxheight: 0, minwidth: 0})\<CR>")
|
||||
- call term_sendkeys(buf, ":\<CR>")
|
||||
- call VerifyScreenDump(buf, 'Test_popupwin_scroll_10', {})
|
||||
-
|
||||
- " check size with non-wrapping lines
|
||||
- call term_sendkeys(buf, ":call PopupScroll()\<CR>")
|
||||
- call VerifyScreenDump(buf, 'Test_popupwin_scroll_11', {})
|
||||
-
|
||||
- " check size with wrapping lines
|
||||
- call term_sendkeys(buf, "j")
|
||||
- call VerifyScreenDump(buf, 'Test_popupwin_scroll_12', {})
|
||||
- call term_sendkeys(buf, "x")
|
||||
-
|
||||
- " clean up
|
||||
- call StopVimInTerminal(buf)
|
||||
- call delete('XtestPopupScroll')
|
||||
-endfunc
|
||||
-
|
||||
func Test_popup_fitting_scrollbar()
|
||||
" this was causing a crash, divide by zero
|
||||
let winid = popup_create([
|
||||
diff --git a/src/testdir/test_popupwin_textprop.vim b/src/testdir/test_popupwin_textprop.vim
|
||||
index 1b339d4..a42129d 100644
|
||||
--- a/src/testdir/test_popupwin_textprop.vim
|
||||
+++ b/src/testdir/test_popupwin_textprop.vim
|
||||
@@ -7,170 +7,4 @@ CheckFeature textprop
|
||||
source screendump.vim
|
||||
CheckScreendump
|
||||
|
||||
-func Test_textprop_popup()
|
||||
- let lines =<< trim END
|
||||
- call setline(1, range(1, 100))
|
||||
- call setline(50, 'some text to work with')
|
||||
- 50
|
||||
- normal zz
|
||||
- set scrolloff=0
|
||||
- call prop_type_add('popupMarker', #{highlight: 'DiffAdd', bufnr: bufnr('%')})
|
||||
- call prop_add(50, 11, #{
|
||||
- \ length: 7,
|
||||
- \ type: 'popupMarker',
|
||||
- \ bufnr: bufnr('%'),
|
||||
- \ })
|
||||
- let winid = popup_create('the text', #{
|
||||
- \ pos: 'botleft',
|
||||
- \ textprop: 'popupMarker',
|
||||
- \ border: [],
|
||||
- \ padding: [0,1,0,1],
|
||||
- \ close: 'click',
|
||||
- \ })
|
||||
- END
|
||||
- call writefile(lines, 'XtestTextpropPopup')
|
||||
- let buf = RunVimInTerminal('-S XtestTextpropPopup', #{rows: 10})
|
||||
- call VerifyScreenDump(buf, 'Test_popup_textprop_01', {})
|
||||
-
|
||||
- call term_sendkeys(buf, "zt")
|
||||
- call VerifyScreenDump(buf, 'Test_popup_textprop_02', {})
|
||||
-
|
||||
- call term_sendkeys(buf, "zzIawe\<Esc>")
|
||||
- call VerifyScreenDump(buf, 'Test_popup_textprop_03', {})
|
||||
-
|
||||
- call term_sendkeys(buf, "0dw")
|
||||
- call VerifyScreenDump(buf, 'Test_popup_textprop_04', {})
|
||||
-
|
||||
- call term_sendkeys(buf, "Oinserted\<Esc>")
|
||||
- call VerifyScreenDump(buf, 'Test_popup_textprop_05', {})
|
||||
-
|
||||
- call term_sendkeys(buf, "k2dd")
|
||||
- call VerifyScreenDump(buf, 'Test_popup_textprop_06', {})
|
||||
-
|
||||
- call term_sendkeys(buf, "4\<C-E>")
|
||||
- call VerifyScreenDump(buf, 'Test_popup_textprop_07', {})
|
||||
-
|
||||
- " clean up
|
||||
- call StopVimInTerminal(buf)
|
||||
- call delete('XtestTextpropPopup')
|
||||
-endfunc
|
||||
-
|
||||
-func Test_textprop_popup_corners()
|
||||
- let lines =<< trim END
|
||||
- call setline(1, range(1, 100))
|
||||
- call setline(50, 'now working with some longer text here')
|
||||
- 50
|
||||
- normal zz
|
||||
- set scrolloff=0
|
||||
- call prop_type_add('popupMarker', #{highlight: 'DiffAdd'})
|
||||
- call prop_add(50, 23, #{
|
||||
- \ length: 6,
|
||||
- \ type: 'popupMarker',
|
||||
- \ })
|
||||
- let winid = popup_create('bottom left', #{
|
||||
- \ pos: 'botleft',
|
||||
- \ textprop: 'popupMarker',
|
||||
- \ textpropwin: win_getid(),
|
||||
- \ padding: [0,1,0,1],
|
||||
- \ })
|
||||
- let winid = popup_create('bottom right', #{
|
||||
- \ pos: 'botright',
|
||||
- \ textprop: 'popupMarker',
|
||||
- \ border: [],
|
||||
- \ padding: [0,1,0,1],
|
||||
- \ })
|
||||
- let winid = popup_create('top left', #{
|
||||
- \ pos: 'topleft',
|
||||
- \ textprop: 'popupMarker',
|
||||
- \ border: [],
|
||||
- \ padding: [0,1,0,1],
|
||||
- \ })
|
||||
- let winid = popup_create('top right', #{
|
||||
- \ pos: 'topright',
|
||||
- \ textprop: 'popupMarker',
|
||||
- \ padding: [0,1,0,1],
|
||||
- \ })
|
||||
- END
|
||||
- call writefile(lines, 'XtestTextpropPopupCorners')
|
||||
- let buf = RunVimInTerminal('-S XtestTextpropPopupCorners', #{rows: 12})
|
||||
- call VerifyScreenDump(buf, 'Test_popup_textprop_corn_1', {})
|
||||
-
|
||||
- call term_sendkeys(buf, "0dw")
|
||||
- call VerifyScreenDump(buf, 'Test_popup_textprop_corn_2', {})
|
||||
-
|
||||
- call term_sendkeys(buf, "46Goextra\<Esc>")
|
||||
- call VerifyScreenDump(buf, 'Test_popup_textprop_corn_3', {})
|
||||
-
|
||||
- call term_sendkeys(buf, "u")
|
||||
- call term_sendkeys(buf, ":\<CR>")
|
||||
- call VerifyScreenDump(buf, 'Test_popup_textprop_corn_4', {})
|
||||
-
|
||||
- call term_sendkeys(buf, ":vsplit foo\<CR>")
|
||||
- call VerifyScreenDump(buf, 'Test_popup_textprop_corn_5', {})
|
||||
-
|
||||
- call term_sendkeys(buf, ":only!\<CR>")
|
||||
- call VerifyScreenDump(buf, 'Test_popup_textprop_corn_6', {})
|
||||
-
|
||||
- " clean up
|
||||
- call StopVimInTerminal(buf)
|
||||
- call delete('XtestTextpropPopupCorners')
|
||||
-endfunc
|
||||
-
|
||||
-func Test_textprop_popup_offsets()
|
||||
- let lines =<< trim END
|
||||
- call setline(1, range(1, 100))
|
||||
- call setline(50, 'now working with some longer text here')
|
||||
- 50
|
||||
- normal zz
|
||||
- set scrolloff=0
|
||||
- call prop_type_add('popupMarker', #{highlight: 'DiffAdd'})
|
||||
- call prop_add(50, 23, #{
|
||||
- \ length: 6,
|
||||
- \ type: 'popupMarker',
|
||||
- \ })
|
||||
- let winid = popup_create('bottom left', #{
|
||||
- \ pos: 'botleft',
|
||||
- \ line: -1,
|
||||
- \ col: 2,
|
||||
- \ textprop: 'popupMarker',
|
||||
- \ padding: [0,1,0,1],
|
||||
- \ })
|
||||
- let winid = popup_create('bottom right', #{
|
||||
- \ pos: 'botright',
|
||||
- \ line: -1,
|
||||
- \ col: -2,
|
||||
- \ textprop: 'popupMarker',
|
||||
- \ border: [],
|
||||
- \ padding: [0,1,0,1],
|
||||
- \ })
|
||||
- let winid = popup_create('top left', #{
|
||||
- \ pos: 'topleft',
|
||||
- \ line: 1,
|
||||
- \ col: 2,
|
||||
- \ textprop: 'popupMarker',
|
||||
- \ border: [],
|
||||
- \ padding: [0,1,0,1],
|
||||
- \ })
|
||||
- let winid = popup_create('top right', #{
|
||||
- \ pos: 'topright',
|
||||
- \ line: 1,
|
||||
- \ col: -2,
|
||||
- \ textprop: 'popupMarker',
|
||||
- \ padding: [0,1,0,1],
|
||||
- \ })
|
||||
- END
|
||||
- call writefile(lines, 'XtestTextpropPopupOffset')
|
||||
- let buf = RunVimInTerminal('-S XtestTextpropPopupOffset', #{rows: 12})
|
||||
- call VerifyScreenDump(buf, 'Test_popup_textprop_off_1', {})
|
||||
-
|
||||
- " test that removing the text property closes the popups
|
||||
- call term_sendkeys(buf, ":call prop_clear(50)\<CR>")
|
||||
- call VerifyScreenDump(buf, 'Test_popup_textprop_off_2', {})
|
||||
-
|
||||
- " clean up
|
||||
- call StopVimInTerminal(buf)
|
||||
- call delete('XtestTextpropPopupOffset')
|
||||
-endfunc
|
||||
-
|
||||
-
|
||||
" vim: shiftwidth=2 sts=2
|
||||
--
|
||||
2.19.1
|
||||
|
||||
26
vim.spec
26
vim.spec
@ -12,7 +12,7 @@
|
||||
Name: vim
|
||||
Epoch: 2
|
||||
Version: 8.2
|
||||
Release: 62
|
||||
Release: 63
|
||||
Summary: Vim is a highly configurable text editor for efficiently creating and changing any kind of text.
|
||||
License: Vim and MIT
|
||||
URL: http://www.vim.org
|
||||
@ -171,10 +171,22 @@ Patch6134: backport-patch-8.2.1677-memory-access-errors-when-calling-set.pa
|
||||
Patch6135: backport-CVE-2022-3016.patch
|
||||
|
||||
Patch9000: bugfix-rm-modify-info-version.patch
|
||||
Patch9001: openEuler-remove-failed-tests-due-to-patch.patch
|
||||
Patch9002: openEuler-fix-test87-failed.patch
|
||||
|
||||
Patch6136: backport-patch-8.2.0035-saving-and-restoring-called_emsg-is-c.patch
|
||||
Patch6137: backport-patch-8.2.0133-invalid-memory-access-with-search-com.patch
|
||||
Patch6138: backport-patch-8.2.0135-bracketed-paste-can-still-cause-inval.patch
|
||||
Patch6139: backport-patch-8.2.0243-insufficient-code-coverage-for-ex_doc.patch
|
||||
Patch6140: backport-patch-8.2.0892-ubsan-warns-for-undefined-behavior.patch
|
||||
Patch6141: backport-patch-8.2.0945-cannot-use-z-when-spell-is-off.patch
|
||||
Patch6142: backport-patch-8.2.3110-a-pattern-that-matches-the-cursor-pos.patch
|
||||
Patch6143: backport-patch-8.2.4152-block-insert-with-double-wide-charact.patch
|
||||
Patch6144: backport-patch-8.2.0195-some-tests-fail-when-run-in-the-GUI.patch
|
||||
|
||||
BuildRequires: autoconf python3-devel ncurses-devel gettext perl-devel perl-generators gcc
|
||||
BuildRequires: perl(ExtUtils::Embed) perl(ExtUtils::ParseXS) libacl-devel gpm-devel file
|
||||
BuildRequires: desktop-file-utils >= 0.2.93
|
||||
BuildRequires: desktop-file-utils >= 0.2.93 libtool
|
||||
%if %{_with_selinux__}
|
||||
BuildRequires: libselinux-devel
|
||||
%endif
|
||||
@ -453,7 +465,6 @@ echo ".so man1/vi.1" > %{buildroot}%{_mandir}/man5/virc.5
|
||||
touch %{buildroot}%{_datadir}/%{name}/vimfiles/doc/tags
|
||||
|
||||
pushd runtime
|
||||
rm -rf doc
|
||||
ln -sf ../../%{name}/%{vimdir}/doc docs
|
||||
popd
|
||||
|
||||
@ -464,6 +475,9 @@ popd
|
||||
> %{_datadir}/%{name}/vimfiles/doc/tags || :
|
||||
%{_bindir}/vim -c ":helptags %{_datadir}/%{name}/vimfiles/doc" -c :q &> /dev/null || :
|
||||
|
||||
%check
|
||||
LC_ALL=en_US.UTF-8 make -j1 test
|
||||
|
||||
%files common
|
||||
%exclude %{_datadir}/vim/%{vimdir}/macros/maze/maze*.c
|
||||
%exclude %{_datadir}/vim/%{vimdir}/tools
|
||||
@ -557,6 +571,12 @@ popd
|
||||
%{_mandir}/man1/evim.*
|
||||
|
||||
%changelog
|
||||
* Sat Sep 03 2022 shixuantong <shixuantong@h-partners.com> - 2:8.2-63
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:enable check
|
||||
|
||||
* Mon Aug 29 2022 shixuantong <shixuantong@h-partners.com> - 2:8.2-62
|
||||
- Type:CVE
|
||||
- ID:CVE-2022-3016
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user