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:
committed by
Stefan Haller
parent
1210a645ef
commit
69567063f4
@ -8,6 +8,9 @@ import (
|
|||||||
|
|
||||||
func (gui *Gui) handleEditorKeypress(textArea *gocui.TextArea, key gocui.Key, ch rune, mod gocui.Modifier, allowMultiline bool) bool {
|
func (gui *Gui) handleEditorKeypress(textArea *gocui.TextArea, key gocui.Key, ch rune, mod gocui.Modifier, allowMultiline bool) bool {
|
||||||
switch {
|
switch {
|
||||||
|
case (key == gocui.KeyBackspace || key == gocui.KeyBackspace2) && (mod&gocui.ModAlt) != 0,
|
||||||
|
key == gocui.KeyCtrlW:
|
||||||
|
textArea.BackSpaceWord()
|
||||||
case key == gocui.KeyBackspace || key == gocui.KeyBackspace2:
|
case key == gocui.KeyBackspace || key == gocui.KeyBackspace2:
|
||||||
textArea.BackSpaceChar()
|
textArea.BackSpaceChar()
|
||||||
case key == gocui.KeyCtrlD || key == gocui.KeyDelete:
|
case key == gocui.KeyCtrlD || key == gocui.KeyDelete:
|
||||||
@ -42,8 +45,6 @@ func (gui *Gui) handleEditorKeypress(textArea *gocui.TextArea, key gocui.Key, ch
|
|||||||
textArea.GoToStartOfLine()
|
textArea.GoToStartOfLine()
|
||||||
case key == gocui.KeyCtrlE || key == gocui.KeyEnd:
|
case key == gocui.KeyCtrlE || key == gocui.KeyEnd:
|
||||||
textArea.GoToEndOfLine()
|
textArea.GoToEndOfLine()
|
||||||
case key == gocui.KeyCtrlW:
|
|
||||||
textArea.BackSpaceWord()
|
|
||||||
case key == gocui.KeyCtrlY:
|
case key == gocui.KeyCtrlY:
|
||||||
textArea.Yank()
|
textArea.Yank()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user