Skip to content

Commit

Permalink
repl: catch \v and \r in new-line detection
Browse files Browse the repository at this point in the history
  • Loading branch information
RedYetiDev authored Aug 22, 2024
1 parent e70bd47 commit 6f3a1d0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/internal/repl/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,9 +436,9 @@ function setupPreview(repl, contextSymbol, bufferSymbol, active) {

// Line breaks are very rare and probably only occur in case of error
// messages with line breaks.
const lineBreakPos = StringPrototypeIndexOf(inspected, '\n');
if (lineBreakPos !== -1) {
inspected = `${StringPrototypeSlice(inspected, 0, lineBreakPos)}`;
const lineBreakMatch = RegExpPrototypeExec(/[\r\n\v]/, inspected);
if (lineBreakMatch !== null) {
inspected = `${StringPrototypeSlice(inspected, 0, lineBreakMatch.index)}`;
}

const result = repl.useColors ?
Expand Down

0 comments on commit 6f3a1d0

Please sign in to comment.