ttx 0.1.0
Loading...
Searching...
No Matches
ttx::terminal::ReflowResult Class Reference

Represents the result of reflowing a RowGroup. More...

#include <ttx/terminal/reflow_result.h>

Public Member Functions

void add_offset (AbsolutePosition position, i64 dr, i32 dc, bool absolute_column=false)
 Add an offset for the given position to map to new coordinates.
 
void merge (ReflowResult &&other)
 Merge another reflow result with this one.
 
auto map_position (AbsolutePosition position) const -> AbsolutePosition
 Map a provided position into the new coordinate space.
 
auto operator== (ReflowResult const &) const -> bool=default
 

Friends

constexpr friend auto tag_invoke (di::Tag< di::reflect >, di::InPlaceType< ReflowResult >)
 

Detailed Description

Represents the result of reflowing a RowGroup.

Reflow is the process of adjusting the text in a row group to fit into a different number of columns. This process can add or remove rows to a row group, as well as change the column offset of text within a row which was reflowed.

The reflow result describes how to map a absolute position from before the reflow operation to the correct coordinates after the reflow. This result is described in terms of delta's which apply to a certain range of coordinates. This means that looking up the offset to apply to a given position can be done using a binary search. Only the start of each range is recorded in the result, so the end of the range is implied by the start of the next range.

Member Function Documentation

◆ add_offset()

void ttx::terminal::ReflowResult::add_offset ( AbsolutePosition position,
i64 dr,
i32 dc,
bool absolute_column = false )

Add an offset for the given position to map to new coordinates.

Warning
The offsets must be provided sequentially with respect to the provied position. This is asserted by the implementation.

◆ map_position()

auto ttx::terminal::ReflowResult::map_position ( AbsolutePosition position) const -> AbsolutePosition

Map a provided position into the new coordinate space.

◆ merge()

void ttx::terminal::ReflowResult::merge ( ReflowResult && other)

Merge another reflow result with this one.

Warning
The provided ReflowResult must not overlap with this one. This is intended to be used with ReflowResult's generated by separate row groups in the same screen.

◆ operator==()

auto ttx::terminal::ReflowResult::operator== ( ReflowResult const & ) const -> bool=default
default

Friends And Related Symbol Documentation

◆ tag_invoke

friend auto tag_invoke ( di::Tag< di::reflect > ,
di::InPlaceType< ReflowResult >  )
friend

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