Support escaping carriage returns with \ (#1127)
This commit is contained in:
parent
e59c872b3d
commit
708ba8902a
|
@ -283,8 +283,15 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
|
|||
|
||||
// Ctrl+Enter for newline, Enter for submit
|
||||
if (key.return) {
|
||||
if (key.ctrl) {
|
||||
// Ctrl+Enter for newline
|
||||
const [row, col] = buffer.cursor;
|
||||
const line = buffer.lines[row];
|
||||
const charBefore = col > 0 ? cpSlice(line, col - 1, col) : '';
|
||||
|
||||
if (key.ctrl || charBefore === '\\') {
|
||||
// Ctrl+Enter or escaped newline
|
||||
if (charBefore === '\\') {
|
||||
buffer.backspace();
|
||||
}
|
||||
buffer.newline();
|
||||
} else {
|
||||
// Enter for submit
|
||||
|
|
Loading…
Reference in New Issue