diff options
| author | Richard Qin <richard.qin.x@gmail.com> | 2026-10-18 00:45:42 +0800 |
|---|---|---|
| committer | Richard Qin <richard.qin.x@gmail.com> | 2026-10-18 00:45:42 +0800 |
| commit | 795126a90d651ede075e9a94741dae4841e4de62 (patch) | |
| tree | 817f4642c54240f255191dd28124206833f6f561 /include/ricochet/tui/messages.hh | |
| parent | 6ac5c86e5d00e65f47a710e31f9c08b6a13f3bce (diff) | |
| download | rwebbrowser-795126a90d651ede075e9a94741dae4841e4de62.tar.gz rwebbrowser-795126a90d651ede075e9a94741dae4841e4de62.tar.xz | |
feat(tui): add structured selection text and clipboard messages
Diffstat (limited to 'include/ricochet/tui/messages.hh')
| -rw-r--r-- | include/ricochet/tui/messages.hh | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/include/ricochet/tui/messages.hh b/include/ricochet/tui/messages.hh index e7dc417..9d51fa3 100644 --- a/include/ricochet/tui/messages.hh +++ b/include/ricochet/tui/messages.hh @@ -139,12 +139,30 @@ struct ExitDecision std::optional<std::string> explanation {}; }; +enum class CopyStatus : std::uint8_t +{ + Confirmed, + Dispatched, + Unavailable, + Failed +}; + +// The host's injected clipboard provider completes a CopySelection request once. +// Dispatched must not be used as confirmation that a terminal accepted the text. +struct CopyResult +{ + RequestId request {}; + CopyStatus status { CopyStatus::Unavailable }; + std::string summary {}; +}; + using HostUpdate = std::variant<SyncTabs, NavigationStarted, CommitDocument, UpdateDocument, LocateView, FormFeedback, + CopyResult, ActionFailed, ExitDecision>; @@ -220,6 +238,16 @@ struct ExportSelection std::string text {}; }; +struct CopySelection +{ + RequestId request {}; + DocumentScope source {}; + DraftRevision draft_revision {}; + // Frozen before dispatch; later cursor/selection changes cannot change this copy. + // Password content is already masked. Clipboard providers never receive drafts. + std::string text {}; +}; + struct RequestExit { RequestId request {}; @@ -227,7 +255,14 @@ struct RequestExit std::vector<ViewSnapshot> views {}; }; -using UserAction - = std::variant<OpenLocation, OpenLink, Navigate, CreateTab, CloseTab, FormAction, ExportSelection, RequestExit>; +using UserAction = std::variant<OpenLocation, + OpenLink, + Navigate, + CreateTab, + CloseTab, + FormAction, + ExportSelection, + CopySelection, + RequestExit>; } // namespace ricochet::tui |
