-
Notifications
You must be signed in to change notification settings - Fork 833
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
fix(windows): Fix coninput not handling control sequences #1041
Merged
Conversation
This file contains 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
Sculas
added a commit
to Sculas/huh
that referenced
this pull request
Jun 18, 2024
Key binds should be checked before the key event is accepted as user input. See charmbracelet/bubbletea#1041 for more information.
Thanks @robotastronaut for sharing their research in the Charm Discord server and for the initial fix. In contrast to their fix, this should fully align with the key handling on Unix and fix other issues like Shift+Tab not working on Windows.
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.
LGTM, thanks for the patch @Sculas!
aymanbagabas
approved these changes
Jun 21, 2024
abs3ntdev
pushed a commit
to abs3ntdev/gspot
that referenced
this pull request
Jul 6, 2024
…6.6 (#3) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [github.com/charmbracelet/bubbletea](https://github.com/charmbracelet/bubbletea) | require | patch | `v0.26.4` -> `v0.26.6` | --- ### Release Notes <details> <summary>charmbracelet/bubbletea (github.com/charmbracelet/bubbletea)</summary> ### [`v0.26.6`](https://github.com/charmbracelet/bubbletea/releases/tag/v0.26.6) [Compare Source](charmbracelet/bubbletea@v0.26.5...v0.26.6) #### Changelog ##### Bug fixes - [`60a57ea`](charmbracelet/bubbletea@60a57ea): fix: nil deref on release terminal ([@​aymanbagabas](https://github.com/aymanbagabas)) *** <a href="https://charm.sh/"><img alt="The Charm logo" src="https://stuff.charm.sh/charm-badge.jpg" width="400"></a> Thoughts? Questions? We love hearing from you. Feel free to reach out on [Twitter](https://twitter.com/charmcli), [The Fediverse](https://mastodon.technology/@​charm), or on [Discord](https://charm.sh/chat). ### [`v0.26.5`](https://github.com/charmbracelet/bubbletea/releases/tag/v0.26.5) [Compare Source](charmbracelet/bubbletea@v0.26.4...v0.26.5) Fix special keys input handling on Windows using the latest Windows Console Input driver. #### Changelog ##### New Features - [`42a7dd8`](charmbracelet/bubbletea@42a7dd8): feat(ci): use goreleaser for releases ([#​1023](charmbracelet/bubbletea#1023)) ([@​aymanbagabas](https://github.com/aymanbagabas)) ##### Bug fixes - [`a08802e`](charmbracelet/bubbletea@a08802e): fix(windows): coninput not handling control sequences ([#​1041](charmbracelet/bubbletea#1041)) ([@​Sculas](https://github.com/Sculas)) ##### Other work - [`2d65ed6`](charmbracelet/bubbletea@2d65ed6): chore(examples): removed use of deprecated Copy ([@​arianizadi](https://github.com/arianizadi)) *** <a href="https://charm.sh/"><img alt="The Charm logo" src="https://stuff.charm.sh/charm-badge.jpg" width="400"></a> Thoughts? Questions? We love hearing from you. Feel free to reach out on [Twitter](https://twitter.com/charmcli), [The Fediverse](https://mastodon.technology/@​charm), or on [Discord](https://charm.sh/chat). </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MjQuMyIsInVwZGF0ZWRJblZlciI6IjM3LjQyNC4zIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbXX0=--> Co-authored-by: Renovate Bot <[email protected]> Reviewed-on: https://git.asdf.cafe/abs3nt/gspot/pulls/3
maaslalani
pushed a commit
to charmbracelet/huh
that referenced
this pull request
Jul 22, 2024
Key binds should be checked before the key event is accepted as user input. See charmbracelet/bubbletea#1041 for more information.
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.
This PR fixes an issue where pressing Enter or Shift+Tab would add a space to the input in
huh
's input field on Windows.Before, when emitting a key event containing a control sequence, the character would also be included.
The
textinput
bubble would see this as user input and sanitize it, converting\r
to a space and appending it.Even though this fixes the issue, the real problem lies in the fact that text input is accepted before (all) key binds are processed, presumably because it is assumed that control sequences don't contain any characters (which is the case on Unix, and with this PR now also on Windows).
This should be looked into in a separate issue in thecharmbracelet/huh#284huh
repository.Thanks @robotastronaut for sharing their research in the Charm Discord server and for the initial fix.
In contrast to their fix, this should fully align with the key handling on Unix and fix other issues like Shift+Tab not working on Windows.