1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! Presentation-only shortcut labels for palette rows.
//!
//! Shortcuts are intentionally separate from [`ActionSpec`](ratatui_action::spec::ActionSpec).
//! Applications often have context-specific keymaps, and the same action can
//! have different bindings in different screens. Keep those bindings in the
//! application or keymap layer, then pass display labels into the palette view.
//!
//! Use [`ShortcutLabels::insert`] to attach presentation-only labels and
//! [`PaletteState::view_with_shortcuts`](crate::state::PaletteState::view_with_shortcuts) to put
//! them in a renderable view.
use BTreeMap;
use ActionId;
/// Display labels for action shortcuts.
///
/// [`ShortcutLabels`] is a small presentation map. It does not parse key events,
/// own keybinding precedence, or decide whether a keybinding is active.
///
/// Use [`new`](Self::new) to create a map, [`insert`](Self::insert) to add or replace labels,
/// [`get`](Self::get) to read them, and [`is_empty`](Self::is_empty) for optional display logic.