Skip to content

Commit 0eaffc7

Browse files
committed
fix: highlight device login copy action
1 parent 7954d02 commit 0eaffc7

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

src/cortex-tui/src/modal/login.rs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ impl Modal for LoginModal {
193193
match &self.state {
194194
LoginState::Pending | LoginState::Polling => {
195195
vec![
196-
("Enter/c", "copy code"),
196+
("Enter", "copy code"),
197+
("c", "copy code"),
197198
("o", "open browser"),
198199
("Esc", "cancel"),
199200
]
@@ -257,7 +258,8 @@ impl LoginModal {
257258

258259
// Action bar
259260
let bar = ActionBar::new()
260-
.hint("Enter/c", "copy code")
261+
.action('c', "Copy code")
262+
.hint("Enter", "copy")
261263
.hint("o", "open browser")
262264
.hint("Esc", "cancel");
263265
bar.render(chunks[8], buf);
@@ -381,6 +383,21 @@ mod tests {
381383
assert!(matches!(modal2.state, LoginState::Failed(_)));
382384
}
383385

386+
#[test]
387+
fn test_pending_key_hints_split_copy_keys() {
388+
let modal = LoginModal::new(
389+
"https://example.com".to_string(),
390+
"CODE123".to_string(),
391+
600,
392+
);
393+
394+
let hints = modal.key_hints();
395+
396+
assert!(hints.contains(&("Enter", "copy code")));
397+
assert!(hints.contains(&("c", "copy code")));
398+
assert!(!hints.iter().any(|(key, _)| *key == "Enter/c"));
399+
}
400+
384401
#[test]
385402
fn test_key_handling_pending() {
386403
let mut modal = LoginModal::new("url".to_string(), "CODE".to_string(), 300);

0 commit comments

Comments
 (0)