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
62
63
64
65
66
/// All editing operations that the line editor can perform.
/// Serves as the contract between Keymap (key → action) and LineEditor (action → mutation).
#[derive(Clone, Copy, PartialEq, Debug)]
pub enum EditAction {
// Character input
InsertChar(char),
// Cursor movement
MoveBackward,
MoveForward,
MoveToStart,
MoveToEnd,
MoveBackwardWord,
MoveForwardWord,
// Delete (does NOT enter kill ring)
DeleteBackward,
DeleteForward,
// Kill (enters kill ring)
KillToEnd,
KillToStart,
KillBackwardWord,
KillForwardWord,
// Yank
Yank,
YankPop,
// Editing
TransposeChars,
TransposeWords,
UpcaseWord,
DowncaseWord,
CapitalizeWord,
// Undo
Undo,
// Other
ClearScreen,
Cancel,
AcceptSuggestion,
AcceptWordSuggestion,
SetNumericArg(u8),
// Control (maps to KeyAction for REPL loop)
Submit,
Eof,
Interrupt,
FuzzySearch,
TabComplete,
HistoryPrev,
HistoryNext,
Noop,
}
impl EditAction {
/// Returns true if this action is a kill operation (text goes to kill ring).
pub fn is_kill(&self) -> bool {
matches!(
self,
Self::KillToEnd | Self::KillToStart | Self::KillBackwardWord | Self::KillForwardWord
)
}
}