Skip to content
Myr

[vim] Don't start extra process when opening popup (#2000)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fix #2038

authored by ichizok · committed by GitHub · parent e6d33f7 · Browse files · 1 file+21 added−11 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+21 added−11 removed

  • other:+21 added−11 removed

1 file+21 added−11 removed

modified:plugin/fzf.vim+21 added-11 removed
646 unmodified lines
647 \ 'down': ['botright', 'resize', &lines],648 \ 'left': ['vertical topleft', 'vertical resize', &columns],649 \ 'right': ['vertical botright', 'vertical resize', &columns] }650 let ppos = s:getpos()651 let is_popup = 0652 try653 if s:present(a:dict, 'window')654 if type(a:dict.window) == type({})655 if !has('nvim') && !has('patch-8.2.191')656 throw 'Vim 8.2.191 or later is required for pop-up window'657 end658 call s:popup(a:dict.window)659 let is_popup = 1660 else661 execute 'keepalt' a:dict.window662 endif663 elseif !s:splittable(a:dict)
9 unmodified lines
673 let sz = s:calc_size(max, val, {})674 endif675 execute cmd sz.'new'676 execute resz sz675 return [ppos, {}]677 return [ppos, {}, is_popup]678 endif679 endfor680 endif679 return [ppos, { '&l:wfw': &l:wfw, '&l:wfh': &l:wfh }]681 return [ppos, { '&l:wfw': &l:wfw, '&l:wfh': &l:wfh }, is_popup]682 finally683 setlocal winfixwidth winfixheight684 endtry685endfunction686687function! s:execute_term(dict, command, temps) abort688 let winrest = winrestcmd()689 let pbuf = bufnr('')688 let [ppos, winopts] = s:split(a:dict)690 let [ppos, winopts, is_popup] = s:split(a:dict)691 call s:use_sh()692 let b:fzf = a:dict693 let fzf = { 'buf': bufnr(''), 'pbuf': pbuf, 'ppos': ppos, 'dict': a:dict, 'temps': a:temps,694 \ 'winopts': winopts, 'winrest': winrest, 'lines': &lines,
58 unmodified lines
753 else754 if !len(&bufhidden)755 setlocal bufhidden=hide756 endif755 let fzf.buf = term_start([&shell, &shellcmdflag, command], {'curwin': 1, 'exit_cb': function(fzf.on_exit)})756 if !has('patch-8.0.1261') && !has('nvim') && !s:is_win757 let term_opts = {'exit_cb': function(fzf.on_exit)}758 if is_popup759 let term_opts.hidden = 1760 else761 let term_opts.curwin = 1762 endif763 let fzf.buf = term_start([&shell, &shellcmdflag, command], term_opts)764 if is_popup && exists('#TerminalWinOpen')765 doautocmd <nomodeline> TerminalWinOpen766 endif767 if !has('patch-8.0.1261') && !s:is_win768 call term_wait(fzf.buf, 20)769 endif770 endif771 finally
62 unmodified lines
834 endfunction835else836 function! s:create_popup(hl, opts) abort837 let is_frame = has_key(a:opts, 'border')827 let buf = is_frame ? '' : term_start(&shell, #{hidden: 1, term_finish: 'close'})828 let id = popup_create(buf, #{838 let s:popup_create = {buf -> popup_create(buf, #{839 \ line: a:opts.row,840 \ col: a:opts.col,841 \ minwidth: a:opts.width,842 \ minheight: a:opts.height,843 \ zindex: 50 - is_frame,834 \ })835844 \ })}845 if is_frame846 let id = s:popup_create('')847 call setwinvar(id, '&wincolor', a:hl)848 call setbufline(winbufnr(id), 1, a:opts.border)849 execute 'autocmd BufWipeout * ++once call popup_close('..id..')'850 return winbufnr(id)851 else841 execute 'autocmd BufWipeout * ++once call term_sendkeys('..buf..', "exit\<CR>")'852 autocmd TerminalOpen * ++once call s:popup_create(str2nr(expand('<abuf>')))853 endif843 return winbufnr(id)854 endfunction855endif856857function! s:popup(opts) abort
93 unmodified lines