From 9f4af051952f22542d5ec99c5f42d5058ea92470 Mon Sep 17 00:00:00 2001 From: math65 Date: Fri, 25 Sep 2026 19:45:08 +0200 Subject: [PATCH] fix(ui): make Enter on the Review page start the install Install is the Review page's default button, so Enter is meant to start the install from anywhere on the page. But focus lands on the page's read-only multiline summary, and a multiline text box keeps Enter for itself (the NSTextView on macOS, DLGC_WANTALLKEYS on MSW), so the default button never saw the key: the same trap the Done page already works around with bind_done_page_enter_closes. The install click handler becomes a shared closure, called by the button and by an Enter handler on the summary. The handler only acts on the Review step and while Install is enabled, so Enter can't start anything the button would refuse. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 3 ++ crates/rabbit-ui-wxdragon/src/wx_app.rs | 43 ++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25bded1..62e8c1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -150,6 +150,9 @@ from this file and posts it as the GitHub release body. the ReaPack ones — still name it, since there it is the truth. (Reported by Scott Chesworth from Q&A.) +- **Enter** on the **Review** page now starts the install, as the default + **Install** button promises. Focus lands on the page's read-only summary, + and that text box kept the key for itself. - The package list on the **Packages** page could go missing entirely unless the window was maximized. The page had grown — the OSARA key-map note, then the Spanish-variant and REAPER-language dropdowns — until the diff --git a/crates/rabbit-ui-wxdragon/src/wx_app.rs b/crates/rabbit-ui-wxdragon/src/wx_app.rs index 1d13ee7..ee92ecc 100644 --- a/crates/rabbit-ui-wxdragon/src/wx_app.rs +++ b/crates/rabbit-ui-wxdragon/src/wx_app.rs @@ -2390,7 +2390,9 @@ pub fn run() { let last_reaper_app_path = Arc::clone(&last_reaper_app_path); let last_resource_path = Arc::clone(&last_resource_path); let install_run = Arc::clone(&install_run); - install.on_click(move |_| { + let review_text = widgets.review_text; + let review_step = Arc::clone(¤t_step); + let start_install = Rc::new(move || { current_step.store(PROGRESS_STEP, Ordering::SeqCst); update_navigation( PROGRESS_STEP, @@ -2861,6 +2863,11 @@ pub fn run() { })); }); }); + install.on_click({ + let start_install = Rc::clone(&start_install); + move |_| start_install() + }); + bind_review_enter_installs(&review_text, &install, &review_step, start_install); } let frame_for_close = frame; @@ -7148,6 +7155,40 @@ fn bind_reapack_ack_navigation_updates( }); } +/// Make Enter on the Review page's summary start the install, as the default +/// Install button would. +/// +/// The summary is a read-only multiline TextCtrl and holds focus on that +/// page, and a multiline text box eats Enter (the NSTextView on macOS, +/// DLGC_WANTALLKEYS on MSW) before the default button sees it: the same trap +/// `bind_done_page_enter_closes` works around on the Done page. Guarded on +/// the step and on Install being enabled, so Enter never starts anything the +/// button itself would refuse. +fn bind_review_enter_installs( + text: &TextCtrl, + install: &Button, + current_step: &Arc, + start_install: Rc, +) { + let install = *install; + let current_step = Arc::clone(current_step); + text.on_key_down(move |event| { + let key_code = if let WindowEventData::Keyboard(kbd) = &event { + kbd.get_key_code() + } else { + None + }; + if !matches!(key_code, Some(WXK_RETURN) | Some(WXK_NUMPAD_ENTER)) { + return; + } + if current_step.load(Ordering::SeqCst) != REVIEW_STEP || !install.is_enabled() { + return; + } + event.skip(false); + start_install(); + }); +} + /// A multiline `wxTextCtrl` claims Enter for itself (it reports /// `DLGC_WANTALLKEYS` on MSW and the NSTextView swallows the key on macOS), /// so the window's default button never sees it. The Done page deliberately