diff --git a/lib/internal/repl/utils.js b/lib/internal/repl/utils.js index bdc402ee08715d..c54e173bdf3e1c 100644 --- a/lib/internal/repl/utils.js +++ b/lib/internal/repl/utils.js @@ -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