From 38f88906df77fa2dfda75c0dd3c8193222276243 Mon Sep 17 00:00:00 2001 From: Kyosuke Fujimoto Date: Sat, 10 Aug 2024 10:23:51 +0900 Subject: [PATCH] Organize the order of UserEvent --- assets/default-keybind.toml | 25 +++++++++++++------------ src/event.rs | 28 ++++++++++++++-------------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/assets/default-keybind.toml b/assets/default-keybind.toml index 979c4cc..f382b87 100644 --- a/assets/default-keybind.toml +++ b/assets/default-keybind.toml @@ -1,31 +1,32 @@ force_quit = ["ctrl-c"] quit = ["q"] +help_toggle = ["?"] +# close widget or cancel progress but not quit app +close_or_cancel = ["esc"] + navigate_up = ["k", "up"] navigate_down = ["j", "down"] navigate_right = ["l", "right"] navigate_left = ["h", "left"] -# close widget or cancel progress but not quit app -close_or_cancel = ["esc"] -help_toggle = ["?"] go_to_top = ["g"] -go_to_bottom = ["shift-G"] -go_to_next = ["n"] -go_to_previous = ["shift-N"] +go_to_bottom = ["shift-g"] scroll_down = ["ctrl-e"] scroll_up = ["ctrl-y"] page_up = ["ctrl-b"] page_down = ["ctrl-f"] half_page_up = ["ctrl-u"] half_page_down = ["ctrl-d"] -select_top = ["shift-H"] -select_middle = ["shift-M"] -select_bottom = ["shift-L"] +select_top = ["shift-h"] +select_middle = ["shift-m"] +select_bottom = ["shift-l"] + +go_to_next = ["n"] +go_to_previous = ["shift-n"] confirm = ["enter"] +ref_list_toggle = ["tab"] search = ["/"] # copy part of information, ex: copy the short commit hash not all short_copy = ["c"] -full_copy = ["shift-C"] - -ref_list_toggle = ["tab"] +full_copy = ["shift-c"] diff --git a/src/event.rs b/src/event.rs index 00942a8..93805e5 100644 --- a/src/event.rs +++ b/src/event.rs @@ -87,6 +87,14 @@ pub fn init() -> (Sender, Receiver) { #[serde(rename_all = "snake_case")] pub enum UserEvent { // NOTE User Event should have document, else the enum item will be hidden in the help page + /// Force Quit app without passing input into widges or views + ForceQuit, + /// Quit app + Quit, + /// Toggle Help page + HelpToggle, + /// Close widget or cancel current progress + CloseOrCancel, /// Navigate up NavigateUp, /// Navigate down @@ -95,22 +103,10 @@ pub enum UserEvent { NavigateRight, /// Navigate left NavigateLeft, - /// Force Quit serie without passing input into widges or views - ForceQuit, - /// Quit serie - Quit, - /// Close widget or cancel current progress - CloseOrCancel, - /// Toggle Help page - HelpToggle, /// Go to top GoToTop, /// Go to bottom GoToBottom, - /// Go to next item - GoToNext, - /// Go to previous item - GoToPrevious, /// Scroll one line up ScrollUp, /// Scroll one line down @@ -129,15 +125,19 @@ pub enum UserEvent { SelectMiddle, /// Select bottom part SelectBottom, + /// Go to next item + GoToNext, + /// Go to previous item + GoToPrevious, /// Confirm Confirm, + /// Toggle for Reference List + RefListToggle, /// Search Search, /// Copy part of content ShortCopy, /// Copy FullCopy, - /// Toggle for Reference List - RefListToggle, Unknown, }