summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:05:51 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:05:51 +0000
commit3b8b0072dafee1c363713688a821982167185fa0 (patch)
tree7ae89cb789d77aecb88f4785011115d820f9bf49 /src
parentAdding upstream version 2:9.1.0698. (diff)
downloadvim-upstream.tar.xz
vim-upstream.zip
Adding upstream version 2:9.1.0709.upstream/2%9.1.0709upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--src/Makefile1
-rw-r--r--src/charset.c3
-rw-r--r--src/drawscreen.c3
-rw-r--r--src/edit.c10
-rw-r--r--src/fileio.c2
-rw-r--r--src/highlight.c8
-rw-r--r--src/insexpand.c3
-rw-r--r--src/misc2.c14
-rw-r--r--src/normal.c1
-rw-r--r--src/proto/misc2.pro1
-rw-r--r--src/proto/strings.pro1
-rw-r--r--src/regexp_nfa.c3
-rw-r--r--src/search.c2
-rw-r--r--src/strings.c27
-rw-r--r--src/testdir/crash/heap_overflow_glob2regpatbin0 -> 200 bytes
-rw-r--r--src/testdir/crash/nullptr_regexp_nfabin0 -> 429 bytes
-rw-r--r--src/testdir/dumps/Test_pum_highlights_15.dump2
-rw-r--r--src/testdir/dumps/Test_smooth_long_scrolloff_1.dump16
-rw-r--r--src/testdir/dumps/Test_smooth_long_scrolloff_7.dump14
-rw-r--r--src/testdir/test_autocmd.vim19
-rw-r--r--src/testdir/test_crash.vim11
-rw-r--r--src/testdir/test_normal.vim13
-rw-r--r--src/testdir/test_popup.vim2
-rw-r--r--src/testdir/test_scroll_opt.vim2
-rw-r--r--src/version.c22
25 files changed, 137 insertions, 43 deletions
diff --git a/src/Makefile b/src/Makefile
index 257742f..0b4a453 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -2939,6 +2939,7 @@ shadow: runtime pixmaps
../../testdir/*.py \
../../testdir/python* \
../../testdir/pyxfile \
+ ../../testdir/ru_RU \
../../testdir/sautest \
../../testdir/samples \
../../testdir/dumps \
diff --git a/src/charset.c b/src/charset.c
index 19b0895..399f258 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1678,6 +1678,9 @@ getvcol(
}
clear_chartabsize_arg(&cts);
+ if (*ptr == NUL && pos->col < MAXCOL && pos->col > ptr - line)
+ pos->col = ptr - line;
+
if (start != NULL)
*start = vcol + head;
if (end != NULL)
diff --git a/src/drawscreen.c b/src/drawscreen.c
index 9096c28..1802ade 100644
--- a/src/drawscreen.c
+++ b/src/drawscreen.c
@@ -2774,7 +2774,7 @@ win_update(win_T *wp)
redrawWinline(wp, wp->w_cursor.lnum);
}
#endif
- // New redraw either due to updated topline or due to wcol fix.
+ // New redraw either due to updated topline, wcol fix or reset skipcol.
if (wp->w_redr_type != 0)
{
// Don't update for changes in buffer again.
@@ -2782,6 +2782,7 @@ win_update(win_T *wp)
curbuf->b_mod_set = FALSE;
j = curbuf->b_mod_xlines;
curbuf->b_mod_xlines = 0;
+ curs_columns(TRUE);
win_update(curwin);
curbuf->b_mod_set = i;
curbuf->b_mod_xlines = j;
diff --git a/src/edit.c b/src/edit.c
index 8a37a61..e1f30c7 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -512,6 +512,7 @@ edit(
#ifdef FEAT_DIFF
&& curwin->w_topfill == old_topfill
#endif
+ && count <= 1
)
{
mincol = curwin->w_wcol;
@@ -549,11 +550,13 @@ edit(
}
// May need to adjust w_topline to show the cursor.
- update_topline();
+ if (count <= 1)
+ update_topline();
did_backspace = FALSE;
- validate_cursor(); // may set must_redraw
+ if (count <= 1)
+ validate_cursor(); // may set must_redraw
/*
* Redraw the display when no characters are waiting.
@@ -566,7 +569,8 @@ edit(
if (curwin->w_p_crb)
do_check_cursorbind();
- update_curswant();
+ if (count <= 1)
+ update_curswant();
old_topline = curwin->w_topline;
#ifdef FEAT_DIFF
old_topfill = curwin->w_topfill;
diff --git a/src/fileio.c b/src/fileio.c
index d27a172..5fee4e0 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -5714,6 +5714,8 @@ file_pat_to_reg_pat(
)
*allow_dirs = TRUE;
reg_pat[i++] = '\\';
+ if (enc_dbcs != 0 && (*mb_ptr2len)(p) > 1)
+ reg_pat[i++] = *p++;
reg_pat[i++] = *p;
}
break;
diff --git a/src/highlight.c b/src/highlight.c
index d3ea2d2..0928952 100644
--- a/src/highlight.c
+++ b/src/highlight.c
@@ -1215,8 +1215,8 @@ highlight_set_cterm_color(
target.key = 0;
target.value = (char *)arg;
- target.length = 0; // not used, see cmp_keyvalue_value_i()
- entry = (keyvalue_T *)bsearch(&target, &color_name_tab, ARRAY_LENGTH(color_name_tab), sizeof(color_name_tab[0]), cmp_keyvalue_value_i);
+ target.length = 0; // not used, see cmp_keyvalue_value_ni()
+ entry = (keyvalue_T *)bsearch(&target, &color_name_tab, ARRAY_LENGTH(color_name_tab), sizeof(color_name_tab[0]), cmp_keyvalue_value_ni);
if (entry == NULL)
{
semsg(_(e_color_name_or_number_not_recognized_str), key_start);
@@ -2542,8 +2542,8 @@ gui_get_color_cmn(char_u *name)
target.key = 0;
target.value = (char *)name;
- target.length = 0; // not used, see cmp_keyvalue_value_i()
- entry = (keyvalue_T *)bsearch(&target, &rgb_tab, ARRAY_LENGTH(rgb_tab), sizeof(rgb_tab[0]), cmp_keyvalue_value_i);
+ target.length = 0; // not used, see cmp_keyvalue_value_ni()
+ entry = (keyvalue_T *)bsearch(&target, &rgb_tab, ARRAY_LENGTH(rgb_tab), sizeof(rgb_tab[0]), cmp_keyvalue_value_ni);
if (entry != NULL)
return gui_adjust_rgb((guicolor_T)entry->key);
diff --git a/src/insexpand.c b/src/insexpand.c
index af818d4..d424fff 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -3546,7 +3546,8 @@ static int compare_scores(const void *a, const void *b)
int idx_b = *(const int *)b;
int score_a = compl_fuzzy_scores[idx_a];
int score_b = compl_fuzzy_scores[idx_b];
- return (score_a > score_b) ? -1 : (score_a < score_b) ? 1 : 0;
+ return score_a == score_b ? (idx_a == idx_b ? 0 : (idx_a < idx_b ? -1 : 1))
+ : (score_a > score_b ? -1 : 1);
}
/*
diff --git a/src/misc2.c b/src/misc2.c
index b5044fb..5a8f369 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -3090,17 +3090,7 @@ cmp_keyvalue_value_n(const void *a, const void *b)
return STRNCMP(kv1->value, kv2->value, MAX(kv1->length, kv2->length));
}
-// compare two keyvalue_T structs by case insensitive value
- int
-cmp_keyvalue_value_i(const void *a, const void *b)
-{
- keyvalue_T *kv1 = (keyvalue_T *)a;
- keyvalue_T *kv2 = (keyvalue_T *)b;
-
- return STRICMP(kv1->value, kv2->value);
-}
-
-// compare two keyvalue_T structs by case insensitive value
+// compare two keyvalue_T structs by case insensitive ASCII value
// with length
int
cmp_keyvalue_value_ni(const void *a, const void *b)
@@ -3108,6 +3098,6 @@ cmp_keyvalue_value_ni(const void *a, const void *b)
keyvalue_T *kv1 = (keyvalue_T *)a;
keyvalue_T *kv2 = (keyvalue_T *)b;
- return STRNICMP(kv1->value, kv2->value, MAX(kv1->length, kv2->length));
+ return vim_strnicmp_asc(kv1->value, kv2->value, MAX(kv1->length, kv2->length));
}
diff --git a/src/normal.c b/src/normal.c
index a929dd8..b054005 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -6227,6 +6227,7 @@ nv_g_cmd(cmdarg_T *cap)
#ifdef FEAT_BYTEOFF
// "go": goto byte count from start of buffer
case 'o':
+ oap->inclusive = FALSE;
goto_byte(cap->count0);
break;
#endif
diff --git a/src/proto/misc2.pro b/src/proto/misc2.pro
index 7a5b367..dbcfc08 100644
--- a/src/proto/misc2.pro
+++ b/src/proto/misc2.pro
@@ -63,6 +63,5 @@ int build_argv_from_list(list_T *l, char ***argv, int *argc);
int get_special_pty_type(void);
int cmp_keyvalue_value(const void *a, const void *b);
int cmp_keyvalue_value_n(const void *a, const void *b);
-int cmp_keyvalue_value_i(const void *a, const void *b);
int cmp_keyvalue_value_ni(const void *a, const void *b);
/* vim: set ft=c : */
diff --git a/src/proto/strings.pro b/src/proto/strings.pro
index aa8b374..b792edc 100644
--- a/src/proto/strings.pro
+++ b/src/proto/strings.pro
@@ -15,6 +15,7 @@ void vim_strcat(char_u *to, char_u *from, size_t tosize);
size_t vim_strlen_maxlen(char *s, size_t maxlen);
int vim_stricmp(char *s1, char *s2);
int vim_strnicmp(char *s1, char *s2, size_t len);
+int vim_strnicmp_asc(char *s1, char *s2, size_t len);
char_u *vim_strchr(char_u *string, int c);
char_u *vim_strbyte(char_u *string, int c);
char_u *vim_strrchr(char_u *string, int c);
diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c
index 6db4134..557d0e1 100644
--- a/src/regexp_nfa.c
+++ b/src/regexp_nfa.c
@@ -6525,7 +6525,8 @@ nfa_regmatch(
else
result = FAIL;
- if (t->state->out->out1->c == NFA_END_COMPOSING)
+ if (t->state->out->out1 != NULL
+ && t->state->out->out1->c == NFA_END_COMPOSING)
{
end = t->state->out->out1;
ADD_STATE_IF_MATCH(end);
diff --git a/src/search.c b/src/search.c
index e5936d8..a7fd44e 100644
--- a/src/search.c
+++ b/src/search.c
@@ -5217,7 +5217,7 @@ search_for_fuzzy_match(
{
pos_T current_pos = *pos;
pos_T circly_end;
- int found_new_match = FAIL;
+ int found_new_match = FALSE;
int looped_around = FALSE;
if (whole_line)
diff --git a/src/strings.c b/src/strings.c
index b8ea00b..a586d8a 100644
--- a/src/strings.c
+++ b/src/strings.c
@@ -590,6 +590,33 @@ vim_strnicmp(char *s1, char *s2, size_t len)
#endif
/*
+ * Compare two ASCII strings, for length "len", ignoring case, ignoring locale
+ * (mostly matters for turkish locale where i I might be different).
+ * return 0 for match, < 0 for smaller, > 0 for bigger
+ */
+ int
+vim_strnicmp_asc(char *s1, char *s2, size_t len)
+{
+ int i;
+ int save_cmp_flags = cmp_flags;
+
+ cmp_flags |= CMP_KEEPASCII; // compare by ASCII value, ignoring locale
+ while (len > 0)
+ {
+ i = vim_tolower(*s1) - vim_tolower(*s2);
+ if (i != 0)
+ break; // this character is different
+ if (*s1 == NUL)
+ break; // strings match until NUL
+ ++s1;
+ ++s2;
+ --len;
+ }
+ cmp_flags = save_cmp_flags;
+ return i;
+}
+
+/*
* Search for first occurrence of "c" in "string".
* Version of strchr() that handles unsigned char strings with characters from
* 128 to 255 correctly. It also doesn't return a pointer to the NUL at the
diff --git a/src/testdir/crash/heap_overflow_glob2regpat b/src/testdir/crash/heap_overflow_glob2regpat
new file mode 100644
index 0000000..8baf6f3
--- /dev/null
+++ b/src/testdir/crash/heap_overflow_glob2regpat
Binary files differ
diff --git a/src/testdir/crash/nullptr_regexp_nfa b/src/testdir/crash/nullptr_regexp_nfa
new file mode 100644
index 0000000..6b2edc6
--- /dev/null
+++ b/src/testdir/crash/nullptr_regexp_nfa
Binary files differ
diff --git a/src/testdir/dumps/Test_pum_highlights_15.dump b/src/testdir/dumps/Test_pum_highlights_15.dump
index e923b43..199f753 100644
--- a/src/testdir/dumps/Test_pum_highlights_15.dump
+++ b/src/testdir/dumps/Test_pum_highlights_15.dump
@@ -1,4 +1,4 @@
-|/+0&#ffffff0|n|o|n|_|e|x|i|t|_|f|o|l|d|e|r> @58
+|/+0&#ffffff0|n|o|n|_|e|x|i|s|t|i|n|g|_|f|o|l|d|e|r> @54
|~+0#4040ff13&| @73
|~| @73
|~| @73
diff --git a/src/testdir/dumps/Test_smooth_long_scrolloff_1.dump b/src/testdir/dumps/Test_smooth_long_scrolloff_1.dump
index 6c1d223..f6ca843 100644
--- a/src/testdir/dumps/Test_smooth_long_scrolloff_1.dump
+++ b/src/testdir/dumps/Test_smooth_long_scrolloff_1.dump
@@ -1,8 +1,8 @@
-| +0&#ffffff0@39
-@40
-@40
-> @39
-@40
-@40
-@40
-@40
+|<+0#4040ff13#ffffff0@2|t+0#0000000&|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t
+|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l
+|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g|
+>t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o|
+|l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g
+| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o
+| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n
+| @39
diff --git a/src/testdir/dumps/Test_smooth_long_scrolloff_7.dump b/src/testdir/dumps/Test_smooth_long_scrolloff_7.dump
index c21c022..6d7e157 100644
--- a/src/testdir/dumps/Test_smooth_long_scrolloff_7.dump
+++ b/src/testdir/dumps/Test_smooth_long_scrolloff_7.dump
@@ -1,8 +1,8 @@
-| +0&#ffffff0@39
-@40
-@40
-@40
-@40
-@40
-> @39
+|<+0#4040ff13#ffffff0@2|l+0#0000000&|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l
+|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g|
+|t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o|
+|l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g
+| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o
+| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n
+>g| |t|w|o| |l|o|n|g| |t|w|o| |l|o|n|g| @20
@40
diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim
index 5a91351..a863a23 100644
--- a/src/testdir/test_autocmd.vim
+++ b/src/testdir/test_autocmd.vim
@@ -4863,5 +4863,24 @@ func Test_WinNewPre_crash()
let &cmdheight=_cmdheight
endfunc
+" The specifics of the turkish locale may
+" cause that Vim will not treat the GuiEnter autocommand
+" as case insensitive and instead issues an error
+func Test_GuiEnter_Turkish_locale()
+ try
+ let lng = v:lang
+ lang tr_TR.UTF-8
+ let result = execute(':au GuiEnter')
+ call assert_equal("\n--- Autocommands ---", result)
+ let result = execute(':au GUIENTER')
+ call assert_equal("\n--- Autocommands ---", result)
+ let result = execute(':au guienter')
+ call assert_equal("\n--- Autocommands ---", result)
+ exe ":lang" lng
+ catch /E197:/
+ " can't use Turkish locale
+ throw 'Skipped: Turkish locale not available'
+ endtry
+endfunc
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_crash.vim b/src/testdir/test_crash.vim
index b334876..bfd04ff 100644
--- a/src/testdir/test_crash.vim
+++ b/src/testdir/test_crash.vim
@@ -222,6 +222,17 @@ func Test_crash1_3()
call term_sendkeys(buf, args)
call TermWait(buf, 150)
+ let file = 'crash/heap_overflow_glob2regpat'
+ 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)
+ call TermWait(buf, 50)
+
+ let file = 'crash/nullptr_regexp_nfa'
+ 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)
+ call TermWait(buf, 50)
" clean up
exe buf .. "bw!"
diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim
index 398bf29..adb5ce7 100644
--- a/src/testdir/test_normal.vim
+++ b/src/testdir/test_normal.vim
@@ -4281,4 +4281,17 @@ func Test_scroll_longline_no_loop()
exe "normal! \<C-E>"
bwipe!
endfunc
+
+" Test for go command
+func Test_normal_go()
+ new
+ call setline(1, ['one two three four'])
+ call cursor(1, 5)
+ norm! dvgo
+ call assert_equal('wo three four', getline(1))
+ norm! ...
+ call assert_equal('three four', getline(1))
+
+ bwipe!
+endfunc
" vim: shiftwidth=2 sts=2 expandtab nofoldenable
diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim
index fe958da..caec8ff 100644
--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -1494,7 +1494,7 @@ func Test_pum_highlights_match()
call VerifyScreenDump(buf, 'Test_pum_highlights_11', {})
" issue #15357
- call term_sendkeys(buf, "\<ESC>S/non_exit_folder\<C-X>\<C-F>")
+ call term_sendkeys(buf, "\<ESC>S/non_existing_folder\<C-X>\<C-F>")
call TermWait(buf, 50)
call VerifyScreenDump(buf, 'Test_pum_highlights_15', {})
diff --git a/src/testdir/test_scroll_opt.vim b/src/testdir/test_scroll_opt.vim
index 1b60019..47a3cf8 100644
--- a/src/testdir/test_scroll_opt.vim
+++ b/src/testdir/test_scroll_opt.vim
@@ -1162,7 +1162,6 @@ func Test_smooth_long_scrolloff()
END
call writefile(lines, 'XSmoothLongScrolloff', 'D')
let buf = RunVimInTerminal('-u NONE -S XSmoothLongScrolloff', #{rows: 8, cols: 40})
- "FIXME: empty screen due to reset_skipcol()/curs_columns() shenanigans
call term_sendkeys(buf, ":norm j721|\<CR>")
call VerifyScreenDump(buf, 'Test_smooth_long_scrolloff_1', {})
@@ -1182,7 +1181,6 @@ func Test_smooth_long_scrolloff()
call VerifyScreenDump(buf, 'Test_smooth_long_scrolloff_6', {})
call term_sendkeys(buf, "gk")
- "FIXME: empty screen due to reset_skipcol()/curs_columns() shenanigans
call VerifyScreenDump(buf, 'Test_smooth_long_scrolloff_7', {})
call StopVimInTerminal(buf)
diff --git a/src/version.c b/src/version.c
index 314a320..2c9ae2c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,28 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 709,
+/**/
+ 708,
+/**/
+ 707,
+/**/
+ 706,
+/**/
+ 705,
+/**/
+ 704,
+/**/
+ 703,
+/**/
+ 702,
+/**/
+ 701,
+/**/
+ 700,
+/**/
+ 699,
+/**/
698,
/**/
697,