Skip to content

Commit a489e2d

Browse files
authored
Merge pull request lessweb#43 from wenjiazhu1980/main
fix(ui): normalize line endings in PromptInput to preserve multi-line…
2 parents f142fa4 + c7dd640 commit a489e2d

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/ui/PromptInput.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,9 @@ export const PromptInput = React.memo(function PromptInput({
411411
}
412412

413413
if (input && !key.ctrl && !key.meta) {
414-
const sanitized = input.replace(/\r/g, "");
414+
// Normalize line endings from paste: \r\n (Windows) → \n, \r (old macOS/Enter) → \n.
415+
// This preserves multi-line formatting when the user pastes content.
416+
const sanitized = input.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
415417
updateBuffer((s) => insertText(s, sanitized));
416418
}
417419
},

0 commit comments

Comments
 (0)