rl.getCursorPos()


返回光标相对于输入提示 + 字符串的实际位置。 长输入(换行)字符串以及多行提示都包含在计算中。

  • Returns: <Object>
    • rows <number> the row of the prompt the cursor currently lands on
    • cols <number> the screen column the cursor currently lands on

Returns the real position of the cursor in relation to the input prompt + string. Long input (wrapping) strings, as well as multiple line prompts are included in the calculations.