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

Option to disable select mode #1712

Open
Knio opened this issue Sep 4, 2022 · 4 comments
Open

Option to disable select mode #1712

Knio opened this issue Sep 4, 2022 · 4 comments

Comments

@Knio
Copy link

Knio commented Sep 4, 2022

Similar to #1033, #1673, #1593, #1677, etc, I cannot copy text when using Zellij.

I'm trying to use Zellij through SSH, and my local term (MobaXterm, #1033) does not support OSC52. Normally (screen/tmux/nothing), I can select text using my local terminal's select feature, and copy it like that. However, Zellij is somehow preventing my local term from handling mouse clicks (#1593), which means I cannot copy text (#1677).

  • I have copy_on_select: false set on my config - I do not want to use the remote clipboard at all
  • Yes, holding shift while selecting text disables Zellij's mouse mode and allows me to select and copy text locally
  • No, I don't want to do that. That makes it awkward to use every time I want to select something, and I want all the other mouse mode features enabled.

I would like to suggest the following 2 solutions that don't just nuke mouse mode:

  1. A config option to disable select mode. Allow all other mouse features to still work.
  2. A config option to not suppress mouse events locally. I'm not quite sure how this is done, but I assume Zellij is sending some command to tell the local term to stop processing the mouse events. Just stop sending this command and let the local term do what it wants.

These could both be off by default, although from the number of issues I see about copying text you might want to consider something else.

Also, I realize that local select mode will be kinda broken for any multi-line or vertical-split panes as the term will end up selecting the frame UIs and etc... but I think the easy case can be solved before worrying about that. (Maybe when Zellij's select mode is disabled and it detects a mouse select, it could just temporarily blank out the UI/inactive panes until the local select completes?)

I can try to make a PR for one or both of these, but would need some pointers to where this is happening in the code.

@tlinford
Copy link
Contributor

tlinford commented Sep 5, 2022

Hey, I understand that the experience can be frustrating in such a case. Unfortunately I don't think there is a clean solution for this.

I may be wrong here but as far as I know (@imsnif, @AutumnMeowMeow I'd be happy to be corrected 😄 ), it isn't really possible to implement what you are suggesting in 1. or 2., since mouse mode is pretty much an either/or thing:

  • either the application enables mouse tracking and the terminal emulator stops handling mouse events and only forwards them to the application
  • or the terminal emulator handles them normally and the application knows nothing about them.

You mention being able to select with tmux, but how about tmux with set -g mouse on?

The only thing I can think of in this case, although not much better than shift clicking, would be to have the ability to toggle mouse mode on/off at runtime, would that be helpful?

If all else fails you could get creative and try using a slightly more arcane solution with ssh reverse tunneling, for an example check: https://gist.github.com/dergachev/8259104

@abaddouh
Copy link

abaddouh commented Sep 8, 2022

an option to turn off mouse mode off at runtime, maybe with a command that we can bind to keys if having it configured by default is not desirable, would be fantastic! I'm not sure if it would solve @Knio's issue but it would be sufficient for my own needs.

However, if this is the route taken, might I suggest a visual indicator regarding current mouse mode status? I could see a possibly common scenario where people forget that they had the mode on/off until after many shenanigans trying to select things around.

@tlinford
Copy link
Contributor

tlinford commented Sep 9, 2022

an option to turn off mouse mode off at runtime, maybe with a command that we can bind to keys if having it configured by default is not desirable, would be fantastic! I'm not sure if it would solve @Knio's issue but it would be sufficient for my own needs.

sounds good, It shouldn't be too hard to get that working.

However, if this is the route taken, might I suggest a visual indicator regarding current mouse mode status? I could see a possibly common scenario where people forget that they had the mode on/off until after many shenanigans trying to select things around.

great idea!

@Knio
Copy link
Author

Knio commented Sep 10, 2022

Thanks for the replies.

I did some further experimentation and figured out that you're correct, the term and application can not both get mouse events. I was confused because MobaXterm is actually quietly remapping mouse wheel events to up/down arrow keystrokes when not in application mouse mode, so this made it appear that many different apps were actually handling mouse events while still allowing local selections.

the ability to toggle mouse mode on/off at runtime, would that be helpful?

Yes, I think this would be great. (Holding shift actually changes the behavior of local selections on a few terms I tested - so even that is not great workaround. What a mess..)

I'm not sure how powerful the config semantics are, but as long as I'm dreaming I would probably want some key that when held, disabled mouse mode, and blanked the UI/fullscreened the active pane, and reverted when the key was released.

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

3 participants