Skip to content

vtf txb display items

srccircumflex edited this page Apr 24, 2023 · 4 revisions

↑ vtf-txb-display

items

The module contains items used by the displays for data management.

Objects

class items.DisplayCoordTarget(NamedTuple)

The translation of a visual coordinate to the _Row (row) and the content data point (cnt_cursor). Includes a reference to the DisplayBrowsable | DisplayScrollable | DisplayStatic object (display) and the DisplayRowItem (row_item) from the cache of the currently displayed area; can be None if the coordinate points to an area outside the display. x_as_far and y_as_far indicates whether the corresponding coordinate is the closest possible point.

The item includes first methods for processing the item in the TextBuffer:
  • set_cursor
  • word_coord
  • mark_word

display: _DisplayBase

row_item: DisplayRowItem | None

row: _Row

cnt_cursor: int

x_as_far: bool

y_as_far: bool

__eq__(other) -> bool

Return whether the _Row's and cursor positions of the items match.

mark_word(a_delimiter, b_delimiter=None) -> tuple[int, int]

Create a marker on the string pointed to and return the data coordinate (<data-start>, <data-stop>). Start and end of the word is defined by regex patterns a_delimiter and b_delimiter. If b_delimiter is None, b_delimiter is equal to a_delimiter.

set_cursor(mark=False) -> bool

Set the cursor to the position. Return whether the cursor was set.

word_coord(a_delimiter, b_delimiter=None) -> tuple[int, int]

Return the data coordinate of the string pointed to (<data-start>, <data-stop>). Start and end of the word is defined by regex patterns a_delimiter and b_delimiter. If b_delimiter is None, b_delimiter is equal to a_delimiter.

class items.DisplayItem(NamedTuple)

The display rows (list[DisplayRowItem]) and relative cursor coordinates.

pointer_column: int

pointer_row: int

rows: list[DisplayRowItem]

__iter__() -> Generator[EscSegment | EscContainer]

class items.DisplayRowItem(NamedTuple)

The final display row and VisRowItem.

display_row: EscSegment | EscContainer

row_item: VisRowItem

__str__() -> EscSegment | EscContainer

class items.RowFrameItem(NamedTuple)

The first parameterization of a display row.

  • display_pointer: int: relative x position of the cursor to the left display edge.
  • part_cursor: int: relative x position of the cursor to the left frame edge.
  • vis_slice: tuple[int, int | None] | None: visual slice for _Row.
  • len_l_prompts: int: sum of the space on the left side for prompt and overflow character.
  • len_r_prompts: int: sum of the space on the right side for prompt and overflow character.
  • content_width: int: the width of the shown content of the _Row. Is always -1 when using DisplayStatic.
  • part_id: int: the type designation of the area shown:
    • 0 ( Basic area )
      The characters of the row do not span the size of the displayed area.
    • 1 ( First area )
      The number of characters in the row is larger than the space in the display and the area at the left end is displayed.
    • 2 ( Middle area )
      ... and neither the area at the left end nor the area at the right end is displayed.
    • 3 ( Last area )
      ... and the area at the right end is displayed.
    • 4 ( Out of range )
  • part_form: EscSegment | None: Frame format.
  • lr_prompt: tuple[ EscSegment | EscContainer , EscSegment | EscContainer ]: left/right prompt.

content_width: int

display_pointer: int

len_l_prompts: int

len_r_prompts: int

lr_prompt: Sequence[EscSegment | EscContainer, EscSegment | EscContainer] = ('', '')

part_cursor: int

part_form: EscSegment | None = None

part_id: Literal[0, 1, 2, 3, 4]

vis_slice: tuple[int, int | None] | None

class items.VisRowItem(NamedTuple)

Merging of RowFrameItem parameterization and coordinates about tabs, marks (_Marker) and anchors (_GlobCursor).

  • row: _Row
  • tab_spaces: tuple[int, ...]
  • v_marks: list[tuple[list[int, int], tuple[int | None, int | None, int]]]: [(<origin marking>, <inrow coordinates>), ...]
  • v_anchors: list[tuple[tuple[int | str, int], int]]: [(<origin anchor>, <inrow coordinate>), ...]
  • row_frame: RowFrameItem

row: _Row

row_frame: RowFrameItem

tab_spaces: tuple[int, ...]

v_anchors: list[tuple[tuple[int | str, int], int]]

v_marks: list[tuple[list[int, int], tuple[int | None, int | None, int]]]


Date: 20 Dec 2022
Version: 0.1
Author: Adrian Hoefflin [srccircumflex]
Doc-Generator: "pyiStructure-RSTGenerator" <prototype>
Clone this wiki locally