-
Notifications
You must be signed in to change notification settings - Fork 728
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
Add support for modifier key resources #983
base: master
Are you sure you want to change the base?
Conversation
Allow application to set or reset resource-values used by xterm to decide whether to construct escape sequences holding information about the modifiers pressed with a given key.
Centralize most of the logic for the different modifier key resources so that one entity knows what resources are supported.
Emit "send secondary device attributes" request on client and detect the response on the server. Modify the response on the server so that application can detect when the modifier key sequences are supported.
Use the character 'collector' introduced in earlier commit consistently.
Hi Erik, thanks for opening this PR! The code itself looks plausible, but the thing I'm currently trying to figure out is its use case, and how generally applicable it is. If I'm understanding this correctly, you coded this up because control-backspace doesn't work for you in Emacs with Cygwin & mintty, and this fixes it. Have I got that right? Things that concern me a bit about the code:
Things I see when looking at this:
So my thinking is that this change has a quite narrow use case, to fix something that is arguably an incompatibility/bug in mintty. An alternate solution to this problem would be to change mintty: maybe just eliminate its use of But I don't think I completely understand your issue, if I'm missing something let me know and we'll work to a better solution. |
Hey cgull, Thanks for the through response, and thanks for working on mosh! I agree that this is pretty specific to the emacs-in-mintty case. I only intended it as a proof of concept, so I don't expect it to be accepted. I happen to be using this personally and I'm happy with that. Regarding the "ANSIbake": Yeah I have to add a keybinding in emacs for that sequence. At least with these patches I get a sequence specific to control-backspace. This means that mintty's ^_ and it's modifier key equivalent are both unusual. I'll try to follow up with them to understand why. You are right that the CSI SDA response implies all kinds of features. In fact, this change also allows clipboard integration to work which is really nice! I'd be interested in helping to fill out that xterm emulation more if it becomes a priority at some point, whether this turns out to be the way to do it or not. I've not done this before. Should I close the request? |
My use case for this is as follows: I use (neo)vim inside of tmux inside of mosh inside of iTerm2. But I think the use case is the same even if we take tmux out of the equation: (neo)vim inside of mosh inside of iTerm2. First thing to know is that iTerm2 supports "xterm control sequence can enable modifyOtherKeys mode". So vim can toggle that mode with the proper: let &t_TI = "\e[>4;2m"
let &t_TE = "\e[>4;m" This lets me use Specifically for tmux, but perhaps irrelevant to this PR, tmux only understands modifyOtherKeys=1. However, if I understand tmux/tmux#3086 (comment) correctly, tmux has partially implemented some key sequences of modifyOtherKeys=2. But the problem is that when I run neovim inside tmux inside mosh inside iTerm2, iTerm2 does not automatically change the terminal state to Manual intervention is inconvenient so I would like to let vim toggle iTerm2's modifyOtherKeys state. For that to happen, mosh has to let it pass through. Could mosh have some sort of escape valve to allow escape sequences to pass through to the client terminal? tmux 3.3 has added such an escape valve using an Perhaps mosh can support something similar: a special passthrough escape sequence. As a user, this would still not be easy as I'd need to double escape the sequence, once for tmux and once for mosh, depending of they're detected from within my vim config files. I may have to use something like this to detect a mosh session: https://unix.stackexchange.com/a/396888/7281 Other ideas welcome. |
This set of commits ostensibly adds support for the modifier key resource values accessed via the "CSI > Ps; Ps m" sequences. I tried to make it easy to support other use cases, but I have added support specifically for using emacs as the application and mintty as the user terminal. This requires carrying some terminal type/version information from the user side to the application side so that emacs can detect when the resources are available automatically.