tui_dispatch_components/commands.rs
1//! Shared command names understood by built-in interactive components.
2//!
3//! These constants are plain `&'static str` values so they can be used anywhere
4//! command strings are accepted, including keybinding setup and tests.
5
6/// Move to the next item or line.
7pub const NEXT: &str = "next";
8/// Alias for [`NEXT`] used by directional widgets.
9pub const DOWN: &str = "down";
10/// Move to the previous item or line.
11pub const PREV: &str = "prev";
12/// Alias for [`PREV`] used by directional widgets.
13pub const UP: &str = "up";
14/// Move to the first item or top of content.
15pub const FIRST: &str = "first";
16/// Alias for [`FIRST`] used by home/end style keymaps.
17pub const HOME: &str = "home";
18/// Move to the last item or bottom of content.
19pub const LAST: &str = "last";
20/// Alias for [`LAST`] used by home/end style keymaps.
21pub const END: &str = "end";
22/// Move or collapse left in hierarchical widgets.
23pub const LEFT: &str = "left";
24/// Move or expand right in hierarchical widgets.
25pub const RIGHT: &str = "right";
26/// Toggle the current item.
27pub const TOGGLE: &str = "toggle";
28/// Select the current item.
29pub const SELECT: &str = "select";
30/// Confirm the current item.
31pub const CONFIRM: &str = "confirm";
32/// Move down by one page.
33pub const PAGE_DOWN: &str = "page_down";
34/// Move up by one page.
35pub const PAGE_UP: &str = "page_up";
36/// Submit the current value.
37pub const SUBMIT: &str = "submit";
38/// Cancel the current interaction.
39pub const CANCEL: &str = "cancel";
40
41/// Text input command names.
42pub mod text_input {
43 pub use super::{CANCEL, SUBMIT};
44
45 /// Move one character backward.
46 pub const MOVE_BACKWARD: &str = "move_backward";
47 /// Move one character forward.
48 pub const MOVE_FORWARD: &str = "move_forward";
49 /// Move one word backward.
50 pub const MOVE_WORD_BACKWARD: &str = "move_word_backward";
51 /// Move one word forward.
52 pub const MOVE_WORD_FORWARD: &str = "move_word_forward";
53 /// Move to the start of the input.
54 pub const MOVE_HOME: &str = "move_home";
55 /// Move to the end of the input.
56 pub const MOVE_END: &str = "move_end";
57 /// Delete one character before the cursor.
58 pub const DELETE_BACKWARD: &str = "delete_backward";
59 /// Delete one character at the cursor.
60 pub const DELETE_FORWARD: &str = "delete_forward";
61 /// Delete one word before the cursor.
62 pub const DELETE_WORD_BACKWARD: &str = "delete_word_backward";
63 /// Delete one word at the cursor.
64 pub const DELETE_WORD_FORWARD: &str = "delete_word_forward";
65
66 /// Directional alias for [`MOVE_BACKWARD`].
67 pub const MOVE_LEFT: &str = "move_left";
68 /// Directional alias for [`MOVE_FORWARD`].
69 pub const MOVE_RIGHT: &str = "move_right";
70 /// Directional alias for [`MOVE_WORD_BACKWARD`].
71 pub const MOVE_WORD_LEFT: &str = "move_word_left";
72 /// Directional alias for [`MOVE_WORD_FORWARD`].
73 pub const MOVE_WORD_RIGHT: &str = "move_word_right";
74 /// Directional alias for [`DELETE_BACKWARD`].
75 pub const DELETE_LEFT: &str = "delete_left";
76 /// Directional alias for [`DELETE_FORWARD`].
77 pub const DELETE_RIGHT: &str = "delete_right";
78 /// Directional alias for [`DELETE_WORD_BACKWARD`].
79 pub const DELETE_WORD_LEFT: &str = "delete_word_left";
80 /// Directional alias for [`DELETE_WORD_FORWARD`].
81 pub const DELETE_WORD_RIGHT: &str = "delete_word_right";
82}