This is a development version (9.18.0.dev) and may be unstable.Go to latest (9.17.0)
{ } Raw JSON

bundles / IPython 9.18.0.dev / IPython / utils / tokenutil / line_at_cursor

function

IPython.utils.tokenutil:line_at_cursor

source: /IPython/utils/tokenutil.py:74

Signature

def line_at_cursor(cell: str, cursor_pos: int = 0) → tuple[str, int]

Summary

Return the line in a cell at a given cursor position

Extended Summary

Used for calling line-based APIs that don't support multi-line input, yet.

Parameters

cell : str

multiline block of text

cursor_pos : integer

the cursor position

Returns

: (line, offset): (string, integer)

The line with the current cursor, and the character offset of the start of the line.

Aliases

  • IPython.utils.tokenutil.line_at_cursor