refactor(config)!: make action names snake case in keybinding configuration (#40)

This commit is contained in:
Alexandre Pasmantier 2024-11-18 23:58:02 +01:00 committed by GitHub
parent 5807cda45d
commit 75d0bf7b6b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 49 additions and 19 deletions

View File

@ -41,46 +41,46 @@ theme = "Visual Studio Dark+"
# ------------------------ # ------------------------
[keybindings.Channel] [keybindings.Channel]
# Quit the application # Quit the application
Quit = "esc" quit = "esc"
# Scrolling through entries # Scrolling through entries
SelectNextEntry = "down" select_next_entry = "down"
SelectPrevEntry = "up" select_prev_entry = "up"
# Scrolling the preview pane # Scrolling the preview pane
ScrollPreviewHalfPageDown = "ctrl-d" scroll_preview_half_page_down = "ctrl-d"
ScrollPreviewHalfPageUp = "ctrl-u" scroll_preview_half_page_up = "ctrl-u"
# Select an entry # Select an entry
SelectEntry = "enter" select_entry = "enter"
# Copy the selected entry to the clipboard # Copy the selected entry to the clipboard
CopyEntryToClipboard = "ctrl-y" copy_entry_to_clipboard = "ctrl-y"
# Toggle the remote control mode # Toggle the remote control mode
ToggleRemoteControl = "ctrl-r" toggle_remote_control = "ctrl-r"
# Toggle the send to channel mode # Toggle the send to channel mode
ToggleSendToChannel = "ctrl-s" toggle_send_to_channel = "ctrl-s"
# Remote control mode # Remote control mode
# ------------------------------- # -------------------------------
[keybindings.RemoteControl] [keybindings.RemoteControl]
# Quit the application # Quit the application
Quit = "esc" quit = "esc"
# Scrolling through entries # Scrolling through entries
SelectNextEntry = "down" select_next_entry = "down"
SelectPrevEntry = "up" select_prev_entry = "up"
# Select an entry # Select an entry
SelectEntry = "enter" select_entry = "enter"
# Toggle the remote control mode # Toggle the remote control mode
ToggleRemoteControl = "ctrl-r" toggle_remote_control = "ctrl-r"
# Send to channel mode # Send to channel mode
# -------------------------------- # --------------------------------
[keybindings.SendToChannel] [keybindings.SendToChannel]
# Quit the application # Quit the application
Quit = "esc" quit = "esc"
# Scrolling through entries # Scrolling through entries
SelectNextEntry = "down" select_next_entry = "down"
SelectPrevEntry = "up" select_prev_entry = "up"
# Select an entry # Select an entry
SelectEntry = "enter" select_entry = "enter"
# Toggle the send to channel mode # Toggle the send to channel mode
ToggleSendToChannel = "ctrl-s" toggle_send_to_channel = "ctrl-s"

View File

@ -8,69 +8,99 @@ use strum::Display;
pub enum Action { pub enum Action {
// input actions // input actions
/// Add a character to the input buffer. /// Add a character to the input buffer.
#[serde(skip)]
AddInputChar(char), AddInputChar(char),
/// Delete the character before the cursor from the input buffer. /// Delete the character before the cursor from the input buffer.
#[serde(skip)]
DeletePrevChar, DeletePrevChar,
/// Delete the character after the cursor from the input buffer. /// Delete the character after the cursor from the input buffer.
#[serde(skip)]
DeleteNextChar, DeleteNextChar,
/// Move the cursor to the character before the current cursor position. /// Move the cursor to the character before the current cursor position.
#[serde(skip)]
GoToPrevChar, GoToPrevChar,
/// Move the cursor to the character after the current cursor position. /// Move the cursor to the character after the current cursor position.
#[serde(skip)]
GoToNextChar, GoToNextChar,
/// Move the cursor to the start of the input buffer. /// Move the cursor to the start of the input buffer.
#[serde(alias = "go_to_input_start")]
GoToInputStart, GoToInputStart,
/// Move the cursor to the end of the input buffer. /// Move the cursor to the end of the input buffer.
#[serde(alias = "go_to_input_end")]
GoToInputEnd, GoToInputEnd,
// rendering actions // rendering actions
/// Render the terminal user interface screen. /// Render the terminal user interface screen.
#[serde(skip)]
Render, Render,
/// Resize the terminal user interface screen to the given dimensions. /// Resize the terminal user interface screen to the given dimensions.
#[serde(skip)]
Resize(u16, u16), Resize(u16, u16),
/// Clear the terminal user interface screen. /// Clear the terminal user interface screen.
#[serde(skip)]
ClearScreen, ClearScreen,
// results actions // results actions
/// Select the entry currently under the cursor. /// Select the entry currently under the cursor.
#[serde(alias = "select_entry")]
SelectEntry, SelectEntry,
/// Select the entry currently under the cursor and pass the key that was pressed /// Select the entry currently under the cursor and pass the key that was pressed
/// through to be handled the parent process. /// through to be handled the parent process.
#[serde(alias = "select_passthrough")]
SelectPassthrough(String), SelectPassthrough(String),
/// Select the entry currently under the cursor and exit the application. /// Select the entry currently under the cursor and exit the application.
#[serde(alias = "select_and_exit")]
SelectAndExit, SelectAndExit,
/// Select the next entry in the currently focused list. /// Select the next entry in the currently focused list.
#[serde(alias = "select_next_entry")]
SelectNextEntry, SelectNextEntry,
/// Select the previous entry in the currently focused list. /// Select the previous entry in the currently focused list.
#[serde(alias = "select_prev_entry")]
SelectPrevEntry, SelectPrevEntry,
/// Copy the currently selected entry to the clipboard. /// Copy the currently selected entry to the clipboard.
#[serde(alias = "copy_entry_to_clipboard")]
CopyEntryToClipboard, CopyEntryToClipboard,
// preview actions // preview actions
/// Scroll the preview up by one line. /// Scroll the preview up by one line.
#[serde(alias = "scroll_preview_up")]
ScrollPreviewUp, ScrollPreviewUp,
/// Scroll the preview down by one line. /// Scroll the preview down by one line.
#[serde(alias = "scroll_preview_down")]
ScrollPreviewDown, ScrollPreviewDown,
/// Scroll the preview up by half a page. /// Scroll the preview up by half a page.
#[serde(alias = "scroll_preview_half_page_up")]
ScrollPreviewHalfPageUp, ScrollPreviewHalfPageUp,
/// Scroll the preview down by half a page. /// Scroll the preview down by half a page.
#[serde(alias = "scroll_preview_half_page_down")]
ScrollPreviewHalfPageDown, ScrollPreviewHalfPageDown,
/// Open the currently selected entry in the default application. /// Open the currently selected entry in the default application.
#[serde(skip)]
OpenEntry, OpenEntry,
// application actions // application actions
/// Tick the application state. /// Tick the application state.
#[serde(skip)]
Tick, Tick,
/// Suspend the application. /// Suspend the application.
#[serde(skip)]
Suspend, Suspend,
/// Resume the application. /// Resume the application.
#[serde(skip)]
Resume, Resume,
/// Quit the application. /// Quit the application.
#[serde(alias = "quit")]
Quit, Quit,
/// Toggle the help screen. /// Toggle the help screen.
#[serde(skip)]
Help, Help,
/// Signal an error with the given message. /// Signal an error with the given message.
#[serde(skip)]
Error(String), Error(String),
/// No operation. /// No operation.
#[serde(skip)]
NoOp, NoOp,
// channel actions // channel actions
/// Toggle the remote control channel. /// Toggle the remote control channel.
#[serde(alias = "toggle_remote_control")]
ToggleRemoteControl, ToggleRemoteControl,
/// Toggle the remote control in `send to channel` mode. /// Toggle the remote control in `send to channel` mode.
#[serde(alias = "toggle_send_to_channel")]
ToggleSendToChannel, ToggleSendToChannel,
} }