You are viewing an older version (9.3.0). Go to latest (9.13.0)
{ } Raw JSON

bundles / IPython 9.3.0 / IPython / core / completer / position_to_cursor

function

IPython.core.completer:position_to_cursor

source: /IPython/core/completer.py :1604

Signature

def   position_to_cursor ( text : str offset : int )  →  tuple[int, int]

Summary

Convert the position of the cursor in text (0 indexed) to a line number(0-indexed) and a column number (0-indexed) pair

Extended Summary

Position should be a valid position in text.

Parameters

text : str

The text in which to calculate the cursor offset

offset : int

Position of the cursor in text, 0-indexed.

Returns

(line, column) : (int, int)

Line of the cursor; 0-indexed, column of the cursor 0-indexed

See also

cursor_to_position

reciprocal of this function

Aliases

  • IPython.core.completer.position_to_cursor