ttx 0.1.0
Loading...
Searching...
No Matches
cursor.h
Go to the documentation of this file.
1#pragma once
2
3#include "di/reflect/prelude.h"
4#include "di/types/prelude.h"
5
6namespace ttx::terminal {
8struct Cursor {
9 u32 row { 0 };
10 u32 col { 0 };
11 usize text_offset { 0 };
12 bool overflow_pending { false };
13
14 auto operator==(Cursor const&) const -> bool = default;
15 auto operator<=>(Cursor const&) const = default;
16
17 constexpr friend auto tag_invoke(di::Tag<di::reflect>, di::InPlaceType<Cursor>) {
18 return di::make_fields<"Cursor">(di::field<"row", &Cursor::row>, di::field<"col", &Cursor::col>,
19 di::field<"text_offset", &Cursor::text_offset>,
20 di::field<"overflow_pending", &Cursor::overflow_pending>);
21 }
22};
23}
Definition capability.h:8
Represents the current cursor position of the terminal.
Definition cursor.h:8
auto operator<=>(Cursor const &) const =default
bool overflow_pending
Signals that the previous text outputted reached the end of a row.
Definition cursor.h:12
constexpr friend auto tag_invoke(di::Tag< di::reflect >, di::InPlaceType< Cursor >)
Definition cursor.h:17
u32 col
Column (x coordinate)
Definition cursor.h:10
usize text_offset
Cached text offset of the cell pointed to by the cursor.
Definition cursor.h:11
auto operator==(Cursor const &) const -> bool=default
u32 row
Row (y coordinate)
Definition cursor.h:9