diff --git a/src/tui/tests/snapshots.rs b/src/tui/tests/snapshots.rs index 0bc3dd5..3220624 100644 --- a/src/tui/tests/snapshots.rs +++ b/src/tui/tests/snapshots.rs @@ -51,7 +51,9 @@ fn orphan_dependency_confirmation_renders_simple_list() { !screen.contains("needs these libraries anymore"), "{screen}" ); + assert!(screen.contains("Remove unused dependencies"), "{screen}"); assert!(screen.contains('•'), "{screen}"); + assert!(screen.contains("[Esc] cancel"), "{screen}"); assert!( screen.contains("sodium-fabric-0.9.1+mc26.2.jar"), "{screen}" diff --git a/src/tui/tests/snapshots/rmcl__tui__tests__snapshots__instance_delete_confirmation_renders_the_complete_frame.snap b/src/tui/tests/snapshots/rmcl__tui__tests__snapshots__instance_delete_confirmation_renders_the_complete_frame.snap index 9191119..bf31793 100644 --- a/src/tui/tests/snapshots/rmcl__tui__tests__snapshots__instance_delete_confirmation_renders_the_complete_frame.snap +++ b/src/tui/tests/snapshots/rmcl__tui__tests__snapshots__instance_delete_confirmation_renders_the_complete_frame.snap @@ -18,7 +18,7 @@ expression: ui.screen() "│ ││ │" "│ ││ ╭ Delete 'Snapshot Instance' ─────────────╮ │" "│ ││ │This will permanently remove the instance│ │" -"│ ││ ╰──────────────────────────[Enter] confirm╯ │" +"│ ││ ╰────────────[Esc] cancel [Enter] confirm╯ │" "│ ││ │" "│ ││ │" "│ ││ │" diff --git a/src/tui/widgets/popups/confirm.rs b/src/tui/widgets/popups/confirm.rs index 1370fb9..bf08241 100644 --- a/src/tui/widgets/popups/confirm.rs +++ b/src/tui/widgets/popups/confirm.rs @@ -47,7 +47,7 @@ pub enum ConfirmTarget { impl ConfirmTarget { fn title(&self) -> String { match self { - Self::OrphanDependencies { .. } => " Remove unused libraries ".to_owned(), + Self::OrphanDependencies { .. } => " Remove unused dependencies ".to_owned(), _ => format!(" Delete '{}' ", self.name()), } } @@ -63,7 +63,7 @@ impl ConfirmTarget { } ConfirmTarget::Content { dependents, .. } if !dependents.is_empty() => { format!( - "Still required by installed mods:\n{}\n! Deleting this library may break those mods.", + "Still required by installed mods:\n{}\n! Deleting this dependency may break those mods.", dependents .iter() .map(|name| format!("• {name}")) @@ -81,7 +81,7 @@ impl ConfirmTarget { "• {}", path.file_name() .and_then(|name| name.to_str()) - .unwrap_or("library") + .unwrap_or("dependency") ) }) .collect::>() @@ -95,7 +95,7 @@ impl ConfirmTarget { ConfirmTarget::Account { username, .. } => username, ConfirmTarget::ConfigProfile { profile } => profile, ConfirmTarget::Content { name, .. } => name, - ConfirmTarget::OrphanDependencies { .. } => "unused libraries", + ConfirmTarget::OrphanDependencies { .. } => "unused dependencies", } } @@ -192,7 +192,7 @@ impl Widget for ConfirmPopup { .fg(theme.accent()) .add_modifier(Modifier::BOLD), )]); - let kb = keybind_line(&[("Enter", self.confirm_label)]); + let kb = keybind_line(&[("Esc", " cancel"), ("Enter", self.confirm_label)]); let border_color = theme.text_dim(); let bg_color = theme.surface(); @@ -243,8 +243,9 @@ pub fn confirm_popup_area(frame_area: Rect, target: &ConfirmTarget) -> Rect { const MAX_W: usize = 48; let body = target.body(); let title_w = Span::raw(target.name()).width() + 12; + let footer_w = Span::raw(format!("[Esc] cancel [Enter]{}", target.confirm_label())).width(); let (body_w, _) = word_wrap_size(&body, MAX_W); - let inner_w = title_w.max(body_w).min(MAX_W); + let inner_w = title_w.max(body_w).max(footer_w).min(MAX_W); let (_, lines) = word_wrap_size(&body, inner_w); let popup_w = ((inner_w + 2) as u16).min(frame_area.width.saturating_sub(4)); let popup_h = ((lines + 2) as u16).min(frame_area.height.saturating_sub(4));