From a89c7043358320f8adf92ac46e058964a889c2e2 Mon Sep 17 00:00:00 2001 From: Oleg Nikitin <91423563+AsriFox@users.noreply.github.com> Date: Mon, 3 Jun 2024 21:36:51 +0300 Subject: [PATCH] Added handling of KP_* keyvals --- anyrun/src/main.rs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/anyrun/src/main.rs b/anyrun/src/main.rs index fb9f62ec..22b4775d 100644 --- a/anyrun/src/main.rs +++ b/anyrun/src/main.rs @@ -484,7 +484,12 @@ fn activate(app: >k::Application, runtime_data: Rc>) { Inhibit(true) } // Handle selections - constants::Down | constants::Tab | constants::Up => { + constants::Down + | constants::Tab + | constants::Up + | constants::KP_Down + | constants::KP_Tab + | constants::KP_Up => { // Combine all of the matches into a `Vec` to allow for easier handling of the selection let combined_matches = runtime_data_clone .borrow() @@ -511,10 +516,13 @@ fn activate(app: >k::Application, runtime_data: Rc>) { // If nothing is selected select either the top or bottom match based on the input if !combined_matches.is_empty() { match event.keyval() { - constants::Down | constants::Tab => combined_matches[0] + constants::Down + | constants::Tab + | constants::KP_Down + | constants::KP_Tab => combined_matches[0] .1 .select_row(Some(&combined_matches[0].0)), - constants::Up => { + constants::Up | constants::KP_Up => { combined_matches[combined_matches.len() - 1].1.select_row( Some(&combined_matches[combined_matches.len() - 1].0), ) @@ -537,7 +545,7 @@ fn activate(app: >k::Application, runtime_data: Rc>) { // Move the selection based on the input, loops from top to bottom and vice versa match event.keyval() { - constants::Down | constants::Tab => { + constants::Down | constants::Tab | constants::KP_Down | constants::KP_Tab => { if index < combined_matches.len() - 1 { combined_matches[index + 1] .1 @@ -548,7 +556,7 @@ fn activate(app: >k::Application, runtime_data: Rc>) { .select_row(Some(&combined_matches[0].0)); } } - constants::Up => { + constants::Up | constants::KP_Up => { if index > 0 { combined_matches[index - 1] .1 @@ -565,7 +573,7 @@ fn activate(app: >k::Application, runtime_data: Rc>) { Inhibit(true) } // Handle when the selected match is "activated" - constants::Return => { + constants::Return | constants::KP_Enter => { let mut _runtime_data_clone = runtime_data_clone.borrow_mut(); let (selected_match, plugin_view) = match _runtime_data_clone