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

Shift Key Issue on First Character in Ghostty Terminal #981

Open
golovinengineer opened this issue Feb 13, 2025 · 3 comments
Open

Shift Key Issue on First Character in Ghostty Terminal #981

golovinengineer opened this issue Feb 13, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@golovinengineer
Copy link

When using Broot (v1.44.7) in the Ghostty terminal emulator on macOS, the first character typed with Shift pressed does not behave as expected.

Specifically:

  • If the first character should be uppercase, it remains lowercase.
  • If typing a command (verb) starting with :, it prints ; instead.
  • Once Shift is held for subsequent characters, they appear correctly in uppercase.
  • If Shift is released and pressed again, the issue repeats.
  • This behaviour does not occur in Alacritty or macOS's native Terminal.

Steps to Reproduce

  • Open Ghostty terminal.
  • Launch Broot (br).
  • Start typing a search pattern with a capital letter or enter a command (e.g., :toggle_tree).
  • Observe that the first character does not register correctly with Shift.

Expected Behaviour

The first character typed with Shift should be uppercase, and : should be entered correctly instead of ;.

Most likely that issue origins in Ghostty, but in other apps and places user input works as expected, so I decide to report here at first. I didn't notice similar behaviour on Windows in Windows Terminal, but check that as soon as I can.

Environment

  • Broot Version: 1.44.7
  • Terminal Emulator: Ghostty
  • OS: macOS
@golovinengineer golovinengineer added the bug Something isn't working label Feb 13, 2025
@golovinengineer
Copy link
Author

I don’t see this issue in Windows Terminal or Alacritty (for Windows), so it looks like the problem comes from Ghostty. But I haven’t found other apps that act the same way. Can someone explain what Broot does when handling the first typed character?

@Canop
Copy link
Owner

Canop commented Feb 16, 2025

it looks like the problem comes from Ghostty

Not just Ghostty. Interpreting keys in terminal is a horrible dance.
I don't reproduce the problem with Ghostty/debian/azerty
Can you please check whether you see the problem with https://github.com/Canop/print_key ?

@golovinengineer
Copy link
Author

I've made some test. I use similar combination of key presses in broot and print_key with different modes. The combination is following:
<d>, hold <Shift>, <d>, <d>, release <Shift>, <d>, hold <Shift>, <d>, <d>, release <Shift>, <;>, hold <Shift>, <;>, <;>, release <Shift>, <;>, hold <Shift>, <;>, <;>, release <Shift>.

After that sequence Broot prints in input line following:

dDddD;;:;;:

The print_key with default parameters returns:

Many terminal applications let you define key bindings but it's hard to know which ones are available.
This program shows you the key combinations that can be used in a program running in this terminal.
You chose the Kitty mode.
Combinations with several simple keys are possible as soon as there's at least one modifier key.
Type any key combination.
You typed Shift-d
You typed Shift-d
You typed d
You typed Shift-d
You typed Shift-d
You typed ;
You typed Shift-:
You typed :
You typed ;
You typed Shift-:
You typed :

with --mode ansi:

Many terminal applications let you define key bindings but it's hard to know which ones are available.
This program shows you the key combinations that can be used in a program running in this terminal.
You chose the ANSI mode.
Combinations will be reduced to one simple key with optional modifiers
Type any key combination.
You typed Shift-d
You typed Shift-d
You typed d
You typed Shift-d
You typed Shift-d
You typed ;
You typed :
You typed :
You typed ;
You typed :
You typed :

with --mode kitty-multi-simples:

Many terminal applications let you define key bindings but it's hard to know which ones are available.
This program shows you the key combinations that can be used in a program running in this terminal.
You chose the KittyMultiSimples mode.
Combinations with several simple keys are possible even without modifiers.
Type any key combination.
You typed Shift-d
You typed Shift-d
You typed d
You typed Shift-d
You typed Shift-d
You typed ;
You typed Shift-:
You typed :
You typed ;
You typed Shift-:
You typed :

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants