Skip to content

Commit 65e822b

Browse files
committed
Support Alt+Backspace for word deletion in text areas
Add support for Alt+Backspace (Option+Backspace on macOS) to delete entire words in text input areas, matching common text editor behavior.
1 parent 1210a64 commit 65e822b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pkg/gui/editors.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88

99
func (gui *Gui) handleEditorKeypress(textArea *gocui.TextArea, key gocui.Key, ch rune, mod gocui.Modifier, allowMultiline bool) bool {
1010
switch {
11+
case (key == gocui.KeyBackspace || key == gocui.KeyBackspace2) && (mod&gocui.ModAlt) != 0:
12+
textArea.BackSpaceWord()
1113
case key == gocui.KeyBackspace || key == gocui.KeyBackspace2:
1214
textArea.BackSpaceChar()
1315
case key == gocui.KeyCtrlD || key == gocui.KeyDelete:

0 commit comments

Comments
 (0)