diff --git a/internal/ui/model/ui.go b/internal/ui/model/ui.go index f49f8bbdcc455caf6f2228938a1d95e1e24c8c21..f7010369b3592cf3f731c30a8eaf2a5ffed4adf7 100644 --- a/internal/ui/model/ui.go +++ b/internal/ui/model/ui.go @@ -813,9 +813,9 @@ func (m *UI) handleKeyPressMsg(msg tea.KeyPressMsg) tea.Cmd { switch { case key.Matches(msg, m.keyMap.Editor.SendMessage): value := m.textarea.Value() - if strings.HasSuffix(value, "\\") { + if before, ok := strings.CutSuffix(value, "\\"); ok { // If the last character is a backslash, remove it and add a newline. - m.textarea.SetValue(strings.TrimSuffix(value, "\\")) + m.textarea.SetValue(before) break }