Преглед на файлове

wip: append-prompt is better

Dax Raad преди 1 година
родител
ревизия
500cea5ce7
променени са 1 файла, в които са добавени 6 реда и са изтрити 1 реда
  1. 6 1
      packages/tui/internal/tui/tui.go

+ 6 - 1
packages/tui/internal/tui/tui.go

@@ -515,7 +515,12 @@ func (a Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
 				Parts []opencode.Part `json:"parts"`
 			}
 			json.Unmarshal((msg.Body), &body)
-			a.editor.SetValueWithAttachments(strings.TrimRight(a.editor.Value(), " ") + " " + body.Text + " ")
+			existing := a.editor.Value()
+			text := body.Text
+			if existing != "" && !strings.HasSuffix(existing, " ") {
+				text = " " + text
+			}
+			a.editor.SetValueWithAttachments(existing + text + " ")
 		default:
 			break
 		}