Skip to content

Commit 0b2a9ae

Browse files
committed
Spawn tmux fg job in bg window when height <= 0
When the requested height for a tmux split is 0 or less and that the spawned job will be able to call back, spawn the foreground job in a new background window, just as if it were a background job If no callback mechanism is available, use a split of -height lines
1 parent 6f93109 commit 0b2a9ae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

autoload/dispatch/tmux.vim

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ function! dispatch#tmux#make(request) abort
4949

5050
let title = shellescape(get(a:request, 'title', get(a:request, 'compiler', 'make')))
5151
let height = get(g:, 'dispatch_tmux_height', get(g:, 'dispatch_quickfix_height', 10))
52-
if get(a:request, 'background', 0)
52+
if get(a:request, 'background', 0) || (height <= 0 && dispatch#has_callback())
5353
let cmd = 'new-window -d -n '.title
5454
elseif has('gui_running') || empty($TMUX) || (!empty(''.session) && session !=# system('tmux display-message -p "#S"')[0:-2])
5555
let cmd = 'new-window -n '.title
5656
else
57-
let cmd = 'split-window -l '.height.' -d'
57+
let cmd = 'split-window -l '.(height < 0 ? -height : height).' -d'
5858
endif
5959

6060
let cmd .= ' ' . dispatch#shellescape('-P', '-t', session.':', 'exec ' . script)

0 commit comments

Comments
 (0)