Untangles the keystrokes ctrl-h and backspace#445
Merged
osa1 merged 1 commit intoosa1:masterfrom May 20, 2025
nuvw:untangle-backspace-ctrl_h
Merged
Untangles the keystrokes ctrl-h and backspace#445osa1 merged 1 commit intoosa1:masterfrom nuvw:untangle-backspace-ctrl_h
osa1 merged 1 commit intoosa1:masterfrom
nuvw:untangle-backspace-ctrl_h
Conversation
Before this commit, pressing either `ctrl-h` or `backspace` both
generated the same `Key::Backspace`, even though they send the distinct
bytes `8` and `127` to tiny. Now, they generate distinguishable events.
Also added a new default configuration for `Key::Ctrl('h')` so that the
default behavior of tiny remains precisely the same as before, but with
additional configurability of `ctrl_h` that is separate from `backspace`.
Owner
|
Thanks!
We can merge that as well, but we should update it now removing the We should also not forget to update the CHANGELOG with the changes. |
Contributor
Author
|
Sure. I can do that soon. |
osa1
pushed a commit
that referenced
this pull request
May 21, 2025
* Added support for `ctrl_h` and `ctrl_i` in keymap config
Before this commit, having `ctrl_h` or `ctrl_i` in the keymap
configuration would define a mapping for `Key::Ctrl('h')` or
`Key::Ctrl('i')`, respectively. These two mappings would never trigger,
however, since the corresponding key strokes are represented as
`Key::Backspace` and `Key::Tab`. After the commit, `ctrl_h` and `ctrl_i`
effectively serve as synonyms of `backspace` and `tab`.
For consistency, also added support for `ctrl_[` as a synonym of `esc`.
* Add explanation for special treatment of `ctrl_i` and `ctrl_[`
* Update CHANGELOG (#444, #445)
* Moved recent changes to new Unreleased section in CHANGELOG
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Untangles the keystrokes ctrl-h and backspace
Based on our discussion in #444, this seems to me like an obvious and simple change. But feel free to ignore it if you have any doubts (in particular since at some point in the past you felt the need to map the two keystrokes to the same
Key; maybe there was a good reason for it after all).Effectively, as I see it, this adds the possibility to define separate key bindings for
ctrl_handbackspacein the config file, while not changing the default behavior of tiny at all.Of course, there is now also the question of what action
ctrl-hshould be mapped to by default. But it seems to be standard to have it do the same asbackspace, namely to delete the character before the cursor. At least I have checked that this is also the default behavior of vim, helix and the fish shell.If you accept this PR, then I am not so sure about #444 anymore since (as you also point out in the discussion there) it taints
libtiny_tui/src/key_map.rswith low-level knowledge about equality of certain key combinations for very little (and now even less) gain.