Skip to content

Commit

Permalink
Organize the order of UserEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
lusingander committed Aug 10, 2024
1 parent 24670ad commit 38f8890
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 26 deletions.
25 changes: 13 additions & 12 deletions assets/default-keybind.toml
Original file line number Diff line number Diff line change
@@ -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"]
28 changes: 14 additions & 14 deletions src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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,
}

0 comments on commit 38f8890

Please sign in to comment.