Skip to content

Commit

Permalink
repl: fix preview bug in case of long lines
Browse files Browse the repository at this point in the history
This addresses an issue that is caused by lines that exceed the
current window columns. That would cause the preview to confuse the
REPL. This is meant as hot fix. The preview should be able to handle
these cases appropriately as well later on.

PR-URL: #30907
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
BridgeAR authored and MylesBorins committed Dec 17, 2019
1 parent 6a3e79f commit 02f3fe4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/internal/repl/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,16 @@ function setupPreview(repl, contextSymbol, bufferSymbol, active) {
return;
}

// Do not show previews in case the current line is longer than the column
// width.
// TODO(BridgeAR): Fix me. This should not be necessary. It currently breaks
// the output though. We also have to check for characters that have more
// than a single byte as length. Check Interface.prototype._moveCursor. It
// contains the necessary logic.
if (repl.line.length + repl._prompt.length > repl.columns) {
return;
}

// Add the autocompletion preview.
// TODO(BridgeAR): Trigger the input preview after the completion preview.
// That way it's possible to trigger the input prefix including the
Expand Down

0 comments on commit 02f3fe4

Please sign in to comment.