Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion src/apps/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@ impl Default for App {
}

impl App {
/// Render the application UI and manage terminal cursor visibility and position for SSID/password popups.
///
/// When an SSID or password popup is visible, this sets the terminal cursor to the popup's input position
/// and enables cursor blinking; otherwise it hides the cursor and disables blinking.
///
/// # Examples
///
/// ```no_run
/// // Assuming `app` is an initialized `App` and `frame` is a mutable `ratatui::Frame`:
/// // app.draw(&mut frame);
/// ```
fn draw(&self, frame: &mut Frame) {
frame.render_widget(self, frame.area());

Expand All @@ -83,6 +94,15 @@ impl App {
}
}

/// Mark the application to exit by setting its internal exit flag.
///
/// # Examples
///
/// ```
/// let mut app = App::default();
/// app.exit();
/// assert!(app.app_state.exit);
/// ```
fn exit(&mut self) {
self.app_state.exit = true;
}
Expand Down Expand Up @@ -157,4 +177,4 @@ impl App {
fn reset_selection(&mut self) {
self.selected = 0;
}
}
}
11 changes: 5 additions & 6 deletions src/apps/core/widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ const HELP_TEXT: [&str; 12] = [
];

impl Widget for &App {
/// Render the application's terminal UI into the provided drawing area buffer.
/// Render the application's terminal UI into the provided drawing area.
///
/// This draws the main network table and, depending on internal flags and state,
/// overlays the saved-connections list, help menu, delete-confirmation popup,
/// hidden-SSID input popup, password input popup, and status popup. Cursor
/// visibility and blinking are adjusted as needed for input popups.
/// Draws the main network table and, depending on the app's flags and state,
/// conditionally overlays the saved-connections list, help menu, delete-confirmation
/// popup, hidden-SSID input popup, password input popup, and status popup.
///
/// # Examples
///
Expand Down Expand Up @@ -279,4 +278,4 @@ impl Widget for &App {
status_paragraph.render(status_area, buf);
}
}
}
}