From 169b63fa538864ad42a64ed532d5db19711abc8d Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Thu, 14 Aug 2025 10:58:23 -0400 Subject: [PATCH] fix(keyboard-input): operate on characters, not bytes --- internal/tui/components/chat/editor/editor.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/tui/components/chat/editor/editor.go b/internal/tui/components/chat/editor/editor.go index f8a966431d6304610c3dccb3a8064ccee097e306..04fb5ed1976c7cf7ba4af372dd16ecef48ceb82f 100644 --- a/internal/tui/components/chat/editor/editor.go +++ b/internal/tui/components/chat/editor/editor.go @@ -313,9 +313,9 @@ func (m *editorCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) { // Handle Enter key if m.textarea.Focused() && key.Matches(msg, m.keyMap.SendMessage) { value := m.textarea.Value() - if len(value) > 0 && value[len(value)-1] == '\\' { - // If the last character is a backslash, remove it and add a newline - m.textarea.SetValue(value[:len(value)-1]) + if strings.HasSuffix(value, "\\") { + // If the last character is a backslash, remove it and add a newline. + m.textarea.SetValue(strings.TrimSuffix(value, "\\")) } else { // Otherwise, send the message return m, m.send()