@@ -313,9 +313,9 @@ func (m *editorCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
313313 // Handle Enter key
314314 if m.textarea.Focused() && key.Matches(msg, m.keyMap.SendMessage) {
315315 value := m.textarea.Value()
316− if len(value) > 0 && value[len(value)-1] == '\\' {
317− // If the last character is a backslash, remove it and add a newline
318− m.textarea.SetValue(value[:len(value)-1])
316+ if strings.HasSuffix(value, "\\") {
317+ // If the last character is a backslash, remove it and add a newline.
318+ m.textarea.SetValue(strings.TrimSuffix(value, "\\"))
319319 } else {
320320 // Otherwise, send the message
321321 return m, m.send()