7#include "../utility/utility.hpp"
8#include "../unicode/unicode.hpp"
9#include "../macros.hpp"
14hi_export_module(hikogui.text.text_cursor);
17hi_export
namespace hi::inline
v1 {
51 inplace_min(_value, max_value(size));
55 constexpr text_cursor resize(
size_t size) &&
noexcept
57 inplace_min(_value, max_value(size));
69 _value = (index << 1) | static_cast<size_t>(after);
84 [[nodiscard]]
constexpr text_cursor after_neighbor(
size_t size)
const noexcept
86 return before() ? neighbor(size) : *this;
89 [[nodiscard]]
constexpr text_cursor before_neighbor(
size_t size)
const noexcept
91 return after() ? neighbor(size) : *this;
94 [[nodiscard]]
constexpr bool start_of_text() const noexcept
99 [[nodiscard]]
constexpr bool end_of_text(
size_t size)
const noexcept
101 return _value >= max_value(size);
104 [[nodiscard]]
constexpr size_t index() const noexcept
109 [[nodiscard]]
constexpr bool after() const noexcept
111 return to_bool(_value & 1);
114 [[nodiscard]]
constexpr bool before() const noexcept
125 [[nodiscard]]
constexpr static size_t max_value(
size_t size)
noexcept
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
A cursor-position in text.
Definition text_cursor.hpp:26
constexpr text_cursor & resize(size_t size) &noexcept
Set the text size.
Definition text_cursor.hpp:49
constexpr text_cursor(size_t index, bool after) noexcept
Create a new text cursor.
Definition text_cursor.hpp:67
constexpr text_cursor neighbor(size_t size) const noexcept
Return the neighbor cursor.
Definition text_cursor.hpp:78