on main help sign in
fix(keyboard-input): operate on characters, not bytes
commit169b63fa538864ad42a64ed532d5db19711abc8d authorChristian Rocha <christian@rocha.is> dateThu 14 Aug 2025, 10:58 (1 year ago) parent1bc41c8
1 file changed+3−3
internal/tui/components/chat/editor/editor.go+3−3
internal/tui/components/chat/editor/editor.go+3−3
@@ -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()