Selection

Provides interfaces for interacting with selected text regions.

class SelectionMode(value)

Enumerated list of modes for selecting text.

BOX = 4

rectangular region

CHARACTER = 0

character-by-character selection

LINE = 2

row-by-row selection

SMART = 3

smart selection

WHOLE_LINE = 5

entire wrapped lines, which could occupy many rows

WORD = 1

word-by-word selection

static from_proto_value(value)

Creates a SelectionMode from a protobuf enum value.

static to_proto_value(value)

Converts self into a protobuf enum value.

class SubSelection(windowed_coord_range: iterm2.util.WindowedCoordRange, mode: iterm2.selection.SelectionMode, connected: bool)

Describes a continguous block of selected characters.

Parameters
  • windowed_coord_range – A WindowedCoordRange describing the range.

  • mode – A SelectionMode describing how the selection is interpreted and extended.

  • connected – If true, no newline exists between this and the next sub-selection.

async async_get_string(connection: iterm2.connection.Connection, session_id: str)str

Gets the text belonging to this subselection.

Return type

str

Parameters
  • connection (Connection) – The connection to iTerm2.

  • session_id (str) – The ID of the session for which to look up the selected text.

property mode: iterm2.selection.SelectionMode

Returns the mode of this sub-selection.

property windowedCoordRange: iterm2.util.WindowedCoordRange

Deprecated in favor of windowed_coord_range

property windowed_coord_range: iterm2.util.WindowedCoordRange

Returns the coordinate range spanned by this sub-selection.

class Selection(sub_selections: List[iterm2.selection.SubSelection])

A collection of SubSelection objects, describing all the selections in a session.

Parameters

sub_selections – An array of SubSelection objects.

async async_get_string(connection: iterm2.connection.Connection, session_id: str, width: int)str

Returns the selected text.

Return type

str

Parameters
  • connection (Connection) – The connection to iTerm2.

  • session_id (str) – The ID of the session for which to look up the selected text.

  • width (int) – The width (number of columns) of the session.

property subSelections: List[iterm2.selection.SubSelection]

Deprecated in favore of sub_selections.


Indices and tables