Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into tabsidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
rbtnn committed Dec 24, 2024
2 parents 5c2b180 + e62d93e commit 5902458
Show file tree
Hide file tree
Showing 17 changed files with 93 additions and 28 deletions.
8 changes: 4 additions & 4 deletions runtime/filetype.vim
Original file line number Diff line number Diff line change
Expand Up @@ -1384,9 +1384,9 @@ au BufNewFile,BufRead *.ly,*.ily setf lilypond
" Lisp (*.el = ELisp)
" *.jl was removed, it's also used for Julia, better skip than guess wrong.
if has("fname_case")
au BufNewFile,BufRead *.lsp,*.lisp,*.asd,*.el,*.L,.emacs,.sawfishrc,*.stsg,*/supertux2/config setf lisp
au BufNewFile,BufRead *.lsp,*.lisp,*.asd,*.el,*.L,.emacs,.sawfishrc setf lisp
else
au BufNewFile,BufRead *.lsp,*.lisp,*.asd,*.el,.emacs,.sawfishrc,*.stsg,*/supertux2/config setf lisp
au BufNewFile,BufRead *.lsp,*.lisp,*.asd,*.el,.emacs,.sawfishrc setf lisp
endif

" *.cl = Common Lisp or OpenCL
Expand Down Expand Up @@ -2314,8 +2314,8 @@ au BufNewFile,BufRead *.zsh,*.zsh-theme,*.zunit setf zsh
" Salt state files
au BufNewFile,BufRead *.sls setf salt

" Scheme ("racket" patterns are now separate, see above)
au BufNewFile,BufRead *.scm,*.ss,*.sld setf scheme
" Scheme, Supertux configuration ("racket" patterns are now separate, see above)
au BufNewFile,BufRead *.scm,*.ss,*.sld,*.stsg,*/supertux2/config setf scheme

" Screen RC
au BufNewFile,BufRead .screenrc,screenrc setf screen
Expand Down
5 changes: 3 additions & 2 deletions src/drawline.c
Original file line number Diff line number Diff line change
Expand Up @@ -1869,7 +1869,7 @@ win_line(
}
#endif

if ((State & MODE_INSERT) && in_curline && ins_compl_active())
if ((State & MODE_INSERT) && in_curline && ins_compl_win_active(wp))
area_highlighting = TRUE;

#ifdef FEAT_SYN_HL
Expand Down Expand Up @@ -2415,7 +2415,8 @@ win_line(
#endif

// Check if ComplMatchIns highlight is needed.
if ((State & MODE_INSERT) && in_curline && ins_compl_active())
if ((State & MODE_INSERT) && in_curline
&& ins_compl_win_active(wp))
{
int ins_match_attr =
ins_compl_col_range_attr((int)(ptr - line));
Expand Down
14 changes: 7 additions & 7 deletions src/ex_getln.c
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ may_adjust_incsearch_highlighting(
return FAIL;
}
skiplen = 0;
patlen = last_search_pattern_len();
patlen = (int)last_search_pattern_len();
}
else
pat = ccline.cmdbuff + skiplen;
Expand Down Expand Up @@ -1472,7 +1472,7 @@ cmdline_browse_history(
}
if (i == 0)
{
alloc_cmdbuff(len);
alloc_cmdbuff((int)len);
if (ccline.cmdbuff == NULL)
{
res = GOTO_NORMAL_MODE;
Expand All @@ -1481,18 +1481,18 @@ cmdline_browse_history(
}
}
ccline.cmdbuff[len] = NUL;
ccline.cmdpos = ccline.cmdlen = len;
ccline.cmdpos = ccline.cmdlen = (int)len;
}
else
{
alloc_cmdbuff(plen);
alloc_cmdbuff((int)plen);
if (ccline.cmdbuff == NULL)
{
res = GOTO_NORMAL_MODE;
goto done;
}
STRCPY(ccline.cmdbuff, p);
ccline.cmdpos = ccline.cmdlen = plen;
ccline.cmdpos = ccline.cmdlen = (int)plen;
}

redrawcmd();
Expand Down Expand Up @@ -4778,8 +4778,8 @@ open_cmdwin(void)
{
// Execute the command directly.
ccline.cmdbuff = vim_strnsave(p, plen);
ccline.cmdlen = plen;
ccline.cmdbufflen = plen + 1;
ccline.cmdlen = (int)plen;
ccline.cmdbufflen = (int)(plen + 1);
cmdwin_result = CAR;
}
else
Expand Down
2 changes: 1 addition & 1 deletion src/filepath.c
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ modify_fname(
if (s != NULL)
{
*fnamep = s;
*fnamelen = slen;
*fnamelen = (int)slen;
vim_free(*bufp);
*bufp = s;
didit = TRUE;
Expand Down
17 changes: 17 additions & 0 deletions src/insexpand.c
Original file line number Diff line number Diff line change
Expand Up @@ -1864,6 +1864,23 @@ ins_compl_active(void)
return compl_started;
}

/*
* Return True when wp is the actual completion window
*/
int
ins_compl_win_active(win_T *wp UNUSED)
{
return ins_compl_active()
#if defined(FEAT_QUICKFIX)
&& (!wp->w_p_pvw
# ifdef FEAT_PROP_POPUP
&& !(wp->w_popup_flags & POPF_INFO)
# endif
)
#endif
;
}

/*
* Selected one of the matches. When FALSE the match was edited or using the
* longest common string.
Expand Down
6 changes: 3 additions & 3 deletions src/option.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ set_init_default_backupskip(void)
itemlen = vim_snprintf((char *)item, itemsize, "%s%s*", p, (has_trailing_path_sep) ? "" : PATHSEPSTR);

if (find_dup_item(ga.ga_data, item, itemlen, options[opt_idx].flags) == NULL
&& ga_grow(&ga, itemseplen + itemlen + 1) == OK)
&& ga_grow(&ga, (int)(itemseplen + itemlen + 1)) == OK)
{
ga.ga_len += vim_snprintf((char *)ga.ga_data + ga.ga_len,
itemseplen + itemlen + 1,
Expand Down Expand Up @@ -8418,7 +8418,7 @@ vimrc_found(char_u *fname, char_u *envname)
if (vim_getenv((char_u *)"MYVIMDIR", &dofree) == NULL)
{
size_t usedlen = 0;
int len = 0;
size_t len = 0;
char_u *fbuf = NULL;

if (STRNCMP(gettail(fname), ".vimrc", 6) == 0)
Expand Down Expand Up @@ -8455,7 +8455,7 @@ vimrc_found(char_u *fname, char_u *envname)
}
#endif
else
(void)modify_fname((char_u *)":h", FALSE, &usedlen, &p, &fbuf, &len);
(void)modify_fname((char_u *)":h", FALSE, &usedlen, &p, &fbuf, (int *)&len);

if (p != NULL)
{
Expand Down
5 changes: 3 additions & 2 deletions src/popupmenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ pum_set_selected(int n, int repeat UNUSED)
{
int resized = FALSE;
int context = pum_height / 2;
int scroll_offset = pum_selected - pum_height;
int scroll_offset;
#ifdef FEAT_QUICKFIX
int prev_selected = pum_selected;
unsigned cur_cot_flags = get_cot_flags();
Expand All @@ -927,6 +927,7 @@ pum_set_selected(int n, int repeat UNUSED)
#endif

pum_selected = n;
scroll_offset = pum_selected - pum_height;

if (pum_selected >= 0 && pum_selected < pum_size)
{
Expand All @@ -950,7 +951,7 @@ pum_set_selected(int n, int repeat UNUSED)
// scroll up; when we did a jump it's probably a PageDown then
// scroll a whole page
if (pum_first < scroll_offset + 3)
pum_first = MAX(pum_first, scroll_offset + 1);
pum_first = MAX(pum_first + pum_height - 2, scroll_offset + 1);
else
pum_first = scroll_offset + 1;
}
Expand Down
1 change: 1 addition & 0 deletions src/proto/insexpand.pro
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ char_u *find_word_start(char_u *ptr);
char_u *find_word_end(char_u *ptr);
void ins_compl_clear(void);
int ins_compl_active(void);
int ins_compl_win_active(win_T *wp);
int ins_compl_used_match(void);
void ins_compl_init_get_longest(void);
int ins_compl_interrupted(void);
Expand Down
20 changes: 20 additions & 0 deletions src/testdir/dumps/Test_pum_matchins_11.dump
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
|i+0&#ffffff0|n|f|o| @70
|~+0#4040ff13&| @73
|~| @73
|[+1#0000000&|S|c|r|a|t|c|h|]| |[|P|r|e|v|i|e|w|]| @37|1|,|1| @11|A|l@1
|f+0&&|o@1> @71
|f+0#0000001#e0e0e08|o@1| @11| +0#4040ff13#ffffff0@59
|b+0#0000001#ffd7ff255|a|r| @11| +0#4040ff13#ffffff0@59
|你*0#0000001#ffd7ff255|好| +&@10| +0#4040ff13#ffffff0@59
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|[+3#0000000&|N|o| |N|a|m|e|]| |[|+|]| @43|1|,|1| @11|A|l@1
|-+2&&@1| |O|m|n|i| |c|o|m|p|l|e|t|i|o|n| |(|^|O|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |3| +0#0000000&@34
4 changes: 2 additions & 2 deletions src/testdir/test_filetype.vim
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ def s:GetFilenameChecks(): dict<list<string>>
limits: ['/etc/limits', '/etc/anylimits.conf', '/etc/anylimits.d/file.conf', '/etc/limits.conf', '/etc/limits.d/file.conf', '/etc/some-limits.conf', '/etc/some-limits.d/file.conf', 'any/etc/limits', 'any/etc/limits.conf', 'any/etc/limits.d/file.conf', 'any/etc/some-limits.conf', 'any/etc/some-limits.d/file.conf'],
liquidsoap: ['file.liq'],
liquid: ['file.liquid'],
lisp: ['file.lsp', 'file.lisp', 'file.asd', 'file.el', '.emacs', '.sawfishrc', 'sbclrc', '.sbclrc', 'file.stsg', 'any/local/share/supertux2/config'],
lisp: ['file.lsp', 'file.lisp', 'file.asd', 'file.el', '.emacs', '.sawfishrc', 'sbclrc', '.sbclrc'],
lite: ['file.lite', 'file.lt'],
litestep: ['/LiteStep/any/file.rc', 'any/LiteStep/any/file.rc'],
logcheck: ['/etc/logcheck/file.d-some/file', '/etc/logcheck/file.d/file', 'any/etc/logcheck/file.d-some/file', 'any/etc/logcheck/file.d/file'],
Expand Down Expand Up @@ -671,7 +671,7 @@ def s:GetFilenameChecks(): dict<list<string>>
sather: ['file.sa'],
sbt: ['file.sbt'],
scala: ['file.scala'],
scheme: ['file.scm', 'file.ss', 'file.sld'],
scheme: ['file.scm', 'file.ss', 'file.sld', 'file.stsg', 'any/local/share/supertux2/config'],
scilab: ['file.sci', 'file.sce'],
screen: ['.screenrc', 'screenrc'],
scss: ['file.scss'],
Expand Down
21 changes: 20 additions & 1 deletion src/testdir/test_popup.vim
Original file line number Diff line number Diff line change
Expand Up @@ -1715,11 +1715,15 @@ endfunc
func Test_pum_matchins_highlight()
CheckScreendump
let lines =<< trim END
let g:change = 0
func Omni_test(findstart, base)
if a:findstart
return col(".")
endif
return [#{word: "foo"}, #{word: "bar"}, #{word: "你好"}]
if g:change == 0
return [#{word: "foo"}, #{word: "bar"}, #{word: "你好"}]
endif
return [#{word: "foo", info: "info"}, #{word: "bar"}, #{word: "你好"}]
endfunc
set omnifunc=Omni_test
hi ComplMatchIns ctermfg=red
Expand Down Expand Up @@ -1766,6 +1770,10 @@ func Test_pum_matchins_highlight()
call VerifyScreenDump(buf, 'Test_pum_matchins_10', {})
call term_sendkeys(buf, "\<Esc>")

call term_sendkeys(buf, ":let g:change=1\<CR>S\<C-X>\<C-O>")
call VerifyScreenDump(buf, 'Test_pum_matchins_11', {})
call term_sendkeys(buf, "\<Esc>")

call StopVimInTerminal(buf)
endfunc

Expand Down Expand Up @@ -1811,4 +1819,15 @@ func Test_pum_matchins_highlight_combine()
call StopVimInTerminal(buf)
endfunc

" this used to crash
func Test_popup_completion_many_ctrlp()
new
let candidates=repeat(['a0'], 99)
call setline(1, candidates)
exe ":norm! VGg\<C-A>"
norm! G
call feedkeys("o" .. repeat("\<c-p>", 100), 'tx')
bw!
endfunc

" vim: shiftwidth=2 sts=2 expandtab
2 changes: 1 addition & 1 deletion src/undo.c
Original file line number Diff line number Diff line change
Expand Up @@ -3124,7 +3124,7 @@ ex_undolist(exarg_T *eap UNUSED)

// we have to call STRLEN() here because add_time() does not report
// the number of characters added.
len += STRLEN(IObuff + len);
len += (int)STRLEN(IObuff + len);
if (uhp->uh_save_nr > 0)
{
int n = (len >= 33) ? 0 : 33 - len;
Expand Down
4 changes: 2 additions & 2 deletions src/usercmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ uc_list(char_u *name, size_t name_len)
if (entry != NULL)
{
STRCPY(IObuff + len, entry->value.string);
len += entry->value.length;
len += (int)entry->value.length;
#ifdef FEAT_EVAL
if (p_verbose > 0 && cmd->uc_compl_arg != NULL)
{
Expand All @@ -681,7 +681,7 @@ uc_list(char_u *name, size_t name_len)
{
IObuff[len++] = ',';
STRCPY(IObuff + len, cmd->uc_compl_arg);
len += uc_compl_arglen;
len += (int)uc_compl_arglen;
}
}
#endif
Expand Down
6 changes: 6 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,12 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
958,
/**/
957,
/**/
956,
/**/
955,
/**/
Expand Down
2 changes: 1 addition & 1 deletion src/vim9compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1838,7 +1838,7 @@ compile_lhs_script_var(
int script_var = FALSE;
imported_T *import;
char_u *var_name;
int var_name_len;
size_t var_name_len;

if (lhs->lhs_varlen > 1 && STRNCMP(var_start, "s:", 2) == 0)
script_namespace = TRUE;
Expand Down
2 changes: 1 addition & 1 deletion src/vim9execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -3184,7 +3184,7 @@ any_var_get_obj_member(class_T *current_class, isn_T *iptr, typval_T *tv)
copy_tv(tv, &mtv);

// 'name' can either be a object variable or a object method
int namelen = STRLEN(iptr->isn_arg.string);
int namelen = (int)STRLEN(iptr->isn_arg.string);
int save_did_emsg = did_emsg;

if (get_member_tv(obj->obj_class, TRUE, iptr->isn_arg.string, namelen,
Expand Down
2 changes: 1 addition & 1 deletion src/viminfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ barline_parse(vir_T *virp, char_u *text, garray_T *values)
// freed later, also need to free "buf" later
value->bv_tofree = buf;
s = sconv;
len = STRLEN(s);
len = (int)STRLEN(s);
converted = TRUE;
}
}
Expand Down

0 comments on commit 5902458

Please sign in to comment.