Compare commits

...

4 Commits

Author SHA1 Message Date
Bram Moolenaar
728a05c4ab patch 8.2.4920: MS-Windows GUI: unused variables
Problem:    MS-Windows GUI: unused variables.
Solution:   Delete the variables. (John Marriott)
2022-05-08 22:37:45 +01:00
Bram Moolenaar
7c824682d2 patch 8.2.4919: can add invalid bytes with :spellgood
Problem:    Can add invalid bytes with :spellgood.
Solution:   Check for a valid word string.
2022-05-08 22:32:58 +01:00
LemonBoy
9830db6305 patch 8.2.4918: conceal character from matchadd() displayed too many times
Problem:    Conceal character from matchadd() displayed too many times.
Solution:   Check the syntax flag. (closes #10381, closes #7268)
2022-05-08 21:25:20 +01:00
Christian Brabandt
cb747899bd patch 8.2.4917: fuzzy expansion of option names is not right
Problem:    Fuzzy expansion of option names is not right.
Solution:   Pass the fuzzy flag down the call chain. (Christian Brabandt,
            closes #10380, closes #10318)
2022-05-08 21:10:56 +01:00
12 changed files with 81 additions and 12 deletions

View File

@@ -2787,7 +2787,7 @@ ExpandFromContext(
if (xp->xp_context == EXPAND_SETTINGS
|| xp->xp_context == EXPAND_BOOL_SETTINGS)
ret = ExpandSettings(xp, &regmatch, pat, numMatches, matches);
ret = ExpandSettings(xp, &regmatch, pat, numMatches, matches, fuzzy);
else if (xp->xp_context == EXPAND_MAPPINGS)
ret = ExpandMappings(pat, &regmatch, numMatches, matches);
# if defined(FEAT_EVAL)

View File

@@ -2477,14 +2477,16 @@ win_line(
#ifdef FEAT_CONCEAL
if ( wp->w_p_cole > 0
&& (wp != curwin || lnum != wp->w_cursor.lnum ||
conceal_cursor_line(wp))
&& (wp != curwin || lnum != wp->w_cursor.lnum
|| conceal_cursor_line(wp))
&& ((syntax_flags & HL_CONCEAL) != 0 || has_match_conc > 0)
&& !(lnum_in_visual_area
&& vim_strchr(wp->w_p_cocu, 'v') == NULL))
{
char_attr = conceal_attr;
if ((prev_syntax_id != syntax_seqnr || has_match_conc > 1)
if (((prev_syntax_id != syntax_seqnr
&& (syntax_flags & HL_CONCEAL) != 0)
|| has_match_conc > 1)
&& (syn_get_sub_char() != NUL
|| (has_match_conc && match_conc)
|| wp->w_p_cole == 1)

View File

@@ -3273,3 +3273,7 @@ EXTERN char e_stray_closing_curly_str[]
EXTERN char e_missing_close_curly_str[]
INIT(= N_("E1279: Missing '}': %s"));
#endif
#ifdef FEAT_SPELL
EXTERN char e_illegal_character_in_word[]
INIT(= N_("E1280: Illegal character in word"));
#endif

View File

@@ -4003,10 +4003,6 @@ static void get_dialog_font_metrics(void);
static int dialog_default_button = -1;
// Intellimouse support
static int mouse_scroll_lines = 0;
static int mouse_scroll_chars = 0;
#ifdef FEAT_TOOLBAR
static void initialise_toolbar(void);
static void update_toolbar_size(void);

View File

@@ -4226,7 +4226,7 @@ theend:
convert_setup(&vimconv, NULL, NULL);
}
#if defined(FEAT_GUI_GTK) || defined(PROTO)
#if defined(FEAT_GUI_GTK) || defined(FEAT_SPELL) || defined(PROTO)
/*
* Return TRUE if string "s" is a valid utf-8 string.
* When "end" is NULL stop at the first NUL.

View File

@@ -6511,7 +6511,8 @@ ExpandSettings(
regmatch_T *regmatch,
char_u *fuzzystr,
int *numMatches,
char_u ***matches)
char_u ***matches,
int can_fuzzy)
{
int num_normal = 0; // Nr of matching non-term-code settings
int num_term = 0; // Nr of matching terminal code settings
@@ -6527,7 +6528,7 @@ ExpandSettings(
int fuzzy;
fuzmatch_str_T *fuzmatch = NULL;
fuzzy = cmdline_fuzzy_complete(fuzzystr);
fuzzy = can_fuzzy && cmdline_fuzzy_complete(fuzzystr);
// do this loop twice:
// loop == 0: count the number of matching options

View File

@@ -64,7 +64,7 @@ void reset_modifiable(void);
void set_iminsert_global(void);
void set_imsearch_global(void);
void set_context_in_set_cmd(expand_T *xp, char_u *arg, int opt_flags);
int ExpandSettings(expand_T *xp, regmatch_T *regmatch, char_u *fuzzystr, int *numMatches, char_u ***matches);
int ExpandSettings(expand_T *xp, regmatch_T *regmatch, char_u *fuzzystr, int *numMatches, char_u ***matches, int do_fuzzy);
int ExpandOldSetting(int *num_file, char_u ***file);
int shortmess(int x);
void vimrc_found(char_u *fname, char_u *envname);

View File

@@ -4390,6 +4390,10 @@ store_word(
int res = OK;
char_u *p;
// Avoid adding illegal bytes to the word tree.
if (enc_utf8 && !utf_valid_string(word, NULL))
return FAIL;
(void)spell_casefold(curwin, word, len, foldword, MAXWLEN);
for (p = pfxlist; res == OK; ++p)
{
@@ -6190,6 +6194,12 @@ spell_add_word(
int i;
char_u *spf;
if (enc_utf8 && !utf_valid_string(word, NULL))
{
emsg(_(e_illegal_character_in_word));
return;
}
if (idx == 0) // use internal wordlist
{
if (int_wordlist == NULL)

View File

@@ -339,6 +339,27 @@ func Test_matchadd_and_syn_conceal()
call assert_equal(screenattr(1, 11) , screenattr(1, 32))
endfunc
func Test_interaction_matchadd_syntax()
CheckRunVimInTerminal
new
" Test for issue #7268 fix.
" When redrawing the second column, win_line() was comparing the sequence
" number of the syntax-concealed region with a bogus zero value that was
" returned for the matchadd-concealed region. Before 8.0.0672 the sequence
" number was never reset, thus masking the problem.
call setline(1, 'aaa|bbb|ccc')
call matchadd('Conceal', '^..', 10, -1, #{conceal: 'X'})
syn match foobar '^.'
setl concealcursor=n conceallevel=1
redraw!
call assert_equal('Xa|bbb|ccc', Screenline(1))
call assert_notequal(screenattr(1, 1), screenattr(1, 2))
bwipe!
endfunc
func Test_cursor_column_in_concealed_line_after_window_scroll()
CheckRunVimInTerminal

View File

@@ -1257,4 +1257,26 @@ func Test_opt_cdhome()
set cdhome&
endfunc
func Test_set_completion_2()
CheckOption termguicolors
" Test default option completion
set wildoptions=
call feedkeys(":set termg\<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"set termguicolors', @:)
call feedkeys(":set notermg\<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"set notermguicolors', @:)
" Test fuzzy option completion
set wildoptions=fuzzy
call feedkeys(":set termg\<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"set termguicolors termencoding', @:)
call feedkeys(":set notermg\<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"set notermguicolors', @:)
set wildoptions=
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -780,5 +780,10 @@ func Test_no_crash_with_weird_text()
bwipe!
endfunc
" Invalid bytes may cause trouble when creating the word list.
func Test_check_for_valid_word()
call assert_fails("spellgood! 0\xac", 'E1280:')
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -746,6 +746,14 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
4920,
/**/
4919,
/**/
4918,
/**/
4917,
/**/
4916,
/**/