Skip to content
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
merged 1 commit into from
Jun 21, 2024

Conversation

Sculas
Copy link
Contributor

@Sculas Sculas commented Jun 18, 2024

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 the huh repository. charmbracelet/huh#284

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.

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.
Copy link
Member

@aymanbagabas aymanbagabas left a 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 aymanbagabas merged commit a08802e into charmbracelet:master Jun 21, 2024
9 checks passed
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 ([@&#8203;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/@&#8203;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 ([#&#8203;1023](charmbracelet/bubbletea#1023)) ([@&#8203;aymanbagabas](https://github.com/aymanbagabas))

##### Bug fixes

-   [`a08802e`](charmbracelet/bubbletea@a08802e): fix(windows): coninput not handling control sequences ([#&#8203;1041](charmbracelet/bubbletea#1041)) ([@&#8203;Sculas](https://github.com/Sculas))

##### Other work

-   [`2d65ed6`](charmbracelet/bubbletea@2d65ed6): chore(examples): removed use of deprecated Copy ([@&#8203;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/@&#8203;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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants