Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
43 changes: 42 additions & 1 deletion crates/rabbit-ui-wxdragon/src/wx_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(&current_step);
let start_install = Rc::new(move || {
current_step.store(PROGRESS_STEP, Ordering::SeqCst);
update_navigation(
PROGRESS_STEP,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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<AtomicUsize>,
start_install: Rc<dyn Fn()>,
) {
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
Expand Down
Loading