Просмотр исходного кода

fix: \{return} should be replaced with new line on all lines (#1119)

Yihui Khuu 7 месяцев назад
Родитель
Сommit
46c246e01f
1 измененных файлов с 2 добавлено и 1 удалено
  1. 2 1
      packages/tui/internal/components/chat/editor.go

+ 2 - 1
packages/tui/internal/components/chat/editor.go

@@ -297,7 +297,8 @@ func (m *editorComponent) Submit() (tea.Model, tea.Cmd) {
 
 	if len(value) > 0 && value[len(value)-1] == '\\' {
 		// If the last character is a backslash, remove it and add a newline
-		m.textarea.ReplaceRange(len(value)-1, len(value), "")
+		backslashCol := m.textarea.CurrentRowLength() - 1
+		m.textarea.ReplaceRange(backslashCol, backslashCol+1, "")
 		m.textarea.InsertString("\n")
 		return m, nil
 	}