Skip to content

Commit

Permalink
repl: use public getCursorPos()
Browse files Browse the repository at this point in the history
_getCursorPos() recently became public API. This commit updates
the remaining uses of _getCursorPos() to use the public API.

PR-URL: nodejs#31091
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
cjihrig authored and targos committed Apr 25, 2020
1 parent 76f82fc commit 5020b8a
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 @@ -142,7 +142,7 @@ function setupPreview(repl, contextSymbol, bufferSymbol, active) {

function getPreviewPos() {
const displayPos = repl._getDisplayPos(`${repl._prompt}${repl.line}`);
const cursorPos = repl._getCursorPos();
const cursorPos = repl.getCursorPos();
const rows = 1 + displayPos.rows - cursorPos.rows;
return { rows, cols: cursorPos.cols };
}
Expand Down Expand Up @@ -529,7 +529,7 @@ function setupReverseSearch(repl) {
rows = repl._getDisplayPos(`${repl._prompt}${line}`).rows;
cursorTo(repl.output, promptPos.cols);
} else if (isInReverseSearch && repl.line !== '') {
rows = repl._getCursorPos().rows;
rows = repl.getCursorPos().rows;
cursorTo(repl.output, promptPos.cols);
}
if (rows !== 0)
Expand Down Expand Up @@ -581,7 +581,7 @@ function setupReverseSearch(repl) {
if (repl.line !== '') {
repl.output.write(repl.line);
if (repl.line.length !== repl.cursor) {
const { cols, rows } = repl._getCursorPos();
const { cols, rows } = repl.getCursorPos();
cursorTo(repl.output, cols);
if (rows !== 0)
moveCursor(repl.output, 0, rows);
Expand Down

0 comments on commit 5020b8a

Please sign in to comment.