Skip to content
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

focus-events on is messy with fish shell #20

Open
bruno- opened this issue Jan 21, 2015 · 11 comments
Open

focus-events on is messy with fish shell #20

bruno- opened this issue Jan 21, 2015 · 11 comments

Comments

@bruno-
Copy link
Member

bruno- commented Jan 21, 2015

Issue from stack overflow: http://stackoverflow.com/questions/28039788/window-focus-adds-characters-to-shell

@baroldgene
Copy link

Curious.....is there any reason not to turn off focus_events when exiting tmux for everyone regardless of shell?

@baroldgene
Copy link

Also, I'm somewhat new to tmux. Is there a way to perform tasks or set configuration options either A) based on terminal or B) on detach?

@bruno-
Copy link
Member Author

bruno- commented Jan 22, 2015

Hey thanks for checking this issue out.

is there any reason not to turn off focus_events when exiting tmux for everyone regardless of shell?

Hm.. I'm not sure I understand this.. I thought focus events (the special sequence of charaters like ^[O[I you described in a SO question) is generated by tmux on certain events like switching windows or panes. So if that theory is right, the events should be automatically off when tmux is detached or killed.

@bruno-
Copy link
Member Author

bruno- commented Jan 22, 2015

I checked tmux source (not that I understand it, or even know C language for that matter), but it seems the "theory" from the above post might be true. Here's the link to relevant lines in tmux source. So it seems tmux is first doing some checks and then sends the \033[O or \033[I to panes..

So yea, long story short, at first sight I'd say pane events should not happen outside tmux. Are you seing something else when using fish shell?

Also, I'm somewhat new to tmux. Is there a way to perform tasks or set configuration options either A) based on terminal or B) on detach?

I'm not sure you could do this in your .tmux.conf as it only understands tmux's options, but A) should definitely be possible in tmux-sensible.

@bruno-
Copy link
Member Author

bruno- commented Jan 22, 2015

Update: I keep accidentally posting messages before I finish them.. sorry for the noise.

You should be able to check which terminal is tmux running in tmux sensible file by just testing the $SHELL environment variable. Something like this [[ "$SHELL" =~ fish$ ]]

@baroldgene
Copy link

So yea, long story short, at first sight I'd say pane events should not happen outside tmux. Are you seeing something else when using fish shell?

Yeah. The issue is that I start tmux, then either exit or disconnect and the focus events being sent show up on the prompt since tmux is no longer there listening for them.

It's entirely possible that these same keystrokes are being sent to bash and just ignored.

I'd say this seems more like a tmux issue than a tmux-sensible one.

@bruno-
Copy link
Member Author

bruno- commented Jan 22, 2015

I'd say this seems more like a tmux issue than a tmux-sensible one.

Yea. And that would explain it why the focus-events is "off" by default. Also, let's not discard the possibility of this being a 'fish' shell issue or a thing they need to add.

My knowledge on this is fuzzy, but I think these events are somewhat standardized to these codes ^[[O and ^[[I. From what I know, vim can understand those, iTerm application on OSX "sends" the codes as well as terminal applications on Linux. So maybe it's fish that's lagging to implement support for it?

@baroldgene
Copy link

That's a very good point.

@baroldgene
Copy link

I opened this ticket with the fish shell dev team: fish-shell/fish-shell#1917

I'm interested to see where the discussion goes and if the fish devs agree that it should be solved there.

@bruno-
Copy link
Member Author

bruno- commented Jan 30, 2015

It seems fish maintainers opened an issue to tmux core and the fix was found: http://sourceforge.net/p/tmux/tickets/176/

Good to see things getting better. Thanks for taking the time to investigate and report this in the first place @baroldgene.

@baroldgene
Copy link

Thanks for helping me track this one down! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants