From d8fb24c69b5d5f895462a5e976001d93949dabe4 Mon Sep 17 00:00:00 2001 From: Maas Lalani Date: Wed, 14 Jun 2023 00:25:31 -0400 Subject: [PATCH] feat: add ctrl+right and ctrl+left to perform WordBackward and WordForward actions --- go.mod | 2 +- go.sum | 2 ++ textinput/textinput.go | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 74d130f4..7df7cfa3 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.17 require ( github.com/atotto/clipboard v0.1.4 - github.com/charmbracelet/bubbletea v0.24.1 + github.com/charmbracelet/bubbletea v0.24.2 github.com/charmbracelet/harmonica v0.2.0 github.com/charmbracelet/lipgloss v0.7.1 github.com/dustin/go-humanize v1.0.1 diff --git a/go.sum b/go.sum index 982b1201..b844fee9 100644 --- a/go.sum +++ b/go.sum @@ -4,6 +4,8 @@ github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiE github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/charmbracelet/bubbletea v0.24.1 h1:LpdYfnu+Qc6XtvMz6d/6rRY71yttHTP5HtrjMgWvixc= github.com/charmbracelet/bubbletea v0.24.1/go.mod h1:rK3g/2+T8vOSEkNHvtq40umJpeVYDn6bLaqbgzhL/hg= +github.com/charmbracelet/bubbletea v0.24.2 h1:uaQIKx9Ai6Gdh5zpTbGiWpytMU+CfsPp06RaW2cx/SY= +github.com/charmbracelet/bubbletea v0.24.2/go.mod h1:XdrNrV4J8GiyshTtx3DNuYkR1FDaJmO3l2nejekbsgg= github.com/charmbracelet/harmonica v0.2.0 h1:8NxJWRWg/bzKqqEaaeFNipOu77YR5t8aSwG4pgaUBiQ= github.com/charmbracelet/harmonica v0.2.0/go.mod h1:KSri/1RMQOZLbw7AHqgcBycp8pgJnQMYYT8QZRqZ1Ao= github.com/charmbracelet/lipgloss v0.6.0 h1:1StyZB9vBSOyuZxQUcUwGr17JmojPNm87inij9N3wJY= diff --git a/textinput/textinput.go b/textinput/textinput.go index f8990f66..55e51f7d 100644 --- a/textinput/textinput.go +++ b/textinput/textinput.go @@ -61,8 +61,8 @@ type KeyMap struct { var DefaultKeyMap = KeyMap{ CharacterForward: key.NewBinding(key.WithKeys("right", "ctrl+f")), CharacterBackward: key.NewBinding(key.WithKeys("left", "ctrl+b")), - WordForward: key.NewBinding(key.WithKeys("alt+right", "alt+f")), - WordBackward: key.NewBinding(key.WithKeys("alt+left", "alt+b")), + WordForward: key.NewBinding(key.WithKeys("alt+right", "ctrl+right", "alt+f")), + WordBackward: key.NewBinding(key.WithKeys("alt+left", "ctrl+left", "alt+b")), DeleteWordBackward: key.NewBinding(key.WithKeys("alt+backspace", "ctrl+w")), DeleteWordForward: key.NewBinding(key.WithKeys("alt+delete", "alt+d")), DeleteAfterCursor: key.NewBinding(key.WithKeys("ctrl+k")),