mirror of
https://github.com/forkless/NotAlterra.git
synced 2026-08-20 10:03:35 +02:00
pre-fill save folder dialog with current path
This commit is contained in:
@@ -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
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user