TermOx
Public Member Functions | List of all members
ox::detail::Textline_core Class Reference

Provides a view of a Glyph_string and cursor position over a fixed length. More...

#include <textline_core.hpp>

Public Member Functions

 Textline_core (ox::Glyph_string initial, int display_length, ox::Align alignment, int cursor_index=0)
 
void set_text (ox::Glyph_string x)
 Clear and reset the text.
 
auto text () const noexcept -> ox::Glyph_string const &
 Return the full text contents.
 
void clear ()
 Erase all text and reset anchor and cursor indices.
 
void set_display_length (int x)
 Set the number of cells that the text will be displayed in.
 
auto display_length () const noexcept -> int
 Return the current display_length.
 
void set_alignment (ox::Align x)
 Set either Left or Right Alignment, display_length interacts with this.
 
auto alignment () const noexcept -> ox::Align
 Return the current alignment.
 
void increment_cursor ()
 Move the cursor one position to the right, scrolling the text if needed.
 
void decrement_cursor ()
 Move the cursor one position to the left, scrolling the text if needed.
 
void move_cursor_to_display (int x)
 Move the cursor to the closest index to display position x.
 
void set_cursor_to_index (int i)
 Move the cursor to the Glyph at index i into the text, scrolls.
 
void cursor_home ()
 Move the Cursor to the first index and scroll.
 
void cursor_end ()
 Move the Cursor to the last index and scroll.
 
void insert_at_cursor (ox::Glyph x)
 Inserts x at the current cursor index.
 
void erase_at_cursor ()
 Remove the Glyph at the cursor index.
 
void erase_before_cursor ()
 Remove the Glyph at one less the cursor index, if valid.
 
auto cursor_position () const noexcept -> int
 Return the position along the display length that the cursor is at.
 
auto display_substr () const -> ox::Glyph_string
 Return a substring that fits within width, accounting for cursor scroll. More...
 

Detailed Description

Provides a view of a Glyph_string and cursor position over a fixed length.

Member Function Documentation

◆ display_substr()

auto ox::detail::Textline_core::display_substr ( ) const -> ox::Glyph_string

Return a substring that fits within width, accounting for cursor scroll.

Appends a trailing space if the last char plus one space is open.


The documentation for this class was generated from the following files: