MCPcopy Index your code
hub / github.com/nodejs/node / getCursorPos

Method getCursorPos

lib/internal/readline/interface.js:1223–1227  ·  view source on GitHub ↗

* Returns the real position of the cursor in relation * to the input prompt + string. * @returns {{ * rows: number; * cols: number; * }}

()

Source from the content-addressed store, hash-verified

1221 * }}
1222 */
1223 getCursorPos() {
1224 const strBeforeCursor = this[kPrompt] + StringPrototypeSlice(this.line, 0, this.cursor);
1225
1226 return this[kGetDisplayPos](strBeforeCursor);
1227 }
1228
1229 // This function moves cursor dx places to the right
1230 // (-dx for left) and refreshes the line if it is needed.

Callers 12

[kRefreshLine]Method · 0.95
[kInsertString]Method · 0.95
[kAddNewLineOnTTY]Method · 0.95
[kMoveCursor]Method · 0.95
getPreviewPosFunction · 0.80
printFunction · 0.80
resetFunction · 0.80
assertCursorRowsAndColsFunction · 0.80
assertCursorRowsAndColsFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected