Document private action handlers and layout helpers

This commit is contained in:
2026-06-01 16:28:35 +02:00
parent d332c8931b
commit 1c01a36503
2 changed files with 11 additions and 0 deletions
+9
View File
@@ -286,6 +286,11 @@ fn run_disclaimer<B: Backend>(terminal: &mut Terminal<B>, app: &mut App) -> Resu
}
}
/// Scan the local filesystem for Subnautica 2 save folders.
///
/// Spawns a background thread for the scan and shows a live elapsed timer.
/// Caches the first match as `save_path` in config.ini.
// ── menu actions ───────────────────────────────────────────────────────────
fn action_locate_saves<B: Backend>(terminal: &mut Terminal<B>, app: &mut App) -> Result<()> {
@@ -387,6 +392,7 @@ fn action_locate_saves<B: Backend>(terminal: &mut Terminal<B>, app: &mut App) ->
Ok(())
}
/// Recover a .sav from its .bak backup with a rollback safety net.
fn action_recover_bak<B: Backend>(terminal: &mut Terminal<B>, app: &mut App) -> Result<()> {
let save_folder = ensure_save_folder(terminal, app)?;
@@ -588,6 +594,7 @@ fn action_recover_bak<B: Backend>(terminal: &mut Terminal<B>, app: &mut App) ->
Ok(())
}
/// Create a full backup of all savegame files into a timestamped folder.
fn action_create_backup<B: Backend>(terminal: &mut Terminal<B>, app: &mut App) -> Result<()> {
let save_folder = ensure_save_folder(terminal, app)?;
@@ -629,6 +636,7 @@ fn action_create_backup<B: Backend>(terminal: &mut Terminal<B>, app: &mut App) -
Ok(())
}
/// Restore a previously created full backup, overwriting the save folder.
fn action_restore_backup<B: Backend>(terminal: &mut Terminal<B>, app: &mut App) -> Result<()> {
let save_folder = ensure_save_folder(terminal, app)?;
let backup_root = app.backup_root();
@@ -890,6 +898,7 @@ fn ini_delete_action<B: Backend>(
// ── inspect saves ──────────────────────────────────────────────────────────
/// Inspect GVAS metadata for any .sav or .bak file from a file picker.
fn action_inspect_saves<B: Backend>(terminal: &mut Terminal<B>, app: &mut App) -> Result<()> {
let save_folder = ensure_save_folder(terminal, app)?;
let mut files: Vec<_> = std::fs::read_dir(&save_folder)
+2
View File
@@ -274,6 +274,7 @@ pub fn draw_ok_dialog_styled(f: &mut Frame, app: &AppState, title: &str, lines:
draw_whale_separator(f, bar, app);
}
/// Return a rectangle centered in `r` by the given width and height percentages.
fn centered_rect_size(w: u16, h: u16, r: Rect) -> Rect {
let popup = Layout::default().direction(Direction::Vertical)
.constraints([Constraint::Length((r.height.saturating_sub(h))/2), Constraint::Length(h), Constraint::Length((r.height.saturating_sub(h))/2)])
@@ -643,6 +644,7 @@ fn truncate_path_tail(path: &str, max_width: usize) -> String {
}
/// Create a centered rectangle for modal overlays.
/// Return a rectangle centered in `r` by the given width and height percentages.
fn centered_rect(percent_x: u16, percent_y: u16, r: Rect) -> Rect {
let popup_layout = Layout::default()
.direction(Direction::Vertical)