From 3a34fc4ff8fd9ee986795fcd028a7b60a18751ae Mon Sep 17 00:00:00 2001 From: Maas Lalani Date: Tue, 5 Jul 2022 14:16:29 -0400 Subject: [PATCH] fix(textarea): Add deleteWordRight --- textarea/textarea.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/textarea/textarea.go b/textarea/textarea.go index 7bad77d..c5aac9f 100644 --- a/textarea/textarea.go +++ b/textarea/textarea.go @@ -752,6 +752,12 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) { } m.deleteWordLeft() case key.Matches(msg, m.KeyMap.DeleteWordForward): + m.col = clamp(m.col, 0, len(m.value[m.row])) + if m.col >= len(m.value[m.row]) { + m.mergeLineBelow(m.row) + break + } + m.deleteWordRight() case key.Matches(msg, m.KeyMap.InsertNewline): if len(m.value) >= maxHeight { return m, nil