5#include <portals/line_edit.hpp>
9namespace portals::detail {
14constexpr bool hasLineSeparator(std::string_view bytes)
noexcept {
15 return bytes.find_first_of(
"\r\n") != std::string_view::npos || bytes.contains(
"\xe2\x80\xa8") ||
16 bytes.contains(
"\xe2\x80\xa9");
32inline std::expected<LineEditPlaceholder, TextError> prepareLineEditPlaceholder(LineEditOptions &options) {
33 if (!options.placeholder || options.placeholder->empty()) {
34 options.placeholder.reset();
41 return std::unexpected(
text.error());
44 auto prepared = std::make_unique<GraphemeText>(std::move(*
text));
45 options.placeholder.reset();
static std::expected< GraphemeText, TextError > from(std::string_view bytes, WidthPolicy policy={}, TextLimits limits={})
Validate, segment and measure a single logical UTF-8 buffer.
LineEditDisplayMode
Immutable presentation and outbound clipboard policy; plaintext model/history remain application-owne...
Definition line_edit.hpp:34
@ NORMAL
Render the draft using its actual grapheme widths; copying and cutting retain normal behavior.
Definition line_edit.hpp:35
@ NO_ECHO
Render no value or selection, with a fixed-origin caret and intrinsic width one; suppress copy/cut.
Definition line_edit.hpp:37
@ PASSWORD
Render one ASCII '*' per grapheme, revealing its count; suppress outbound copy/cut.
Definition line_edit.hpp:36
ui::ValueText text(std::format_string< const ui::detail::TextArgumentValue< Args > &... > pattern, Args &&...args)
Declare live formatted text over explicit scalar roots, fields or value properties.
Definition ui_value_text.hpp:567
Already checked owning placeholder transferred by declarative construction before state publication.
Definition line_edit.hpp:193