-
Notifications
You must be signed in to change notification settings - Fork 3
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
Left/Right keys always behave like Ctrl is pressed in rxvt-unicode / urxvt, even if it isn't #4
Comments
I'm good with removing those codes, as they have no use in iTerm2. Also, I noticed other frameworks don't have those either. @Eriner, you added those. They still make sense to you? |
TBH it's been so long that I have no recollection of adding that (or experiencing the issue that caused the addition). Something something... key-codes vary from one terminal to another. My reservation in removing it is only that I probably only would have added it if it fixed a bug of the key-codes not being properly detected, as stated in the commit message. @grandchild is rxvt-unicode the only terminal on which you experience this issue? And does it occur in a tty? |
Ah, that is a test I could have done before, yes... Anyway here come the test results:
So yeah, the question is how to detect this and do something special for either TTY or urxvt (possibly others?) |
❯ echo $TERM
rxvt-unicode-256color And my tty is agetty, in case that matters. |
Found this table that shows \eOD as kcub1, \eOC as kcuf1, \e[1;5D and \eOd as kLFT5, and \E[1;5C and \eOc as kRIT5. Maybe the fix in that commit was because the actual bindkey calls for backward-word and forward-word were also added. EDIT: Now I see the recent comments above. Another possible fix could be to only bind \eOD and \eOC when on tty. Not sure how to test that. |
Ah. And that same table shows rxvt mapping \EOD to kLFT5 (keypad?). I guess that's that. Wait, is there a difference between \eOD and \eOd? |
On TTY: ❯ echo $TERM
linux o.O |
I think I'd go with adding Since most other terminal emulators from the table linked above don't do what rxvt does, it seems special-casing rxvt* would be better than special-casing tty and relying on xterm to keep working in both scenarios. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This had the following results:
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
It seemed to me it'd be enough to simply don't set |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@grandchild, MetaLeft and MetaRight are Alt-Left and Alt-Right respectively. And BackTab is Shift-Tab. We should most probably update these key names to be clearer. EDIT: You got it right! :- ) EDIT2: I see there's TERM=xterm in all the outputs. It this really what you got? As a note, I've seen keys break if you have bash as the default shell, and then run zsh on top of it, because some OSs have some default settings in zprofile or bashrc that conflict with zsh... |
ah, damn, I have alt+left/+right will not work in tty mode because they switch to the previous/next tty respectively. I'm not sure that can be even configured away... |
Okay, after digging into this I learned some things:
So I propose that the short fix should be removing the The longer fix should be only using the terminfo key definitions if the "application mode" definitions are available. It does not make sense to try to use all these otherwise. |
Oh wow, have I got egg on my face now! 😞 Removing I am so sorry about this days-long hunt for nothing...
This doesn't seem necessary now, and furthermore, removing it outright breaks Ctrl+Left/+Right in the TTY. |
Just for completeness and posterity, I have replaced my infamous .zshrc line by this: if [[ "$TERM" == "rxvt-unicode-256color" ]]; then
export TERM=rxvt
fi (Yes, it's "256color" not colors, like I wrote above.) |
@grandchild, good to know that solved the issue. I still believe we can simplify the code by using I've updated the test_keys.zsh script to try to set the application mode as expected, and to give better output. Here is the output I got in macOS, android and lubuntu, in different terminals. In all cases, terminfo got the right values for AltLeft/AltRight/ControlLeft/ControlRight. The only 2 issues I found are that:
But still these are not even covered in the current code. |
Sorry, for the delay. Here you go: https://gist.github.com/grandchild/6ea1a8cc11c94c65602ee140f510df7a |
Thanks a lot, @grandchild. I see we got similar results. I'll propose a Pull Request based on our findings here. |
Ah, never mind, so lubuntu.net is an impostor site, and lubuntu.me is the original? Holy hell... |
Yeah, I was about to comment that https://lubuntu.me is their site. No idea what's going on in there with the other site and social media accounts. Regarding the current issue here, I'm almost giving up trying to change the current way we bind the Ctrl-Left/Ctrl-Right keys. The current code is a kind of brute force way, but anything that relies more on terminfo might not work in some out of so many different scenarios. So maybe better not touch what's already working. |
Yeah, I also agree, that while it was a very thorough bug hunt 😉 and now not to change anything can seem... frustrating, it seems like the way it is now works probably best (if some people <cough> wouldn't screw around with |
I ☑️ to close |
Sometimes shells are messy, and the joy is in the journey ;) |
If I press left- or right arrow, it always jumps back/forward a word, even if the Ctrl key is not pressed.
This commit (daac3c8) added the
\eOD
and\eOC
keycodes tokey_info['ControlLeft']
andkey_info['ControlRight']
respectively.Removing the keycodes from the list fixes this issue.
I use rxvt-unicode on Archlinux if that's of any relevance. I have my Capslock key disabled and remapped to Meta/Super (well... the Windows key, you know 😏), and I use an en_US standard layout.
Maybe you want to revert that part of the commit?
The text was updated successfully, but these errors were encountered: