New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More reliable tmux pane handling #10

Merged
merged 1 commit into from Jul 15, 2011

Conversation

Projects
None yet
2 participants
@guns
Copy link
Contributor

guns commented Jul 12, 2011

Hello,

I decided to tackle issue #7. Attached is my branch for better
tmux pane handling, for your review.

One note not explicitly covered in the commit logs is that the minimum
tmux version will have to be set to 1.4 and that users will get best
results from 1.5, which just dropped.

I am happy to make any edits, so if you don't like some of the
implementation details, please tell.

Cheers,
guns

commit 23ae148

More reliable tmux pane handling
tmux 1.4 added the "(active)" string to the current pane in `tmux
list-panes' output.

tmux 1.5 introduced unique pane ids in the form of %n, available either
through the $TMUX_PANE environment variable or at the end of each line
of `tmux list-panes'.

Leveraging these two features, a new method `s:screenTmux.activePane()'
returns the pane id of the current active pane, suitable for use as part
of a `-t id' parameter.

We store the shell's pane id with this method in the variable
`g:ScreenShellTmuxPane' when opening a new region, window, or terminal.
When sending text from vim -> shell, we note vim's pane id, send text to
`-t g:ScreenShellTmuxPane', and select-pane back to vim's pane.

This supplants the assumption that vim is in pane 0 and the shell is at
pane 1. Vim and the target shell can be at any pane position and work
correctly. However, if tmux is at version 1.4, shuffling the order of
the panes break communication, because the pane id is relative.

If tmux is at version 1.5, the pane id is unique and thus communication
will not fail even if the pane's position is shuffled or even moved to
another window.

@ervandew ervandew merged commit 23ae148 into ervandew:master Jul 15, 2011

@ervandew

This comment has been minimized.

Copy link
Owner

ervandew commented Jul 15, 2011

Thanks for the patch!

@guns guns deleted the guns:tmux-panes branch Dec 11, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment