5#include <portals/document_encoding.hpp>
6#include <portals/document_hex.hpp>
7#include <portals/document_highlight_types.hpp>
8#include <portals/document_source.hpp>
9#include <portals/input.hpp>
10#include <portals/scroll_controls.hpp>
17struct DocumentViewState;
18struct DocumentViewAccess;
20enum class DocumentNavigation {
79 std::optional<DocumentError>
error;
105 FrameOptions frame = {}, std::optional<ScrollAreaOptions> scroll = {});
108 std::expected<CellSize, TreeError>
measureChildren(std::span<const MeasuredChild> children)
const override;
118 friend struct detail::DocumentViewAccess;
119 std::shared_ptr<detail::DocumentViewState> document_;
DocumentView(WidthPolicy width={}, DocumentViewConfig config={}, ControlStyle style={}, FrameOptions frame={}, std::optional< ScrollAreaOptions > scroll={})
bool styleReadOnly() const noexcept override
Definition document_view.hpp:113
~DocumentView() override
Release bounded UI ownership without joining background work.
std::expected< CellSize, TreeError > measureChildren(std::span< const MeasuredChild > children) const override
std::expected< void, TreeError > paint(PaintContext &context) override
Additive lifecycle owner over one existing Application subtree. UI affine and nonmovable....
Definition managed.hpp:530
Copyable typed observer; never owns or exposes an unchecked widget pointer.
Definition widget.hpp:92
Borrowed synchronous command sink supplied by the frame owner. submit must consume commands immediate...
Definition widget_types.hpp:66
Public Portals API.
Definition action.hpp:8
DocumentSyntaxPolicy
Recovery policy; the language still selects the lexical rules.
Definition document_highlight_types.hpp:31
@ AUTO
Preview immediately and refine within the automatic source-admission budget.
Definition document_highlight_types.hpp:32
@ TEXT
Text category without content.
Definition diagnostics.hpp:64
std::expected< void, ManagedError > setDocumentEncoding(ManagedScene &scene, Node< DocumentView > node, DocumentEncoding encoding)
DocumentSyntaxAccuracy
Accuracy of the syntax roles actually displayed, independently of recovery errors.
Definition document_highlight_types.hpp:38
@ NONE
Plain source text without syntax-role projection.
Definition document_highlight_types.hpp:39
DocumentViewMode
Projection of the same original source bytes.
Definition document_view.hpp:37
@ HEX
Project raw fixed-width byte rows without decoding.
Definition document_view.hpp:39
@ TEXT
Decode and lay out text using retained text settings.
Definition document_view.hpp:38
DocumentSyntaxState
Syntax projection state; text remains readable while context is prepared.
Definition document_highlight_types.hpp:19
@ DISABLED
Plain text selected; no lexical worker or cache is needed.
Definition document_highlight_types.hpp:20
DocumentLanguage
Explicit lexical profiles; unknown names resolve to PLAIN.
Definition document_highlight_types.hpp:11
@ PLAIN
Source bytes have the normal role.
Definition document_highlight_types.hpp:12
std::expected< void, ManagedError > setDocumentLineNumbers(ManagedScene &scene, Node< DocumentView > node, bool enabled)
std::expected< void, SourceError > seekDocumentByte(WidgetTree &tree, Node< DocumentView > node, std::uint64_t offset)
std::expected< void, SourceError > refreshDocument(WidgetTree &tree, Node< DocumentView > node)
std::expected< DocumentViewStatus, TreeError > documentViewStatus(WidgetTree &tree, Node< DocumentView > node)
std::expected< void, ManagedError > setDocumentWrap(ManagedScene &scene, Node< DocumentView > node, bool enabled)
DocumentEncoding
Resolved byte encoding, or an unresolved selection.
Definition document_encoding.hpp:14
@ UTF8
UTF-8.
Definition document_encoding.hpp:16
Encoding selection, malformed-input policy and per-call work bound.
Definition document_encoding.hpp:62
Fixed raw-byte rows; auto-fit may choose a smaller row at preparation time.
Definition document_view.hpp:43
bool operator==(const DocumentHexOptions &) const noexcept=default
bool uppercase
Uppercase hexadecimal digits.
Definition document_view.hpp:46
bool showAscii
Safe printable ASCII alongside byte values.
Definition document_view.hpp:47
std::size_t groupSize
Group separation, from 1 through MAX_HEX_ROW_BYTES.
Definition document_view.hpp:45
std::size_t bytesPerRow
Byte slots per row, from 1 through MAX_HEX_ROW_BYTES.
Definition document_view.hpp:44
bool autoFit
Fit up to bytesPerRow slots to the viewport; fixed by default.
Definition document_view.hpp:48
Exact document namespace and provider revision.
Definition document_source.hpp:24
Bounded text projection; these limits never restrict logical line length.
Definition document_view.hpp:53
std::size_t maxFrameBytes
Rendered payload cap, including escaped controls and cluster continuations.
Definition document_view.hpp:56
std::optional< DocumentFastScroll > fastScroll
Absent keeps modified scrolling disabled.
Definition document_view.hpp:62
std::size_t maxFrameCells
Maximum actual viewport area; larger views report PAGE_TOO_LARGE.
Definition document_view.hpp:55
std::uint8_t tailWorkTurns
Maximum quanta per managed seekable TEXT-tail job; 1 disables batching.
Definition document_view.hpp:67
std::size_t workBytes
Maximum source bytes admitted per preparation quantum.
Definition document_view.hpp:57
bool wrap
Wrap complete ordinary graphemes at the viewport edge.
Definition document_view.hpp:58
DocumentSyntaxPolicy syntax
Recovery policy; full-prefix work is explicit.
Definition document_view.hpp:65
std::size_t maxAutoHighlightBytes
Positive extra source-admission cap per AUTO viewport intent.
Definition document_view.hpp:66
DocumentLanguage language
Optional source highlighting; plain allocates no lexical cache.
Definition document_view.hpp:63
DocumentHexOptions hex
Raw-byte row options, used only by HEX.
Definition document_view.hpp:60
DocumentDecoderOptions decoder
UTF-8 hint; explicit encoding takes precedence.
Definition document_view.hpp:54
bool lineNumbers
Show proven logical line numbers in a fixed gutter.
Definition document_view.hpp:61
DocumentViewMode mode
Active projection; text settings remain retained in HEX.
Definition document_view.hpp:59
Owning scalar observation; no source I/O or preparation is performed by status commands.
Definition document_view.hpp:71
DocumentViewMode mode
Committed projection; HEX has no logical line counts.
Definition document_view.hpp:73
std::uint64_t byteOffset
Requested original byte anchor, preserved during reflow.
Definition document_view.hpp:74
bool waiting
Provider returned no bytes without definitive EOF; explicit refresh resumes it.
Definition document_view.hpp:83
bool anchorBeyondExtent
Requested anchor exceeds the last known extent; rendering projects available content.
Definition document_view.hpp:80
DocumentSyntaxAccuracy syntaxAccuracy
Accuracy of the displayed roles.
Definition document_view.hpp:89
DocumentRevision revision
Last worker-observed exact source revision.
Definition document_view.hpp:72
bool finalEnd
Latest worker reached definitive EOF.
Definition document_view.hpp:84
bool backpressured
Shared capacity is busy; source-budget capacity notification permits a bounded retry.
Definition document_view.hpp:81
bool fragmentedCluster
Grapheme continuation used when a cluster or bounded context cannot be proven locally.
Definition document_view.hpp:85
DocumentSyntaxPolicy syntax
Requested recovery policy.
Definition document_view.hpp:90
bool preparing
Bounded work remains for the latest intent.
Definition document_view.hpp:82
std::optional< std::uint64_t > highlightErrorOffset
Original byte offset of a lexical limitation, if reported.
Definition document_view.hpp:88
std::optional< std::uint64_t > totalLines
Proven final logical count, or unknown.
Definition document_view.hpp:78
DocumentLanguage language
Active lexical profile retained across HEX projection.
Definition document_view.hpp:86
std::optional< DocumentError > error
Latest preparation failure, if any.
Definition document_view.hpp:79
std::optional< std::uint64_t > byteExtent
Last observed exact extent, or unknown.
Definition document_view.hpp:76
std::optional< std::uint64_t > logicalLine
One-based proven line containing the anchor.
Definition document_view.hpp:77
std::uint64_t visibleByteOffset
Proven first rendered row/fragment byte, independent of the requested anchor.
Definition document_view.hpp:75
DocumentSyntaxState highlighting
Proven state of displayed syntax roles.
Definition document_view.hpp:87
Original error plus independent runner/restoration and cleanup failures.
Definition managed_diagnostics.hpp:62
Owning deterministic width policy; no font or terminal matching promise.
Definition text.hpp:42