Skip to content

Commit e0066aa

Browse files
authored
fix: extend selection dismiss workaround to Firefox-based browsers (#125)
- Support Firefox and Floorp in should_dismiss_selection_if_needed - Use const for the dismiss app list to avoid per-call reallocation - Update comment in main.rs to say "Firefox-based browsers"
1 parent 1fc0ea0 commit e0066aa

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/input.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,8 @@ impl InputState {
364364
}
365365

366366
pub fn should_dismiss_selection_if_needed(&self) -> bool {
367-
return self.active_app.contains("Firefox");
367+
const DISMISS_APPS: [&str; 2] = ["Firefox", "Floorp"];
368+
return DISMISS_APPS.iter().any(|app| self.active_app.contains(app));
368369
}
369370

370371
pub fn get_backspace_count(&self, is_delete: bool) -> usize {

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ fn do_transform_keys(handle: Handle, is_delete: bool) -> bool {
3131
if let Ok((output, transform_result)) = INPUT_STATE.transform_keys() {
3232
debug!("Transformed: {:?}", output);
3333
if INPUT_STATE.should_send_keyboard_event(&output) || is_delete {
34-
// This is a workaround for Firefox, where macOS's Accessibility API cannot work.
34+
// This is a workaround for Firefox-based browsers, where macOS's Accessibility API cannot work.
3535
// We cannot get the selected text in the address bar, so we will go with another
3636
// hacky way: Always send a space and delete it immediately. This will dismiss the
3737
// current pre-selected URL and fix the double character issue.

0 commit comments

Comments
 (0)