Skip to content

Add Ctrl+Backspace keybind to delete word#979

Closed
pol-rivero wants to merge 1 commit intognome-terminator:masterfrom
pol-rivero:delete-word
Closed

Add Ctrl+Backspace keybind to delete word#979
pol-rivero wants to merge 1 commit intognome-terminator:masterfrom
pol-rivero:delete-word

Conversation

@pol-rivero
Copy link
Copy Markdown
Contributor

Most users expect Ctrl+Backspace to delete the entire word placed to the left of the cursor. This PR adds a customizable keybind (defaults to Ctrl+Backspace) that does that.

@mattrose
Copy link
Copy Markdown
Member

I'm wondering if this is not handled better by readline or the shell, not the terminal emulator. Do you know if other terminal emulators do this?

@pol-rivero
Copy link
Copy Markdown
Contributor Author

I've tested alacritty, kitty, gnome-terminal and konsole and ctrl+backspace doesn't seem to work on any of them.
It does work in vscode, thanks to these default binds. They seem to be sending \u0017 for ctrl+backspace and \u001bd for ctrl+delete.

I will investigate if using \u0017 is better than the "alt+backspace" I'm currently sending. Also, I completely forgot about ctrl+delete, so I'll add that too.

@mattrose
Copy link
Copy Markdown
Member

I confirmed that this is handled by the readline library. I really don't want to add functionality that is duplicated by another layer of the shell. You should probably edit the readline configuration to get the behaviour you want in your shell. I think all you're doing here is mapping ctrl+backspace to Meta-Delete and having that handled by readline.

Do you mind if I close this PR?

@pol-rivero
Copy link
Copy Markdown
Contributor Author

Ah I see, yes I'll close the PR.
Thank you for your time.

@pol-rivero pol-rivero closed this Jan 12, 2025
@mattrose
Copy link
Copy Markdown
Member

Thanks for understanding. I hate turning away PRs, especially ones from people who have contributed successfully in the past, but I really want to keep the code as simple as I can.

@pol-rivero
Copy link
Copy Markdown
Contributor Author

I completely agree.
Don't worry at all about rejecting this PR. I just didn't know that readline can be configured, otherwise I wouldn't have done this code change. Thank you for helping me learn.

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