fix(cli-rs): choose a select row on the left button's release only

Releasing a right-click over a DialogSelect row chose it (ms3-ms4
carbon review note).
This commit is contained in:
Simon Klee
2026-11-05 01:19:51 +01:00
Unverified
parent 165541e854
commit 8e750b59a4
2 changed files with 8 additions and 1 deletions
+1 -1
View File
@@ -1273,7 +1273,7 @@ impl<T: Clone + PartialEq + 'static> Select<T> {
let app = select.0.cx.app.clone();
app.defer(move |_cx| select.move_index(index, false, true));
}
MouseEventKind::Up(_) => {
MouseEventKind::Up(MouseButton::Left) => {
let Some(index) = index else { return };
let option = {
let state = select.0.state.borrow();
@@ -652,6 +652,13 @@ fn clicks_select_rows_and_the_backdrop_closes_the_dialog() {
let row = (0..30u16)
.find(|&y| screen.row(y as u32).contains("Claude Opus"))
.unwrap();
// A right button's release over a row does not choose it.
kit.app
.mouse(MouseEventKind::Down(MouseButton::Right), 20, row);
kit.app
.mouse(MouseEventKind::Up(MouseButton::Right), 20, row);
kit.app.advance(Duration::from_millis(1));
assert!(chosen.borrow().is_empty(), "{:?}", chosen.borrow());
kit.app.click(20, row);
assert_eq!(*chosen.borrow(), ["opus"]);
assert!(kit.dialogs.is_open());