From ef8ec984894408953cc6e0ea2e46cfeb9c272507 Mon Sep 17 00:00:00 2001 From: Billy Biggs Date: Mon, 14 Jul 2025 05:34:20 +0200 Subject: Add back support for escaping newline with a \ character (#4064) --- packages/cli/src/ui/components/InputPrompt.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'packages/cli/src/ui/components/InputPrompt.tsx') diff --git a/packages/cli/src/ui/components/InputPrompt.tsx b/packages/cli/src/ui/components/InputPrompt.tsx index 371fb48d..5edda273 100644 --- a/packages/cli/src/ui/components/InputPrompt.tsx +++ b/packages/cli/src/ui/components/InputPrompt.tsx @@ -329,7 +329,15 @@ export const InputPrompt: React.FC = ({ if (key.name === 'return' && !key.ctrl && !key.meta && !key.paste) { if (buffer.text.trim()) { - handleSubmitAndClear(buffer.text); + const [row, col] = buffer.cursor; + const line = buffer.lines[row]; + const charBefore = col > 0 ? cpSlice(line, col - 1, col) : ''; + if (charBefore === '\\') { + buffer.backspace(); + buffer.newline(); + } else { + handleSubmitAndClear(buffer.text); + } } return; } -- cgit v1.2.3