Skip to main content

felis_render_core/
overlay.rs

1//! Frame overlays the client composes over the grid: IME pre-edit,
2//! scrollback search, and the bottom-row bars.
3
4/// Uncommitted IME composition text painted at 0-based `anchor` `(row, col)`.
5///
6/// Stops at the row's right edge without wrapping. `cursor` is the active-segment
7/// byte range reported by winit.
8#[derive(Debug, Clone)]
9pub struct PreeditOverlay {
10    pub anchor: (u16, u16),
11    pub text: String,
12    pub cursor: Option<(usize, usize)>,
13}
14
15/// Scrollback-search overlay with hit highlights and a bottom-row status bar.
16///
17/// The bar occludes the bottom row's cells. Re-derived on redraw and painted
18/// until the renderer's `set_search_overlay` passes `None`.
19#[derive(Debug, Clone, Default)]
20pub struct SearchOverlay {
21    /// Empty suppresses the bar; highlights still paint.
22    pub label: String,
23    /// One entry per `col_span` of a `SearchToClientMsg::Match`, already mapped
24    /// through the viewport by the caller. The renderer clips
25    /// out-of-range rows / cols so a viewport edit racing the paint
26    /// cannot panic.
27    pub visible_hits: Vec<SearchHitSpan>,
28}
29
30#[derive(Debug, Clone, Copy, PartialEq, Eq)]
31pub struct SearchHitSpan {
32    /// Composed-view row (0 = top of visible screen; `rows - 1` = bottom).
33    pub row: u16,
34    /// Inclusive column range start.
35    pub col_start: u16,
36    /// Exclusive column range end.
37    pub col_end: u16,
38    /// The renderer does not enforce uniqueness.
39    pub is_current: bool,
40}
41
42/// Same chrome surface as the search bar (the caller reserves the
43/// bottom row identically), with
44/// [`CONFIRM_BAR_BG`](crate::palette::CONFIRM_BAR_BG) so a destructive
45/// prompt never reads as a search.
46#[derive(Debug, Clone, Default)]
47pub struct ConfirmOverlay {
48    pub label: String,
49}
50
51/// The Ctrl-hover OSC 8 activation preview (`docs/explanation/security-model.md`
52/// "OSC 8 hyperlinks and OSC 7 CWD"): `text` is already
53/// `ActivationTarget::preview`'s output, so it carries no control or
54/// bidi codepoint by construction.
55#[derive(Debug, Clone, Default)]
56pub struct LinkPreviewOverlay {
57    pub text: String,
58}