Compare commits

..

8 Commits

Author SHA1 Message Date
zeertzjq
5b4d1fcbf0 patch 9.0.2145: wrong scrolling in insert mode with smoothscroll
Problem:  Wrong scrolling in Insert mode with 'smoothscroll' at the
          bottom of the window.
Solution: Don't use set_topline() when 'smoothscroll' is set.

fixes: #13612
closes: #13613

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-03 17:54:10 +01:00
zeertzjq
4e26a9aab6 patch 9.0.2144: Text properties causes wrong line wrapping
Problem:  Text properties causes wrong line wrapping to be drawn.
Solution: Find the index of the last text property that inserts text.

closes: #13611

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-03 17:50:47 +01:00
Christian Brabandt
c089c3816b CI: disable the test_terminal_resize2() test for GH CI in gui mode (#13615)
becaues it tends to time-out CI for unknown reasons.

related: #13566

Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-03 17:48:29 +01:00
Christian Brabandt
abfa13ebe9 patch 9.0.2143: [security]: buffer-overflow in ex_substitute
Problem:  [security]: buffer-overflow in ex_substitute
Solution: clear memory after allocating

When allocating the new_start pointer in ex_substitute() the memory
pointer points to some garbage that the following for loop in
ex_cmds.c:4743 confuses and causes it to accessing the new_start pointer
beyond it's size, leading to a buffer-overlow.

So fix this by using alloc_clear() instead of alloc(), which will
clear the memory by NUL and therefore cause the loop to terminate
correctly.

Reported by @henices, thanks!

closes: #13596
Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-01 18:58:51 +01:00
Christian Brabandt
b39b240c38 patch 9.0.2142: [security]: stack-buffer-overflow in option callback functions
Problem:  [security]: stack-buffer-overflow in option callback functions
Solution: pass size of errbuf down the call stack, use snprintf()
          instead of sprintf()

We pass the error buffer down to the option callback functions, but in
some parts of the code, we simply use sprintf(buf) to write into the error
buffer, which can overflow.

So let's pass down the length of the error buffer and use sprintf(buf, size)
instead.

Reported by @henices, thanks!

Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-01 18:58:51 +01:00
Christian Brabandt
0fb375aae6 patch 9.0.2141: [security]: buffer-overflow in suggest_trie_walk
Problem:  [security]: buffer-overflow in suggest_trie_walk
Solution: Check n before using it as index into byts array

Basically, n as an index into the byts array, can point to beyond the byts
array. So let's double check, that n is within the expected range after
incrementing it from sp->ts_curi and bail out if it would be invalid.

Reported by @henices, thanks!

Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-01 18:58:50 +01:00
Christian Brabandt
eec0c2b3a4 patch 9.0.2140: [security]: use-after-free in win-enter
Problem:  [security]: use-after-free in win-enter
Solution: validate window pointer before calling win_enter()

win_goto() may stop visual mode, if it is active. However, this may in
turn trigger the ModeChanged autocommand, which could potentially free
the wp pointer which was valid before now became stale and points to now
freed memory.

So before calling win_enter(), let's verify one more time, that the
wp pointer still points to a valid window structure.

Reported by @henices, thanks!

Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-01 18:58:50 +01:00
Peter Simonyi
9cc95aa0d8 CI: check that all files are listed in Filelist (#13601)
Sometimes patches add files that should be included in tarballs for
distribution, but are not added to Filelist (used by Makefile to build
the tar archive).  This can break the build, or it can be silently
ignored as runtime files are simply not included in the distribution.

Add a CI check to ensure all files tracked in the repository are
assigned to a variable in Filelist.  A few files were not listed because
they do not need to be included in builds and tarballs, so add an IGNORE
variable for these exceptions.

Co-authored-by: Peter Simonyi <pts@petersimonyi.ca>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-01 18:07:42 +01:00
25 changed files with 283 additions and 38 deletions

View File

@@ -81,6 +81,12 @@ jobs:
- name: Checkout repository from github
uses: actions/checkout@v4
- name: Check Filelist (for packaging)
run: |
# If any files in the repository are not listed in Filelist this will
# exit with an error code and list the missing entries.
make -f ci/unlisted.make
- run: sudo dpkg --add-architecture i386
if: matrix.architecture == 'i386'

View File

@@ -213,6 +213,7 @@ SRC_ALL = \
src/testdir/dumps/*.dump \
src/testdir/dumps/*.vim \
src/testdir/samples/*.txt \
src/testdir/samples/*.vim \
src/testdir/samples/test000 \
src/testdir/color_ramp.vim \
src/testdir/silent.wav \
@@ -1074,4 +1075,17 @@ LANG_DOS = \
src/po/*.mo \
runtime/lang/Make_mvc.mak \
# Files in the repository that are deliberately not listed above, and will thus
# be excluded from distribution tarballs and the like.
# This excludes them from the CI check for unlisted files.
IGNORE = \
.appveyor.yml \
.github/FUNDING.yml \
.github/labeler.yml \
.github/workflows/label.yml \
SECURITY.md \
ci/unlisted.make \
src/libvterm/CODE-MAP \
runtime/syntax/testdir/input/html_html \
# vim: set ft=make:

49
ci/unlisted.make Normal file
View File

@@ -0,0 +1,49 @@
# vim: ft=make
SHELL = /bin/bash
# List all files that are tracked in git but not listed in Filelist.
# Exit code is 2 ("Make encountered an error") if any such files exist.
# Filelist is a Makefile that defines many variables, so we use Make itself to
# query which variables it defines, then expand them all by wrapping each name
# in $(...), importing Filelist and using $(eval).
include Filelist
$(eval all_patterns := $(shell \
make -f Filelist --question --print-data-base --no-builtin-rules \
--no-builtin-variables 2>/dev/null \
| sed -nre \
'/^# makefile .from \x27Filelist\x27,/ { \
n; \
s/ = .*//; \
T; \
s/.*/$$(\0)/; \
p; \
}'))
# In Makefile's `prepeare` target, all the IN_README_DIR files are moved from
# READMEdir to the root, so add those files in their Git-tracked location:
all_patterns := $(all_patterns) \
$(foreach readme, $(IN_README_DIR), READMEdir/$(readme))
# The result 'all_patterns' is a list of patterns (globs), which we expand with
# wildcard to get actual filenames. Note this means Filelist can list a file
# that does not exist, and it will be omitted at this step.
listed_files := $(wildcard $(all_patterns))
# Default target to actually run the comparison:
.PHONY: check
check:
@# There are too many files to list on the command line, so we write
@# that to a temporary file, one per line.
$(file > Filelist-listed-files)
$(foreach filename, $(listed_files),\
$(file >> Filelist-listed-files,$(filename)))
@# Compare the sorted lists. Delete that temporary file on both
@# success and failure, but exit with diff's exit code.
diff -u0 --label files-in-git <(git ls-files | sort) \
--label Filelist <(sort --unique Filelist-listed-files); \
RV=$$?; \
rm Filelist-listed-files; \
(($$RV != 0)) && echo "Add files to the right variable in Filelist."; \
exit $$RV

View File

@@ -1149,6 +1149,7 @@ win_line(
#ifdef FEAT_PROP_POPUP
int did_line = FALSE; // set to TRUE when line text done
int text_prop_count;
int last_textprop_text_idx = -1;
int text_prop_next = 0; // next text property to use
textprop_T *text_props = NULL;
int *text_prop_idxs = NULL;
@@ -1616,6 +1617,11 @@ win_line(
area_highlighting = TRUE;
extra_check = TRUE;
/* Find the last text property that inserts text. */
for (int i = 0; i < text_prop_count; ++i)
if (text_props[i].tp_id < 0)
last_textprop_text_idx = i;
// When skipping virtual text the props need to be sorted. The
// order is reversed!
if (lnum == wp->w_topline && wp->w_skipcol > 0)
@@ -3791,7 +3797,7 @@ win_line(
|| (wlv.n_extra > 0 && (wlv.c_extra != NUL
|| *wlv.p_extra != NUL))
#ifdef FEAT_PROP_POPUP
|| text_prop_next < text_prop_count
|| text_prop_next <= last_textprop_text_idx
#endif
))
{
@@ -4083,7 +4089,7 @@ win_line(
#endif
#ifdef FEAT_PROP_POPUP
|| text_prop_above || text_prop_follows
|| text_prop_next < text_prop_count
|| text_prop_next <= last_textprop_text_idx
#endif
|| (wp->w_p_list && wp->w_lcs_chars.eol != NUL
&& wlv.p_extra != at_end_str)

View File

@@ -501,9 +501,12 @@ edit(
* something.
* Don't do this when the topline changed already, it has
* already been adjusted (by insertchar() calling open_line())).
* Also don't do this when 'smoothscroll' is set, as the window should
* then be scrolled by screen lines.
*/
if (curbuf->b_mod_set
&& curwin->w_p_wrap
&& !curwin->w_p_sms
&& !did_backspace
&& curwin->w_topline == old_topline
#ifdef FEAT_DIFF

View File

@@ -4650,7 +4650,7 @@ ex_substitute(exarg_T *eap)
* too many calls to alloc()/free()).
*/
new_start_len = needed_len + 50;
if ((new_start = alloc(new_start_len)) == NULL)
if ((new_start = alloc_clear(new_start_len)) == NULL)
goto outofmem;
*new_start = NUL;
new_end = new_start;
@@ -4667,7 +4667,7 @@ ex_substitute(exarg_T *eap)
if (needed_len > (int)new_start_len)
{
new_start_len = needed_len + 50;
if ((p1 = alloc(new_start_len)) == NULL)
if ((p1 = alloc_clear(new_start_len)) == NULL)
{
vim_free(new_start);
goto outofmem;

View File

@@ -3114,7 +3114,7 @@ did_set_langmap(optset_T *args UNUSED)
{
if (p[0] != ',')
{
sprintf(args->os_errbuf,
snprintf(args->os_errbuf, args->os_errbuflen,
_(e_langmap_extra_characters_after_semicolon_str),
p);
return args->os_errbuf;

View File

@@ -1932,6 +1932,7 @@ do_set_option_string(
int cp_val,
char_u *varp_arg,
char *errbuf,
int errbuflen,
int *value_checked,
char **errmsg)
{
@@ -2030,7 +2031,7 @@ do_set_option_string(
// be triggered that can cause havoc.
*errmsg = did_set_string_option(
opt_idx, (char_u **)varp, oldval, newval, errbuf,
opt_flags, op, value_checked);
errbuflen, opt_flags, op, value_checked);
secure = secure_saved;
}
@@ -2287,7 +2288,7 @@ do_set_option_value(
{
// string option
if (do_set_option_string(opt_idx, opt_flags, &arg, nextchar, op,
flags, cp_val, varp, errbuf,
flags, cp_val, varp, errbuf, errbuflen,
&value_checked, &errmsg) == FAIL)
{
if (errmsg != NULL)
@@ -2579,12 +2580,12 @@ do_set(
{
int stopopteval = FALSE;
char *errmsg = NULL;
char errbuf[80];
char errbuf[ERR_BUFLEN];
char_u *startarg = arg;
errmsg = do_set_option(opt_flags, &arg, arg_start, &startarg,
&did_show, &stopopteval, errbuf,
sizeof(errbuf));
ERR_BUFLEN);
if (stopopteval)
break;
@@ -5347,7 +5348,8 @@ set_option_value(
int opt_idx;
char_u *varp;
long_u flags;
static char errbuf[80];
static char errbuf[ERR_BUFLEN];
int errbuflen = ERR_BUFLEN;
opt_idx = findoption(name);
if (opt_idx < 0)
@@ -5390,7 +5392,7 @@ set_option_value(
}
#endif
if (flags & P_STRING)
return set_string_option(opt_idx, string, opt_flags, errbuf);
return set_string_option(opt_idx, string, opt_flags, errbuf, errbuflen);
varp = get_varp_scope(&(options[opt_idx]), opt_flags);
if (varp != NULL) // hidden option is not changed

View File

@@ -1321,4 +1321,6 @@ enum
// Value for b_p_ul indicating the global value must be used.
#define NO_LOCAL_UNDOLEVEL (-123456)
#define ERR_BUFLEN 80
#endif // _OPTION_H_

View File

@@ -229,11 +229,12 @@ trigger_optionset_string(
#endif
static char *
illegal_char(char *errbuf, int c)
illegal_char(char *errbuf, int errbuflen, int c)
{
if (errbuf == NULL)
return "";
sprintf((char *)errbuf, _(e_illegal_character_str), (char *)transchar(c));
snprintf((char *)errbuf, errbuflen, _(e_illegal_character_str),
(char *)transchar(c));
return errbuf;
}
@@ -525,7 +526,8 @@ set_string_option(
int opt_idx,
char_u *value,
int opt_flags, // OPT_LOCAL and/or OPT_GLOBAL
char *errbuf)
char *errbuf,
int errbuflen)
{
char_u *s;
char_u **varp;
@@ -579,7 +581,7 @@ set_string_option(
}
#endif
if ((errmsg = did_set_string_option(opt_idx, varp, oldval, value, errbuf,
opt_flags, OP_NONE, &value_checked)) == NULL)
errbuflen, opt_flags, OP_NONE, &value_checked)) == NULL)
did_set_option(opt_idx, opt_flags, TRUE, value_checked);
#if defined(FEAT_EVAL)
@@ -615,7 +617,8 @@ valid_filetype(char_u *val)
check_stl_option(char_u *s)
{
int groupdepth = 0;
static char errbuf[80];
static char errbuf[ERR_BUFLEN];
int errbuflen = ERR_BUFLEN;
while (*s)
{
@@ -656,7 +659,7 @@ check_stl_option(char_u *s)
}
if (vim_strchr(STL_ALL, *s) == NULL)
{
return illegal_char(errbuf, *s);
return illegal_char(errbuf, errbuflen, *s);
}
if (*s == '{')
{
@@ -664,7 +667,7 @@ check_stl_option(char_u *s)
if (reevaluate && *++s == '}')
// "}" is not allowed immediately after "%{%"
return illegal_char(errbuf, '}');
return illegal_char(errbuf, errbuflen, '}');
while ((*s != '}' || (reevaluate && s[-1] != '%')) && *s)
s++;
if (*s != '}')
@@ -719,13 +722,17 @@ did_set_opt_strings(char_u *val, char **values, int list)
* An option which is a list of flags is set. Valid values are in 'flags'.
*/
static char *
did_set_option_listflag(char_u *val, char_u *flags, char *errbuf)
did_set_option_listflag(
char_u *val,
char_u *flags,
char *errbuf,
int errbuflen)
{
char_u *s;
for (s = val; *s; ++s)
if (vim_strchr(flags, *s) == NULL)
return illegal_char(errbuf, *s);
return illegal_char(errbuf, errbuflen, *s);
return NULL;
}
@@ -1461,7 +1468,7 @@ did_set_comments(optset_T *args)
if (vim_strchr((char_u *)COM_ALL, *s) == NULL
&& !VIM_ISDIGIT(*s) && *s != '-')
{
errmsg = illegal_char(args->os_errbuf, *s);
errmsg = illegal_char(args->os_errbuf, args->os_errbuflen, *s);
break;
}
++s;
@@ -1517,7 +1524,7 @@ did_set_complete(optset_T *args)
if (!*s)
break;
if (vim_strchr((char_u *)".wbuksid]tU", *s) == NULL)
return illegal_char(args->os_errbuf, *s);
return illegal_char(args->os_errbuf, args->os_errbuflen, *s);
if (*++s != NUL && *s != ',' && *s != ' ')
{
if (s[-1] == 'k' || s[-1] == 's')
@@ -1534,7 +1541,7 @@ did_set_complete(optset_T *args)
{
if (args->os_errbuf != NULL)
{
sprintf((char *)args->os_errbuf,
snprintf((char *)args->os_errbuf, args->os_errbuflen,
_(e_illegal_character_after_chr), *--s);
return args->os_errbuf;
}
@@ -1634,7 +1641,8 @@ did_set_concealcursor(optset_T *args)
{
char_u **varp = (char_u **)args->os_varp;
return did_set_option_listflag(*varp, (char_u *)COCU_ALL, args->os_errbuf);
return did_set_option_listflag(*varp, (char_u *)COCU_ALL, args->os_errbuf,
args->os_errbuflen);
}
int
@@ -1652,7 +1660,8 @@ did_set_cpoptions(optset_T *args)
{
char_u **varp = (char_u **)args->os_varp;
return did_set_option_listflag(*varp, (char_u *)CPO_ALL, args->os_errbuf);
return did_set_option_listflag(*varp, (char_u *)CPO_ALL, args->os_errbuf,
args->os_errbuflen);
}
int
@@ -2281,7 +2290,8 @@ did_set_formatoptions(optset_T *args)
{
char_u **varp = (char_u **)args->os_varp;
return did_set_option_listflag(*varp, (char_u *)FO_ALL, args->os_errbuf);
return did_set_option_listflag(*varp, (char_u *)FO_ALL, args->os_errbuf,
args->os_errbuflen);
}
int
@@ -2422,7 +2432,8 @@ did_set_guioptions(optset_T *args)
char_u **varp = (char_u **)args->os_varp;
char *errmsg;
errmsg = did_set_option_listflag(*varp, (char_u *)GO_ALL, args->os_errbuf);
errmsg = did_set_option_listflag(*varp, (char_u *)GO_ALL, args->os_errbuf,
args->os_errbuflen);
if (errmsg != NULL)
return errmsg;
@@ -2926,8 +2937,8 @@ did_set_mouse(optset_T *args)
{
char_u **varp = (char_u **)args->os_varp;
return did_set_option_listflag(*varp, (char_u *)MOUSE_ALL,
args->os_errbuf);
return did_set_option_listflag(*varp, (char_u *)MOUSE_ALL, args->os_errbuf,
args->os_errbuflen);
}
int
@@ -3364,7 +3375,8 @@ did_set_shortmess(optset_T *args)
{
char_u **varp = (char_u **)args->os_varp;
return did_set_option_listflag(*varp, (char_u *)SHM_ALL, args->os_errbuf);
return did_set_option_listflag(*varp, (char_u *)SHM_ALL, args->os_errbuf,
args->os_errbuflen);
}
int
@@ -4030,7 +4042,7 @@ did_set_viminfo(optset_T *args)
// Check it's a valid character
if (vim_strchr((char_u *)"!\"%'/:<@cfhnrs", *s) == NULL)
{
errmsg = illegal_char(args->os_errbuf, *s);
errmsg = illegal_char(args->os_errbuf, args->os_errbuflen, *s);
break;
}
if (*s == 'n') // name is always last one
@@ -4057,7 +4069,7 @@ did_set_viminfo(optset_T *args)
{
if (args->os_errbuf != NULL)
{
sprintf(args->os_errbuf,
snprintf(args->os_errbuf, args->os_errbuflen,
_(e_missing_number_after_angle_str_angle),
transchar_byte(*(s - 1)));
errmsg = args->os_errbuf;
@@ -4140,7 +4152,8 @@ did_set_whichwrap(optset_T *args)
// Add ',' to the list flags because 'whichwrap' is a flag
// list that is comma-separated.
return did_set_option_listflag(*varp, (char_u *)(WW_ALL ","), args->os_errbuf);
return did_set_option_listflag(*varp, (char_u *)(WW_ALL ","),
args->os_errbuf, args->os_errbuflen);
}
int
@@ -4341,6 +4354,7 @@ did_set_string_option(
char_u *oldval, // previous value of the option
char_u *value, // new value of the option
char *errbuf, // buffer for errors, or NULL
int errbuflen, // length of error buffer
int opt_flags, // OPT_LOCAL and/or OPT_GLOBAL
set_op_T op, // OP_ADDING/OP_PREPENDING/OP_REMOVING
int *value_checked) // value was checked to be safe, no
@@ -4385,6 +4399,7 @@ did_set_string_option(
args.os_oldval.string = oldval;
args.os_newval.string = value;
args.os_errbuf = errbuf;
args.os_errbuflen = errbuflen;
// Invoke the option specific callback function to validate and apply
// the new option value.
errmsg = did_set_cb(&args);

View File

@@ -8,7 +8,7 @@ void check_string_option(char_u **pp);
void set_string_option_direct(char_u *name, int opt_idx, char_u *val, int opt_flags, int set_sid);
void set_string_option_direct_in_win(win_T *wp, char_u *name, int opt_idx, char_u *val, int opt_flags, int set_sid);
void set_string_option_direct_in_buf(buf_T *buf, char_u *name, int opt_idx, char_u *val, int opt_flags, int set_sid);
char *set_string_option(int opt_idx, char_u *value, int opt_flags, char *errbuf);
char *set_string_option(int opt_idx, char_u *value, int opt_flags, char *errbuf, int errbuflen);
char *did_set_ambiwidth(optset_T *args);
char *did_set_background(optset_T *args);
char *did_set_backspace(optset_T *args);
@@ -121,7 +121,7 @@ char *did_set_wildmode(optset_T *args);
char *did_set_wildoptions(optset_T *args);
char *did_set_winaltkeys(optset_T *args);
char *did_set_wincolor(optset_T *args);
char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char_u *value, char *errbuf, int opt_flags, set_op_T op, int *value_checked);
char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char_u *value, char *errbuf, int errbuflen, int opt_flags, set_op_T op, int *value_checked);
int expand_set_ambiwidth(optexpand_T *args, int *numMatches, char_u ***matches);
int expand_set_background(optexpand_T *args, int *numMatches, char_u ***matches);
int expand_set_backspace(optexpand_T *args, int *numMatches, char_u ***matches);

View File

@@ -2175,6 +2175,13 @@ suggest_trie_walk(
// - Skip the byte if it's equal to the byte in the word,
// accepting that byte is always better.
n += sp->ts_curi++;
// break out, if we would be accessing byts buffer out of bounds
if (byts == slang->sl_fbyts && n >= slang->sl_fbyts_len)
{
got_int = TRUE;
break;
}
c = byts[n];
if (soundfold && sp->ts_twordlen == 0 && c == '*')
// Inserting a vowel at the start of a word counts less,

View File

@@ -4968,6 +4968,8 @@ typedef struct
// is parameterized, then the "os_errbuf" buffer is used to store the error
// message (when it is not NULL).
char *os_errbuf;
// length of the error buffer
int os_errbuflen;
} optset_T;
/*

View File

@@ -0,0 +1 @@
se lmap=°xÿ7sil;drlmap=°xÿ7sil;drmo: pm31 3"

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,20 @@
> +0&#ffffff0@39
|~+0#4040ff13&| @38
|~| @38
|~| @38
|~| @7|╔+0#0000000&|═@19|╗| +0#4040ff13&@8
|~| @7|║+0#0000000&| +8#af5f00255&@1|1| | +8#e000002&@15|║+0#0000000&| +0#4040ff13&@8
|~| @7|║+0#0000000&| +0#4040ff13&@19|║+0#0000000&| +0#4040ff13&@8
|~| @7|║+0#0000000&| +0#4040ff13&@19|║+0#0000000&| +0#4040ff13&@8
|~| @7|║+0#0000000&| +0#4040ff13&@19|║+0#0000000&| +0#4040ff13&@8
|~| @7|║+0#0000000&| +0#4040ff13&@19|║+0#0000000&| +0#4040ff13&@8
|~| @7|║+0#0000000&| +0#4040ff13&@19|║+0#0000000&| +0#4040ff13&@8
|~| @7|║+0#0000000&| +0#4040ff13&@19|║+0#0000000&| +0#4040ff13&@8
|~| @7|║+0#0000000&| +0#4040ff13&@19|║+0#0000000&| +0#4040ff13&@8
|~| @7|║+0#0000000&| +0#4040ff13&@19|║+0#0000000&| +0#4040ff13&@8
|~| @7|║+0#0000000&| +0#4040ff13&@19|║+0#0000000&| +0#4040ff13&@8
|~| @7|╚+0#0000000&|═@19|╝| +0#4040ff13&@8
|~| @38
|~| @38
|~| @38
| +0#0000000&@21|0|,|0|-|1| @8|A|l@1|

View File

@@ -0,0 +1,9 @@
|<+0#4040ff13#ffffff0@2|e+0#0000000&|r|y| |l|o|n|g| |l|i|n|e| |.@2|A| |v|e|r|y| |l|o|n|g| |l|i|n|e| |.@2
|A| |v|e|r|y| |l|o|n|g| |l|i|n|e| |.@2|A| |v|e|r|y| |l|o|n|g| |l|i|n|e| |.@2
|A| |v|e|r|y| |l|o|n|g| |l|i|n|e| |.@2|A| |v|e|r|y| |l|o|n|g| |l|i|n|e| |.@2
|A| |v|e|r|y| |l|o|n|g| |l|i|n|e| |.@2|A| |v|e|r|y| |l|o|n|g| |l|i|n|e| |.@2
|A| |v|e|r|y| |l|o|n|g| |l|i|n|e| |.@2|A| |v|e|r|y| |l|o|n|g| |l|i|n|e| |.@2
|A| |v|e|r|y| |l|o|n|g| |l|i|n|e| |.@2|A| |v|e|r|y| |l|o|n|g| |l|i|n|e| |.@2
|1|2|3|4|5|6|7|8|9| @30
> @39
@40

View File

@@ -117,7 +117,7 @@ func Test_crash1_2()
" The following used to crash Vim
let opts = #{cmd: 'sh'}
let vim = GetVimProg()
let result = 'X_crash1_1_result.txt'
let result = 'X_crash1_2_result.txt'
let buf = RunVimInTerminal('sh', opts)
@@ -128,6 +128,38 @@ func Test_crash1_2()
\ ' && echo "crash 1: [OK]" > '.. result .. "\<cr>")
call TermWait(buf, 150)
let file = 'crash/poc_win_enter_ext'
let cmn_args = "%s -u NONE -i NONE -n -e -s -S %s -c ':qa!'"
let args = printf(cmn_args, vim, file)
call term_sendkeys(buf, args ..
\ ' && echo "crash 2: [OK]" >> '.. result .. "\<cr>")
call TermWait(buf, 350)
let file = 'crash/poc_suggest_trie_walk'
let cmn_args = "%s -u NONE -i NONE -n -e -s -S %s -c ':qa!'"
let args = printf(cmn_args, vim, file)
call term_sendkeys(buf, args ..
\ ' && echo "crash 3: [OK]" >> '.. result .. "\<cr>")
call TermWait(buf, 150)
let file = 'crash/poc_did_set_langmap'
let cmn_args = "%s -u NONE -i NONE -n -X -m -n -e -s -S %s -c ':qa!'"
let args = printf(cmn_args, vim, file)
call term_sendkeys(buf, args ..
\ ' ; echo "crash 4: [OK]" >> '.. result .. "\<cr>")
call TermWait(buf, 150)
let file = 'crash/poc_ex_substitute'
let cmn_args = "%s -u NONE -i NONE -n -e -s -S %s -c ':qa!'"
let args = printf(cmn_args, vim, file)
" just make sure it runs, we don't care about the resulting echo
call term_sendkeys(buf, args .. "\<cr>")
" There is no output generated in Github CI for the asan clang build.
" so just skip generating the ouput.
" call term_sendkeys(buf, args ..
" \ ' && echo "crash 5: [OK]" >> '.. result .. "\<cr>")
call TermWait(buf, 150)
" clean up
exe buf .. "bw!"
@@ -135,6 +167,9 @@ func Test_crash1_2()
let expected = [
\ 'crash 1: [OK]',
\ 'crash 2: [OK]',
\ 'crash 3: [OK]',
\ 'crash 4: [OK]',
\ ]
call assert_equal(expected, getline(1, '$'))

View File

@@ -920,7 +920,7 @@ func Test_smoothscroll_cursor_top()
exe "norm G3\<C-E>k"
END
call writefile(lines, 'XSmoothScrollCursorTop', 'D')
let buf = RunVimInTerminal('-u NONE -S XSmoothScrollCursorTop', #{rows: 12, cols:40})
let buf = RunVimInTerminal('-u NONE -S XSmoothScrollCursorTop', #{rows: 12, cols: 40})
call VerifyScreenDump(buf, 'Test_smoothscroll_cursor_top', {})
call StopVimInTerminal(buf)
@@ -939,10 +939,25 @@ func Test_smoothscroll_crash()
exe "norm! 0\<c-e>"
END
call writefile(lines, 'XSmoothScrollCrash', 'D')
let buf = RunVimInTerminal('-u NONE -S XSmoothScrollCrash', #{rows: 12, cols:40})
let buf = RunVimInTerminal('-u NONE -S XSmoothScrollCrash', #{rows: 12, cols: 40})
call term_sendkeys(buf, "2\<C-E>\<C-L>")
call StopVimInTerminal(buf)
endfunc
func Test_smoothscroll_insert_bottom()
CheckScreendump
let lines =<< trim END
call setline(1, repeat([repeat('A very long line ...', 10)], 5))
set wrap smoothscroll scrolloff=0
END
call writefile(lines, 'XSmoothScrollInsertBottom', 'D')
let buf = RunVimInTerminal('-u NONE -S XSmoothScrollInsertBottom', #{rows: 9, cols: 40})
call term_sendkeys(buf, "Go123456789\<CR>")
call VerifyScreenDump(buf, 'Test_smoothscroll_insert_bottom', {})
call StopVimInTerminal(buf)
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -283,8 +283,12 @@ func Test_terminal_resize()
set statusline&
endfunc
" TODO: This test starts timing out in Github CI Gui test, why????
func Test_terminal_resize2()
CheckNotMSWindows
if has('gui_running') && expand('$GITHUB_ACTIONS') ==# 'true'
throw 'Skipped: FIXME: this test times-out in Github Actions CI with GUI. Why?'
endif
set statusline=x
terminal
call assert_equal(2, winnr('$'))

View File

@@ -1424,6 +1424,43 @@ func Test_textprop_text_priority()
call StopVimInTerminal(buf)
endfunc
func Test_textprop_in_empty_popup()
CheckScreendump
let lines =<< trim END
vim9script
hi def link FilterMenuMatch Constant
prop_type_add('FilterMenuMatch', {
highlight: "FilterMenuMatch",
override: true,
priority: 1000,
combine: true,
})
var winid = popup_create([{text: "hello", props: [
{col: 1, length: 1, type: 'FilterMenuMatch'},
{col: 2, length: 1, type: 'FilterMenuMatch'},
]}], {
minwidth: 20,
minheight: 10,
cursorline: false,
highlight: "None",
border: [],
})
win_execute(winid, "setl nu cursorline cursorlineopt=both")
popup_settext(winid, [])
redraw
END
call writefile(lines, 'XtestPropEmptyPopup', 'D')
let buf = RunVimInTerminal('-S XtestPropEmptyPopup', #{rows: 20, cols: 40})
call VerifyScreenDump(buf, 'Test_prop_in_empty_popup', {})
" clean up
call StopVimInTerminal(buf)
endfunc
func Test_textprop_with_syntax()
CheckScreendump

View File

@@ -704,6 +704,18 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2145,
/**/
2144,
/**/
2143,
/**/
2142,
/**/
2141,
/**/
2140,
/**/
2139,
/**/

View File

@@ -5013,6 +5013,7 @@ tabpage_move(int nr)
* Go to another window.
* When jumping to another buffer, stop Visual mode. Do this before
* changing windows so we can yank the selection into the '*' register.
* (note: this may trigger ModeChanged autocommand!)
* When jumping to another window on the same buffer, adjust its cursor
* position to keep the same Visual area.
*/
@@ -5039,10 +5040,15 @@ win_goto(win_T *wp)
}
if (wp->w_buffer != curbuf)
// careful: triggers ModeChanged autocommand
reset_VIsual_and_resel();
else if (VIsual_active)
wp->w_cursor = curwin->w_cursor;
// autocommand may have made wp invalid
if (!win_valid(wp))
return;
#ifdef FEAT_GUI
need_mouse_correct = TRUE;
#endif