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

ctrl+<number> not captured #1207

Open
jonas-grgt opened this issue Oct 27, 2024 · 1 comment
Open

ctrl+<number> not captured #1207

jonas-grgt opened this issue Oct 27, 2024 · 1 comment

Comments

@jonas-grgt
Copy link

jonas-grgt commented Oct 27, 2024

When pressing ctrl+ only the number is received in the Update method.

To Reproduce

func (t *Model) Update(msg tea.Msg) {
	switch msg := msg.(type) {
	case tea.KeyMsg:
		if s := msg.String(); s == "ctrl+1" {

When pressing Ctrl+1 and evaluating msg.String() it returns "1"

Expected behavior
When pressing Ctrl+1 and evaluating msg.String() it returns "ctrl+1"

@semihbkgr
Copy link
Contributor

To my understanding, the behavior you're seeing with Ctrl+1 is because the terminal only sends the character 1 without a distinct representation for the Ctrl modifier, as numeric key combinations do not generate unique key events like some control characters do.

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

No branches or pull requests

2 participants