Class: TuiTui::TextInput::Viewport

Inherits:
Data
  • Object
show all
Defined in:
lib/tui_tui/text_input.rb

Overview

The visible region of a horizontally-scrolled value: the slice to draw, scrolled so the cursor (and the cell its block occupies) stays inside cols display columns. Lets a long value be drawn in a narrow field without the cursor running off the edge.

text is the visible substring, cursor_col the display columns from the viewport's left edge to the cursor (measured from the slice, not the start of the value), cursor_grapheme the grapheme under the cursor (nil at the end), and start the left grapheme index (feed it to #index_at as from:).

Instance Attribute Summary collapse

Instance Attribute Details

#cursor_colObject (readonly)

Returns the value of attribute cursor_col

Returns:

  • (Object)

    the current value of cursor_col



117
118
119
# File 'lib/tui_tui/text_input.rb', line 117

def cursor_col
  @cursor_col
end

#cursor_graphemeObject (readonly)

Returns the value of attribute cursor_grapheme

Returns:

  • (Object)

    the current value of cursor_grapheme



117
118
119
# File 'lib/tui_tui/text_input.rb', line 117

def cursor_grapheme
  @cursor_grapheme
end

#startObject (readonly)

Returns the value of attribute start

Returns:

  • (Object)

    the current value of start



117
118
119
# File 'lib/tui_tui/text_input.rb', line 117

def start
  @start
end

#textObject (readonly)

Returns the value of attribute text

Returns:

  • (Object)

    the current value of text



117
118
119
# File 'lib/tui_tui/text_input.rb', line 117

def text
  @text
end