From 0eaffc738464909b5d8999722402c2ea1ee7e6cc Mon Sep 17 00:00:00 2001 From: SlaVKsVolks Date: Wed, 13 May 2026 13:59:20 -0300 Subject: [PATCH] fix: highlight device login copy action --- src/cortex-tui/src/modal/login.rs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/cortex-tui/src/modal/login.rs b/src/cortex-tui/src/modal/login.rs index 7a25ff8d7..95068d8ab 100644 --- a/src/cortex-tui/src/modal/login.rs +++ b/src/cortex-tui/src/modal/login.rs @@ -193,7 +193,8 @@ impl Modal for LoginModal { match &self.state { LoginState::Pending | LoginState::Polling => { vec![ - ("Enter/c", "copy code"), + ("Enter", "copy code"), + ("c", "copy code"), ("o", "open browser"), ("Esc", "cancel"), ] @@ -257,7 +258,8 @@ impl LoginModal { // Action bar let bar = ActionBar::new() - .hint("Enter/c", "copy code") + .action('c', "Copy code") + .hint("Enter", "copy") .hint("o", "open browser") .hint("Esc", "cancel"); bar.render(chunks[8], buf); @@ -381,6 +383,21 @@ mod tests { assert!(matches!(modal2.state, LoginState::Failed(_))); } + #[test] + fn test_pending_key_hints_split_copy_keys() { + let modal = LoginModal::new( + "https://example.com".to_string(), + "CODE123".to_string(), + 600, + ); + + let hints = modal.key_hints(); + + assert!(hints.contains(&("Enter", "copy code"))); + assert!(hints.contains(&("c", "copy code"))); + assert!(!hints.iter().any(|(key, _)| *key == "Enter/c")); + } + #[test] fn test_key_handling_pending() { let mut modal = LoginModal::new("url".to_string(), "CODE".to_string(), 300);