Mail · a focused star keeps Space and Enter; so does Unpin
A button in a SelectableList row now stops Space and Enter at its box on key down, so the list no longer toggles its selection before the button acts. The mail star and the pinned messages' Unpin, which had the same fault, both do.
This commit is contained in:
1 parent
7d20567921
commit
d2379bc911
5 files changed
+38
-1
No files matched your search
@@ -166,6 +166,14 @@ impl MailItem {
|
||||
window.prevent_default();
|
||||
cx.stop_propagation();
|
||||
})
|
||||
.on_key_down(|event, _, cx| {
|
||||
let key = event.keystroke.key.as_str();
|
||||
if matches!(key, "space" | "enter")
|
||||
&& !event.keystroke.modifiers.modified()
|
||||
{
|
||||
cx.stop_propagation();
|
||||
}
|
||||
})
|
||||
.on_click(move |_, window, cx| {
|
||||
log::info!("mail {key}: star {}", !starred);
|
||||
set(!starred, window, cx)
|
||||
|
||||
@@ -187,6 +187,16 @@ fn a_star_toggles_and_leaves_the_selection(cx: &mut TestAppContext) {
|
||||
assert_eq!(heard(&host, cx), ["star m3 false"]);
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
fn space_on_a_star_stars_and_leaves_the_selection(cx: &mut TestAppContext) {
|
||||
let (host, cx) = mailing(mails, cx);
|
||||
tab_to(2, cx);
|
||||
press("space", cx);
|
||||
tab_to(2, cx);
|
||||
press("enter", cx);
|
||||
assert_eq!(heard(&host, cx), ["star m1 true", "star m1 true"]);
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
fn no_mail_says_so_and_takes_no_tab_stop(cx: &mut TestAppContext) {
|
||||
let (_, cx) = mailing(
|
||||
|
||||
Reference in new issue
Block a user