@@ -813,9 +813,9 @@ func (m *UI) handleKeyPressMsg(msg tea.KeyPressMsg) tea.Cmd {
813813 switch {
814814 case key.Matches(msg, m.keyMap.Editor.SendMessage):
815815 value := m.textarea.Value()
816− if strings.HasSuffix(value, "\\") {
816+ if before, ok := strings.CutSuffix(value, "\\"); ok {
817817 // If the last character is a backslash, remove it and add a newline.
818− m.textarea.SetValue(strings.TrimSuffix(value, "\\"))
818+ m.textarea.SetValue(before)
819819 break
820820 }
821821