Skip to content

fix: Handle backspace in Bash#64

Merged
joelspadin merged 1 commit intozmkfirmware:mainfrom
joelspadin:backspace-fix
Mar 8, 2026
Merged

fix: Handle backspace in Bash#64
joelspadin merged 1 commit intozmkfirmware:mainfrom
joelspadin:backspace-fix

Conversation

@joelspadin
Copy link
Collaborator

Bash returns the ASCII code for DELETE instead of BACKSPACE when pressing backspace. Added a special case for that.

Likely fixes #63

Bash returns the ASCII code for DELETE instead of BACKSPACE when
pressing backspace. Added a special case for that.
Copy link
Contributor

@caksoylar caksoylar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work fine for me (fixes backspace on fish, delete works OK; on bash, fixes backspace but delete still doesn't work which is better).

@caksoylar
Copy link
Contributor

So I have more context: what's the reason for having rich and manual handling implementations? I assume rich didn't cover all our use cases, but is there opportunity to simplify the interface and not have to do manual input processing?

Currently it's weird because when I run zmk keyboard new the keyboard name prompt uses Rich, where backspace works fine but arrow keys don't, and the filters for e.g. interconnect uses the manual handling, where arrow keys work OK.

@joelspadin
Copy link
Collaborator Author

Rich prompts don't have anything close to the menu system, as far as I'm aware. Running a prompt function doesn't return until the user presses enter, so there's no way to use a prompt for the filter text but draw the menu as well.

@joelspadin
Copy link
Collaborator Author

Seems to work fine for me (fixes backspace on fish, delete works OK; on bash, fixes backspace but delete still doesn't work which is better).

Delete is working for me on Bash (version 5.2.21) in WSL Ubuntu. Could you run python3 and try the following to see what it prints?

import os
os.read(sys.stdin.fileno(), 4)
# press the delete key

I get

>>> import os
>>> os.read(sys.stdin.fileno(), 4)
^[[3~

@caksoylar
Copy link
Contributor

Sorry, red herring. I must have mixed up the testing, both backspace and delete work in bash/fish when I try now.

@joelspadin joelspadin merged commit 0372f31 into zmkfirmware:main Mar 8, 2026
1 check passed
@joelspadin joelspadin deleted the backspace-fix branch March 8, 2026 02:02
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.

Search in keyboard add doesn't work

2 participants