Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup: add big todo comment
  • Loading branch information
BridgeAR committed Dec 19, 2019
commit 19ded6706a874b9a707d55543f073a679045a41b
21 changes: 21 additions & 0 deletions lib/internal/repl/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,27 @@ function setupReverseSearch(repl) {
}

function print(outputLine, inputLine, cursor = repl.cursor) {
// TODO(BridgeAR): Resizing the terminal window breaks this. To fix that,
// readline must be aware of this information. It's probably best to add a
// couple of properties to readline that allow to do the following:
// 1. Add arbitrary data to the end of the current line while not counting
// towards the line. This would be useful for the completion previews.
// 2. Add arbitrary extra lines that do not count towards the regular line.
// This would be useful for both, the input preview and the reverse
// search. It might be combined with the first part?
// 3. Add arbitrary input that is "on top" of the current line. That is
// useful for the reverse search.
// 4. To trigger the line refresh, functions should be used to pass through
// the information.
// The data would then be accounted for when calling `_refreshLine()`.
// This function would then look similar to:
// repl.overlay(outputLine);
// repl.addTrailingLine(inputLine);
// repl.setCursor(cursor);
// More potential improvements: use something similar to stream.cork().
// Multiple cursor moves on the same tick could be prevented in case all
// writes from the same tick are combined and the cursor is moved at the
// tick end instead of after each operation.
let rows = 0;
if (lastMatch !== -1) {
const line = repl.history[lastMatch].slice(0, lastCursor);
Expand Down