Capture the major orientation with AttachToPane
ReorientRunner needs to know the current orientation in order to be able to toggle it. With this change, we capture the current major orientation (outermost split orientation) and assume it to be representative. Imperfect, but I believe it to be a very good approximation. Closes #32 - Error: Reorient Runner fails when run after manual attach
This commit is contained in:
parent
cf363c892c
commit
f39a860595
@ -253,9 +253,18 @@ function! s:PromptForRunnerToAttach()
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:CurrentMajorOrientation()
|
||||||
|
let orientation_map = { '[': 'v', '{': 'h' }
|
||||||
|
let layout = s:TmuxInfo('window_layout')
|
||||||
|
let outermost_orientation = substitute(layout, '[^[{]', '', 'g')[0]
|
||||||
|
return orientation_map[outermost_orientation]
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:AttachToPane(desired_pane)
|
function! s:AttachToPane(desired_pane)
|
||||||
if s:ValidRunnerPaneNumber(a:desired_pane)
|
if s:ValidRunnerPaneNumber(a:desired_pane)
|
||||||
let s:runner_pane = a:desired_pane
|
let s:runner_pane = a:desired_pane
|
||||||
|
let s:vim_pane = s:ActivePaneIndex()
|
||||||
|
let s:vtr_orientation = s:CurrentMajorOrientation()
|
||||||
echohl String | echo "\rRunner pane set to: " . a:desired_pane | echohl None
|
echohl String | echo "\rRunner pane set to: " . a:desired_pane | echohl None
|
||||||
else
|
else
|
||||||
call s:EchoError("Invalid pane number: " . a:desired_pane)
|
call s:EchoError("Invalid pane number: " . a:desired_pane)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user