-
Notifications
You must be signed in to change notification settings - Fork 24
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
Make code sent by backspace key configurable #23
Conversation
I agree this is something we should fix. I want to give this a little more thinking though. I'm sure there will be more similar quirks in keycodes. Adding options for each of those will quickly become unwieldy. My gut feeling is that a general keybinding system could be an elegant solution, which should also allow potentially other custom shortcuts. But maybe that's too much. Anyway, will take another look at this in the weekend. Meanwhile, feel free to propose other ideas :) |
I thought about that, but xkb already takes care of that for most "regular" keys. I don't know if there's many people wanting to remap the tab key, for example, but maybe there are. I'd be happy to code up another more general suggestion if you prefer to go that way. |
Yeah I feel the same way.
What do you have in mind? If that's not too much work then go ahead. Otherwise let me take a look at the codebase this weekend and we can discuss whether that really worths it. |
There's two main directions, I think. Either make all keysyms remappable or only the "special" ones, for some definition of special. In both approaches there's also the issue of what to do when Shift/Alt/Ctrl are pressed. And what to do about some really special keys with important special semantics, like the different codes for the keypad numbers in application mode. I don't really have the answer to that. Maybe I can have a look around at some other implementations: xterm, konsole, vte, see what they do. |
All right, I've looked into this today: xterm's upstream default is to have the "backarrow key" send backspace (010), this is set in the Fedora and Arch Linux use this upstream default, Debian and Ubuntu change the upstream default and use delete instead. Gnome's VTE makes both backspace and delete selectable. The default for backspace is to send the VERASE character of the active terminal and backspace (010) if that's not set or not readable. The default for delete is to send the termcap/terminfo entry Konsole's default keyboard layouts make backspace send delete, but this can be changed by setting another keyboard layout. |
Now thinking about this, I want to keep the current behavior (sending
I'm actually thinking about making agetty the default. This has the additional benefit of supporting Is there any other concerns that I'm missing? |
I see no real problem with that. Because kmscon sets It's only two one-line patches, so that's not too much of a burden for me. |
Ah, maybe kmscon shouldn't report as xterm-256color then. Let me research what the options are. |
kmscon/libtsm could ship their own terminfo entries, but that would not work when ssh'ing into a different machine, for example. Also, I hope that libtsm will get more features in the coming time, so the terminfo entry would need to be updated every time something mentioned in the entry changes. The best option in my eyes would be to work towards better xterm compatibility, so the current lie slowly turns into truth. |
Just to make sure I understand correctly, debian and Ubuntu change the xterm default to send \177 for backspace, and also the matching terminfo database, so What term does vte report on debian? |
That is correct. Gnome-terminal on my debian testing installation has |
I made a mistake in #23 (comment), on debian the terminfo should also be It turns out Archlinux also sets I give up. Let's avoid premature generalization and just merge this. |
Cloud you also add a unit test? |
I've added a unit test, checking both the default state and the two explicit states. |
There's no |
These functions make it possible to test not-null terminated strings. They were added in Check 0.11.0, but Ubuntu 20.04 only has version 0.10.
Keep the default code as ASCII backspace, but allow setting the code to ASCII delete. This is the code used by the Linux console and most modern terminal emulators by default.
I added a fallback implementation in Lines 106 to 120 in b26a06a
I think having this available may come in handy for other correctness tests in the future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Keep the default code as ASCII backspace, but allow setting the code to
ASCII delete. This is the code used by the Linux console and most modern
terminal emulators by default.
Fixes #22.