1
0
forked from aniani/vim

patch 8.1.2373: cannot build with +popupwin but without +quickfix

Problem:    Cannot build with +popupwin but without +quickfix. (John Marriott)
Solution:   Adjust #ifdefs.
This commit is contained in:
Bram Moolenaar
2019-12-01 15:23:11 +01:00
parent 9625d3d92d
commit 5a4c3082d7
27 changed files with 218 additions and 135 deletions

View File

@@ -3016,7 +3016,7 @@ do_ecmd(
#ifdef FEAT_TITLE
maketitle();
#endif
#ifdef FEAT_PROP_POPUP
#if defined(FEAT_PROP_POPUP) && defined(FEAT_QUICKFIX)
if (WIN_IS_POPUP(curwin) && curwin->w_p_pvw && retval != FAIL)
popup_set_title(curwin);
#endif

View File

@@ -3366,7 +3366,7 @@ shorten_fnames(int force)
}
status_redraw_all();
redraw_tabline = TRUE;
#ifdef FEAT_PROP_POPUP
#if defined(FEAT_PROP_POPUP) && defined(FEAT_QUICKFIX)
popup_update_preview_title();
#endif
}

View File

@@ -621,7 +621,7 @@ pum_redraw(void)
#endif
}
#if defined(FEAT_PROP_POPUP) && defined(FEAT_QUICKFIX)
#if (defined(FEAT_PROP_POPUP) && defined(FEAT_QUICKFIX)) || defined(PROTO)
/*
* Position the info popup relative to the popup menu item.
*/
@@ -683,7 +683,7 @@ pum_set_selected(int n, int repeat UNUSED)
#ifdef FEAT_QUICKFIX
int prev_selected = pum_selected;
#endif
#ifdef FEAT_PROP_POPUP
#if defined(FEAT_PROP_POPUP) && defined(FEAT_QUICKFIX)
int has_info = FALSE;
#endif

View File

@@ -2386,8 +2386,10 @@ f_popup_show(typval_T *argvars, typval_T *rettv UNUSED)
if (wp != NULL)
{
popup_show(wp);
#ifdef FEAT_QUICKFIX
if (wp->w_popup_flags & POPF_INFO)
pum_position_info_popup(wp);
#endif
}
}
@@ -3686,6 +3688,13 @@ set_ref_in_popups(int copyID)
return abort;
}
int
popup_is_popup(win_T *wp)
{
return wp->w_popup_flags != 0;
}
#if defined(FEAT_QUICKFIX) || defined(PROTO)
/*
* Find an existing popup used as the preview window, in the current tab page.
* Return NULL if not found.
@@ -3702,13 +3711,6 @@ popup_find_preview_window(void)
return NULL;
}
int
popup_is_popup(win_T *wp)
{
return wp->w_popup_flags != 0;
}
#if defined(FEAT_QUICKFIX) || defined(PROTO)
/*
* Find an existing popup used as the info window, in the current tab page.
* Return NULL if not found.
@@ -3729,19 +3731,28 @@ popup_find_info_window(void)
void
f_popup_findinfo(typval_T *argvars UNUSED, typval_T *rettv)
{
#ifdef FEAT_QUICKFIX
win_T *wp = popup_find_info_window();
rettv->vval.v_number = wp == NULL ? 0 : wp->w_id;
#else
rettv->vval.v_number = 0;
#endif
}
void
f_popup_findpreview(typval_T *argvars UNUSED, typval_T *rettv)
{
#ifdef FEAT_QUICKFIX
win_T *wp = popup_find_preview_window();
rettv->vval.v_number = wp == NULL ? 0 : wp->w_id;
#else
rettv->vval.v_number = 0;
#endif
}
#if defined(FEAT_QUICKFIX) || defined(PROTO)
/*
* Create a popup to be used as the preview or info window.
* NOTE: this makes the popup the current window, so that the file can be
@@ -3775,7 +3786,6 @@ popup_create_preview_window(int info)
return OK;
}
#if defined(FEAT_QUICKFIX) || defined(PROTO)
/*
* Close any preview popup.
*/
@@ -3851,6 +3861,7 @@ popup_set_title(win_T *wp)
}
}
# if defined(FEAT_QUICKFIX) || defined(PROTO)
/*
* If there is a preview window, update the title.
* Used after changing directory.
@@ -3863,5 +3874,6 @@ popup_update_preview_title(void)
if (wp != NULL)
popup_set_title(wp);
}
# endif
#endif // FEAT_PROP_POPUP

View File

@@ -9,7 +9,7 @@ STARTTEST
:so small.vim
:set encoding=latin1
:set noswapfile
:if !has('python') | e! test.ok | wq! test.out | endif
:if !has('python') || !has('quickfix') | e! test.ok | wq! test.out | endif
:lang C
:fun Test()
:py import vim

View File

@@ -3,7 +3,7 @@ Tests for various python features. vim: set ft=vim :
STARTTEST
:so small.vim
:set noswapfile
:if !has('python3') | e! test.ok | wq! test.out | endif
:if !has('python3') || !has('quickfix') | e! test.ok | wq! test.out | endif
:lang C
:fun Test()
:py3 import vim

View File

@@ -1713,10 +1713,12 @@ func Test_nocatch_wipe_all_buffers()
endfunc
func Test_nocatch_wipe_dummy_buffer()
if has('quickfix')
" Nasty autocommand: wipe buffer on any event.
au * x bwipe
call assert_fails('lv½ /x', 'E480')
au!
endif
endfunc
function s:Before_test_dirchanged()
@@ -2291,6 +2293,8 @@ func Test_autocmd_CmdWinEnter()
endfunc
func Test_autocmd_was_using_freed_memory()
CheckFeature quickfix
pedit xx
n x
au WinEnter * quit

View File

@@ -1,6 +1,9 @@
" Tests for the getbufinfo(), getwininfo() and gettabinfo() functions
source check.vim
func Test_getbufwintabinfo()
CheckFeature quickfix
function Test_getbufwintabinfo()
edit Xtestfile1
edit Xtestfile2
let buflist = getbufinfo()
@@ -103,7 +106,7 @@ function Test_getbufwintabinfo()
call assert_true(winlist[2].quickfix)
call assert_false(winlist[2].loclist)
wincmd t | only
endfunction
endfunc
function Test_get_buf_options()
let opts = bufnr()->getbufvar('&')

View File

@@ -1548,6 +1548,7 @@ endfunc
func Test_write_to_deleted_buffer()
CheckExecutable echo
CheckFeature quickfix
let job = job_start('echo hello', {'out_io': 'buffer', 'out_name': 'test_buffer', 'out_msg': 0})
let bufnr = bufnr('test_buffer')

View File

@@ -1,9 +1,12 @@
" Test the :compiler command
source check.vim
func Test_compiler()
if !executable('perl')
return
endif
CheckFeature quickfix
" $LANG changes the output of Perl.
if $LANG != ''

View File

@@ -982,6 +982,8 @@ func Test_edit_CTRL_V()
endfunc
func Test_edit_F1()
CheckFeature quickfix
" Pressing <f1>
new
call feedkeys(":set im\<cr>\<f1>\<c-l>", 'tnix')

View File

@@ -1,6 +1,7 @@
" test execute()
source view_util.vim
source check.vim
func NestedEval()
let nested = execute('echo "nested\nlines"')
@@ -104,6 +105,8 @@ func Test_win_execute()
endfunc
func Test_win_execute_update_ruler()
CheckFeature quickfix
enew
call setline(1, range(500))
20

View File

@@ -1,5 +1,7 @@
" Test the :filter command modifier
source check.vim
func Test_filter()
edit Xdoesnotmatch
edit Xwillmatch
@@ -89,6 +91,8 @@ func Test_filter_cmd_with_filter()
endfunction
func Test_filter_commands()
CheckFeature quickfix
let g:test_filter_a = 1
let b:test_filter_b = 2
let test_filter_c = 3

View File

@@ -722,6 +722,8 @@ func Test_scrollbars()
endfunc
func Test_menu()
CheckFeature quickfix
" Check Help menu exists
let help_menu = execute('menu Help')
call assert_match('Overview', help_menu)

View File

@@ -1,7 +1,9 @@
" Tests for 'makeencoding'.
source shared.vim
source check.vim
CheckFeature quickfix
let s:python = PythonProg()
if s:python == ''
throw 'Skipped: python program missing'

View File

@@ -355,6 +355,8 @@ endfunc
if has('terminal')
func Test_mksession_terminal_shell()
CheckFeature quickfix
terminal
mksession! Xtest_mks.out
let lines = readfile('Xtest_mks.out')
@@ -436,6 +438,8 @@ func Test_mksession_terminal_no_ssop()
endfunc
func Test_mksession_terminal_restore_other()
CheckFeature quickfix
terminal
eval bufnr('%')->term_setrestore('other')
mksession! Xtest_mks.out

View File

@@ -1,6 +1,7 @@
" Test for various Normal mode commands
source shared.vim
source check.vim
func Setup_NewWindow()
10new
@@ -1240,6 +1241,8 @@ func Test_normal24_rot13()
endfunc
func Test_normal25_tag()
CheckFeature quickfix
" Testing for CTRL-] g CTRL-] g]
" CTRL-W g] CTRL-W CTRL-] CTRL-W g CTRL-]
h

View File

@@ -490,6 +490,8 @@ endfunc
" Test that 'completefunc' on Scratch buffer with preview window works when
" it's OK.
func Test_completefunc_with_scratch_buffer()
CheckFeature quickfix
new +setlocal\ buftype=nofile\ bufhidden=wipe\ noswapfile
set completeopt+=preview
setlocal completefunc=DummyCompleteFive
@@ -665,6 +667,7 @@ endfunc
func Test_popup_and_window_resize()
CheckFeature terminal
CheckFeature quickfix
CheckNotGui
let h = winheight(0)
@@ -697,14 +700,13 @@ func Test_popup_and_window_resize()
endfunc
func Test_popup_and_preview_autocommand()
CheckFeature python
CheckFeature quickfix
if winheight(0) < 15
throw 'Skipped: window height insufficient'
endif
" This used to crash Vim
if !has('python')
return
endif
let h = winheight(0)
if h < 15
return
endif
new
augroup MyBufAdd
au!
@@ -735,9 +737,9 @@ func Test_popup_and_preview_autocommand()
endfunc
func Test_popup_and_previewwindow_dump()
if !CanRunVimInTerminal()
throw 'Skipped: cannot make screendumps'
endif
CheckScreendump
CheckFeature quickfix
let lines =<< trim END
set previewheight=9
silent! pedit
@@ -804,9 +806,8 @@ func Test_balloon_split()
endfunc
func Test_popup_position()
if !CanRunVimInTerminal()
throw 'Skipped: cannot make screendumps'
endif
CheckScreendump
let lines =<< trim END
123456789_123456789_123456789_a
123456789_123456789_123456789_b
@@ -847,9 +848,8 @@ func Test_popup_position()
endfunc
func Test_popup_command()
if !CanRunVimInTerminal() || !has('menu')
throw 'Skipped: cannot make screendumps and/or menu feature missing'
endif
CheckScreendump
CheckFeature menu
let lines =<< trim END
one two three four five

View File

@@ -2700,6 +2700,7 @@ endfunc
func Test_previewpopup()
CheckScreendump
CheckFeature quickfix
call writefile([
\ "!_TAG_FILE_ENCODING\tutf-8\t//",
@@ -2871,6 +2872,7 @@ endfunc
func Test_popupmenu_info_border()
CheckScreendump
CheckFeature quickfix
let lines = Get_popupmenu_lines()
call add(lines, 'set completepopup=height:4,highlight:InfoPopup')
@@ -2908,6 +2910,7 @@ endfunc
func Test_popupmenu_info_noborder()
CheckScreendump
CheckFeature quickfix
let lines = Get_popupmenu_lines()
call add(lines, 'set completepopup=height:4,border:off')
@@ -2925,6 +2928,7 @@ endfunc
func Test_popupmenu_info_align_menu()
CheckScreendump
CheckFeature quickfix
let lines = Get_popupmenu_lines()
call add(lines, 'set completepopup=height:4,border:off,align:menu')
@@ -2955,6 +2959,7 @@ endfunc
func Test_popupmenu_info_hidden()
CheckScreendump
CheckFeature quickfix
let lines = Get_popupmenu_lines()
call add(lines, 'call InfoHidden()')

View File

@@ -1,4 +1,6 @@
" Tests for the preview window
source check.vim
CheckFeature quickfix
func Test_Psearch()
" this used to cause ml_get errors

View File

@@ -279,6 +279,8 @@ endfunc
" Test the '-q [errorfile]' argument.
func Test_q_arg()
CheckFeature quickfix
let source_file = has('win32') ? '..\memfile.c' : '../memfile.c'
let after =<< trim [CODE]
call writefile([&errorfile, string(getpos("."))], "Xtestout")
@@ -458,6 +460,7 @@ func Test_invalid_args()
call assert_equal('Too many edit arguments: "xxx"', out[1])
call assert_equal('More info with: "vim -h"', out[2])
if has('quickfix')
" Detect invalid repeated arguments '-t foo -t foo", '-q foo -q foo'.
for opt in ['-t', '-q']
let out = split(system(GetVimCommand() .. repeat(' ' .. opt .. ' foo', 2)), "\n")
@@ -466,6 +469,7 @@ func Test_invalid_args()
call assert_equal('Too many edit arguments: "' .. opt .. '"', out[1])
call assert_equal('More info with: "vim -h"', out[2])
endfor
endif
for opt in [' -cq', ' --cmd q', ' +', ' -S foo']
let out = split(system(GetVimCommand() .. repeat(opt, 11)), "\n")

View File

@@ -7,6 +7,7 @@
" %X
source view_util.vim
source check.vim
func s:get_statusline()
return ScreenLines(&lines - 1, &columns)[0]
@@ -60,6 +61,8 @@ func Test_statusline_will_be_disabled_with_error()
endfunc
func Test_statusline()
CheckFeature quickfix
new Xstatusline
only
set laststatus=2

View File

@@ -1,8 +1,11 @@
" Tests for tabpage
source screendump.vim
source check.vim
function Test_tabpage()
CheckFeature quickfix
bw!
" Simple test for opening and closing a tab page
tabnew
@@ -220,6 +223,8 @@ function Test_tabpage_with_autocmd()
endfunction
function Test_tabpage_with_tab_modifier()
CheckFeature quickfix
for n in range(4)
tabedit
endfor

View File

@@ -5,12 +5,16 @@ source screendump.vim
" SEGV occurs in older versions. (At least 7.4.1748 or older)
func Test_ptag_with_notagstack()
CheckFeature quickfix
set notagstack
call assert_fails('ptag does_not_exist_tag_name', 'E426')
set tagstack&vim
endfunc
func Test_cancel_ptjump()
CheckFeature quickfix
set tags=Xtags
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
\ "word\tfile1\tcmd1",
@@ -70,6 +74,8 @@ func Test_duplicate_tagjump()
endfunc
func Test_tagjump_switchbuf()
CheckFeature quickfix
set tags=Xtags
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
\ "second\tXfile1\t2",

View File

@@ -175,6 +175,8 @@ func Test_window_split_edit_bufnr()
endfunc
func Test_window_preview()
CheckFeature quickfix
" Open a preview window
pedit Xa
call assert_equal(2, winnr('$'))
@@ -193,6 +195,8 @@ func Test_window_preview()
endfunc
func Test_window_preview_from_help()
CheckFeature quickfix
filetype on
call writefile(['/* some C code */'], 'Xpreview.c')
help
@@ -438,6 +442,8 @@ func Test_equalalways_on_close()
endfunc
func Test_win_screenpos()
CheckFeature quickfix
call assert_equal(1, winnr('$'))
split
vsplit
@@ -451,6 +457,8 @@ func Test_win_screenpos()
endfunc
func Test_window_jump_tag()
CheckFeature quickfix
help
/iccf
call assert_match('^|iccf|', getline('.'))
@@ -887,6 +895,8 @@ func Test_winrestview()
endfunc
func Test_win_splitmove()
CheckFeature quickfix
edit a
leftabove split b
leftabove vsplit c

View File

@@ -1,4 +1,5 @@
" Test using the window ID.
source check.vim
func Test_win_getid()
edit one
@@ -94,6 +95,8 @@ func Test_win_getid()
endfunc
func Test_win_getid_curtab()
CheckFeature quickfix
tabedit X
tabfirst
copen

View File

@@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2373,
/**/
2372,
/**/