pub struct TuiApp { /* private fields */ }Expand description
Owns the TUI render state and input dispatcher.
Tracks the serial data pane, the configuration-menu open/closed
state, and a lightweight device summary shown on the top bar.
Input handling lives in TuiApp::handle_key, which routes
keyboard events through an internal CommandKeyParser whenever
the menu is closed.
Implementations§
Source§impl TuiApp
impl TuiApp
Sourcepub fn new(bus: EventBus) -> Self
pub fn new(bus: EventBus) -> Self
Construct a new TuiApp bound to the given event bus.
Starts with a 24x80 serial pane and a default SerialConfig;
the pane is resized to the terminal body on every call to
TuiApp::render, and the config is overwritten by
TuiApp::set_serial_config once the runner knows the real
link parameters.
Sourcepub fn set_wheel_scroll_lines(&mut self, n: u16)
pub fn set_wheel_scroll_lines(&mut self, n: u16)
Override the mouse-wheel scroll speed (lines per notch).
Values less than 1 are clamped to 1 so the wheel never turns into a no-op — a wheel event that moves nothing visibly suggests rtcom is broken even when the underlying config is “intentionally disabled”. Users who want to pin the view can simply not scroll.
Sourcepub fn set_cli_overrides(&mut self, fields: Vec<&'static str>)
pub fn set_cli_overrides(&mut self, fields: Vec<&'static str>)
Record which CLI flags overrode a profile value at startup.
Each element is a short, user-facing flag label (-b, -d,
--omap/--imap/--emap, …). The
crate::menu::SerialPortSetupDialog shows a “N field(s)
overridden by CLI” hint at the bottom when this list is
non-empty; empty disables the hint entirely.
Sourcepub fn push_toast(&mut self, message: impl Into<String>, level: ToastLevel)
pub fn push_toast(&mut self, message: impl Into<String>, level: ToastLevel)
Push a new toast onto the queue. Consumed by the runner’s bus-event handler for profile IO + error events.
Sourcepub const fn toasts_mut(&mut self) -> &mut ToastQueue
pub const fn toasts_mut(&mut self) -> &mut ToastQueue
Mutable access to the toast queue. Mainly used by tests and the main-loop tick to advance expiration.
Sourcepub const fn toasts(&self) -> &ToastQueue
pub const fn toasts(&self) -> &ToastQueue
Immutable borrow of the toast queue (read-only introspection).
Sourcepub const fn set_serial_config(&mut self, cfg: SerialConfig)
pub const fn set_serial_config(&mut self, cfg: SerialConfig)
Update the cached SerialConfig that new RootMenu pushes
pass down to sub-dialogs.
Call this whenever the live session’s config changes (T17 wires
this into Event::ConfigChanged).
Sourcepub const fn set_line_endings(&mut self, le: LineEndingConfig)
pub const fn set_line_endings(&mut self, le: LineEndingConfig)
Update the cached LineEndingConfig that new RootMenu
pushes pass down to the T13
crate::menu::LineEndingsDialog.
Call this whenever the live session’s mapper configuration
changes (T17 wires this into the ApplyLineEndingsLive path).
Sourcepub const fn set_modem_lines(&mut self, snapshot: ModemLineSnapshot)
pub const fn set_modem_lines(&mut self, snapshot: ModemLineSnapshot)
Update the cached ModemLineSnapshot that new RootMenu
pushes pass down to the T14
crate::menu::ModemControlDialog.
Call this whenever the live session’s modem output lines
change (T17 wires this into the SetDtr / SetRts paths).
Sourcepub const fn set_modal_style(&mut self, style: ModalStyle)
pub const fn set_modal_style(&mut self, style: ModalStyle)
Update the cached ModalStyle that new RootMenu pushes
pass down to the T15 crate::menu::ScreenOptionsDialog.
Call this whenever the live modal-style preference changes
(T17 wires this into the ApplyModalStyleLive / AndSave
paths).
Whether the configuration menu is currently open.
Sourcepub fn set_device_summary(
&mut self,
device_path: impl Into<String>,
config_summary: impl Into<String>,
)
pub fn set_device_summary( &mut self, device_path: impl Into<String>, config_summary: impl Into<String>, )
Update the device path + config summary shown on the top bar.
Accepts any type convertible to String so call sites can pass
either borrowed or owned strings.
Sourcepub fn set_config_summary(&mut self, config_summary: impl Into<String>)
pub fn set_config_summary(&mut self, config_summary: impl Into<String>)
Update just the config-summary portion of the top bar, leaving the device path untouched.
Used by the bus subscriber to refresh the status line after an
Event::ConfigChanged without having to know the device path.
Sourcepub const fn serial_pane_mut(&mut self) -> &mut SerialPane
pub const fn serial_pane_mut(&mut self) -> &mut SerialPane
Mutable access to the serial data pane.
Primarily used by the serial-reader subscriber to ingest incoming bytes; tests also use it to seed a known screen state.
Sourcepub fn handle_key(&mut self, key: KeyEvent) -> Dispatch
pub fn handle_key(&mut self, key: KeyEvent) -> Dispatch
Route a key event.
When the menu is closed, the event is converted to bytes via
crate::input::key_to_bytes and fed one byte at a time to
the internal CommandKeyParser:
ParseOutput::Databytes accumulate into aDispatch::TxBytespayload.Command::OpenMenuflipsmenu_open, pushes aRootMenuonto the modal stack, publishesEvent::MenuOpened, and returnsDispatch::OpenedMenu.Command::QuitreturnsDispatch::Quit.- Any other
Commandis published on the bus asEvent::Command; the dispatcher returnsDispatch::Noop(T17 refactors this into directSessionhandles).
When the menu is open, the event is handed to the topmost
crate::modal::Dialog on the ModalStack. The stack
auto-manages Close / Push outcomes; this function only
needs to detect the root dialog closing (stack becomes empty)
to publish Event::MenuClosed and flip menu_open back.
Action outcomes bubble up as Dispatch::Action for the
runner to apply.
Sourcepub fn handle_mouse(&mut self, ev: MouseEvent) -> Dispatch
pub fn handle_mouse(&mut self, ev: MouseEvent) -> Dispatch
Route a mouse event.
v0.2 handles only wheel scroll: MouseEventKind::ScrollUp and
MouseEventKind::ScrollDown move the serial pane’s scrollback
view by TuiApp::set_wheel_scroll_lines lines per notch.
Click / drag / move events are ignored until v0.2.1 lands
selection + copy. Menu-open mouse events are also ignored — the
menu is keyboard-only for now.
Sourcepub fn render(&mut self, f: &mut Frame<'_>)
pub fn render(&mut self, f: &mut Frame<'_>)
Render the main screen into f.
Layout: 1-row top bar (“rtcom {version} | {device} | {config}”),
body (serial pane rendered via tui_term), 1-row bottom bar
with command-key hints. The serial pane is resized to the body
size every frame so it follows terminal resizes.
When the configuration menu is open, the body is drawn according
to the current ModalStyle (set via
TuiApp::set_modal_style):
ModalStyle::Overlay: serial pane drawn normally; the modal dialog is painted over it at its preferred size.ModalStyle::DimmedOverlay: serial pane drawn normally, then every body cell hasModifier::DIMOR-ed into its style so the stream fades behind the modal. The modal is then painted on top at full brightness.ModalStyle::Fullscreen: the serial pane is not drawn at all; the modal fills the entire body area. The top/bottom chrome bars remain visible.
Auto Trait Implementations§
impl Freeze for TuiApp
impl !RefUnwindSafe for TuiApp
impl Send for TuiApp
impl !Sync for TuiApp
impl Unpin for TuiApp
impl UnsafeUnpin for TuiApp
impl !UnwindSafe for TuiApp
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more