pre-fill save folder dialog with current path

This commit is contained in:
2026-06-09 18:16:06 +02:00
parent e7a92b45e2
commit aed22a80b1
3 changed files with 20 additions and 4 deletions
+5
View File
@@ -373,8 +373,13 @@ fn run_disclaimer<B: Backend>(terminal: &mut Terminal<B>, app: &mut App) -> Resu
/// Open the input dialog for the user to type a save-folder path.
/// Validates the path exists and contains .sav files before accepting it.
fn action_set_save_folder<B: Backend>(terminal: &mut Terminal<B>, app: &mut App) -> Result<()> {
let default = app.save_folder.as_ref().map(|p| p.to_string_lossy().to_string());
let mut input_state =
tui::InputDialogState::new("Enter the path to your Subnautica 2 SaveGames folder:");
if let Some(d) = default {
input_state.input = d;
input_state.cursor = input_state.input.len();
}
let mut ok_selected = true;
loop {
+14 -3
View File
@@ -819,10 +819,17 @@ fn draw_select_list_with_info(
// If pinned_header is set, items[0] (header) and items[1] (blank spacer)
// render as fixed rows above the scrollable list. items[2..] form the list.
let (list_start_y, list_items_slice): (u16, &[&str]) = if pinned_header && !items.is_empty() {
let header_style = Style::default().fg(Color::Cyan).add_modifier(Modifier::BOLD);
let header_style = Style::default()
.fg(Color::Cyan)
.add_modifier(Modifier::BOLD);
f.render_widget(
Paragraph::new(Span::styled(items[0], header_style)),
Rect { x: area.x, y: area.y, width: area.width, height: 1 },
Rect {
x: area.x,
y: area.y,
width: area.width,
height: 1,
},
);
// Leave items[1] (blank spacer) as visual gap — rendered as empty row
(area.y + 2, &items[2..])
@@ -839,7 +846,11 @@ fn draw_select_list_with_info(
// Offset: when pinned_header is true, the list widget only sees
// items[2..], but state.selected() is absolute to the full items array.
// Adjust the state so the list widget highlights the correct entry.
let header_offset = if pinned_header && !items.is_empty() { 2u16 } else { 0u16 };
let header_offset = if pinned_header && !items.is_empty() {
2u16
} else {
0u16
};
let orig_selected = state.selected();
if header_offset > 0 {
if let Some(s) = orig_selected {