1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-08-06 22:33:07 +02:00

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.
This commit is contained in:
Christian Rotzoll
2025-07-14 20:44:06 +02:00
committed by Stefan Haller
parent 1210a645ef
commit 69567063f4

View File

@ -8,6 +8,9 @@ import (
func (gui *Gui) handleEditorKeypress(textArea *gocui.TextArea, key gocui.Key, ch rune, mod gocui.Modifier, allowMultiline bool) bool {
switch {
case (key == gocui.KeyBackspace || key == gocui.KeyBackspace2) && (mod&gocui.ModAlt) != 0,
key == gocui.KeyCtrlW:
textArea.BackSpaceWord()
case key == gocui.KeyBackspace || key == gocui.KeyBackspace2:
textArea.BackSpaceChar()
case key == gocui.KeyCtrlD || key == gocui.KeyDelete:
@ -42,8 +45,6 @@ func (gui *Gui) handleEditorKeypress(textArea *gocui.TextArea, key gocui.Key, ch
textArea.GoToStartOfLine()
case key == gocui.KeyCtrlE || key == gocui.KeyEnd:
textArea.GoToEndOfLine()
case key == gocui.KeyCtrlW:
textArea.BackSpaceWord()
case key == gocui.KeyCtrlY:
textArea.Yank()