Reset the s:vim_pane when reattaching

Prior to this change, VTR could get confused and focus the wrong pane
after reattaching the runner pane.

Closes #38 - Detaching the runner pane does not reset the vim_pane
This commit is contained in:
Chris Toomey 2014-12-31 14:50:49 -05:00
parent 8399c4ab7b
commit fa1e9a53e3

View File

@ -185,6 +185,7 @@ function! s:BreakRunnerPaneToTempWindow()
call s:SendTmuxCommand(full_command) call s:SendTmuxCommand(full_command)
let s:detached_window = s:LastWindowNumber() let s:detached_window = s:LastWindowNumber()
unlet s:runner_pane unlet s:runner_pane
unlet s:vim_pane
endfunction endfunction
function! s:RunnerDimensionSpec() function! s:RunnerDimensionSpec()
@ -192,14 +193,6 @@ function! s:RunnerDimensionSpec()
return dimensions return dimensions
endfunction endfunction
function! s:_ReattachPane()
let join_cmd = join(["join-pane", "-s", ":".s:detached_window.".0",
\ s:RunnerDimensionSpec()])
call s:SendTmuxCommand(join_cmd)
unlet s:detached_window
let s:runner_pane = s:ActivePaneIndex()
endfunction
function! s:TmuxInfo(message) function! s:TmuxInfo(message)
" TODO: this should accept optional target pane, default to current. " TODO: this should accept optional target pane, default to current.
" Pass that to TargetedCommand as "display-message", "-p '#{...}') " Pass that to TargetedCommand as "display-message", "-p '#{...}')
@ -273,6 +266,7 @@ endfunction
function! s:ReattachPane() function! s:ReattachPane()
if !s:DetachedPaneAvailable() | return | endif if !s:DetachedPaneAvailable() | return | endif
let s:vim_pane = s:ActivePaneIndex()
call s:_ReattachPane() call s:_ReattachPane()
call s:FocusVimPane() call s:FocusVimPane()
if g:VtrClearOnReattach if g:VtrClearOnReattach
@ -280,6 +274,14 @@ function! s:ReattachPane()
endif endif
endfunction endfunction
function! s:_ReattachPane()
let join_cmd = join(["join-pane", "-s", ":".s:detached_window.".0",
\ s:RunnerDimensionSpec()])
call s:SendTmuxCommand(join_cmd)
unlet s:detached_window
let s:runner_pane = s:ActivePaneIndex()
endfunction
function! s:ReorientRunner() function! s:ReorientRunner()
if !s:ValidRunnerPaneSet() | return | endif if !s:ValidRunnerPaneSet() | return | endif
let temp_window = s:BreakRunnerPaneToTempWindow() let temp_window = s:BreakRunnerPaneToTempWindow()