{ } Raw JSON

bundles / IPython 9.17.0 / IPython / core / completer / cursor_to_position

function

IPython.core.completer:cursor_to_position

source: /dev/ipython/IPython/core/completer.py:1674

Signature

def cursor_to_position(text: str, line: int, column: int) → int

Summary

Convert the (line,column) position of the cursor in text to an offset in a string.

Parameters

text : str

The text in which to calculate the cursor offset

line : int

Line of the cursor; 0-indexed

column : int

Column of the cursor 0-indexed

Returns

: Position of the cursor in ``text``, 0-indexed.

See also

position_to_cursor

reciprocal of this function

Aliases

  • IPython.core.completer.cursor_to_position