1#[derive(Debug, Clone)]
4pub enum Action {
5 Quit,
7 Resize(u16, u16),
8
9 FocusNext,
11 FocusPrevious,
12 FocusPanel(PanelType),
13 ToggleFullscreen,
14 SwitchLayout,
15
16 EnterWindowNavMode,
18 ExitWindowNavMode,
19 WindowNavMove(WindowDirection),
20
21 InsertChar(char),
23 DeleteChar,
24 MoveCursor(CursorDirection),
25 DeleteWord,
26 DeletePreviousWord,
27 DeleteToEnd,
28 DeleteToBeginning,
29 MoveToBeginning,
30 MoveToEnd,
31
32 SubmitCommand,
34 SubmitCommandWithText {
35 command: String,
36 }, HistoryUp,
38 HistoryDown,
39 HistoryPrevious, HistoryNext, EnterCommandMode,
42 ExitCommandMode, EnterInputMode,
44
45 CommandCursorUp,
47 CommandCursorDown,
48 CommandCursorLeft,
49 CommandCursorRight,
50 CommandHalfPageUp, CommandHalfPageDown, EnterScriptMode(String),
55 ExitScriptMode,
56 SubmitScript,
57 CancelScript,
58 InsertNewline,
59 InsertTab,
60
61 AddResponseWithStyle {
63 content: String,
64 styled_lines: Option<Vec<ratatui::text::Line<'static>>>,
65 response_type: ResponseType,
66 },
67 AddStyledWelcomeMessage {
68 styled_lines: Vec<ratatui::text::Line<'static>>,
69 response_type: ResponseType,
70 },
71 CommandCompleted,
72 CommandFailed(String),
73
74 SendRuntimeCommand(RuntimeCommand),
76 HandleRuntimeStatus(RuntimeStatus),
77 HandleTraceEvent(ghostscope_protocol::ParsedTraceEvent),
78
79 LoadSource {
81 path: String,
82 line: Option<usize>,
83 },
84 EnterFileSearch,
85 ExitFileSearch,
86 EnterTextSearch,
87 ExitTextSearch,
88 NavigateSource(SourceNavigation),
89 SourceSearchInput(char),
90 SourceSearchBackspace,
91 SourceSearchConfirm,
92 SourceFileSearchInput(char),
93 SourceFileSearchBackspace,
94 SourceFileSearchConfirm,
95 SourceNumberInput(char),
96 SourceGoToLine,
97 SourceGoToBottom,
98 SetTraceFromSourceLine, NavigateEbpf(EbpfNavigation),
102
103 SaveEbpfOutput {
105 filename: Option<String>,
106 },
107 SaveCommandSession {
108 filename: Option<String>,
109 },
110 StopSaveOutput, StopSaveSession, NoOp, SetSourcePanelVisibility(bool),
118}
119
120#[derive(Debug, Clone, Copy, PartialEq)]
121pub enum PanelType {
122 Source,
123 EbpfInfo,
124 InteractiveCommand,
125}
126
127#[derive(Debug, Clone, Copy, PartialEq)]
128pub enum CursorDirection {
129 Left,
130 Right,
131 Up,
132 Down,
133 Home,
134 End,
135}
136
137#[derive(Debug, Clone, Copy, PartialEq)]
138pub enum WindowDirection {
139 Left, Right, Up, Down, }
144
145#[derive(Debug, Clone, Copy, PartialEq)]
146pub enum SourceNavigation {
147 Up,
148 Down,
149 Left,
150 Right,
151 PageUp,
152 PageDown,
153 HalfPageUp, HalfPageDown, WordForward, WordBackward, LineStart, LineEnd, GoToLine(usize),
160 NextMatch,
161 PrevMatch,
162}
163
164#[derive(Debug, Clone, Copy, PartialEq)]
165pub enum EbpfNavigation {
166 Up,
167 Down,
168 PageUp,
169 PageDown,
170 GoToLine(usize),
171}
172
173#[derive(Debug, Clone, Copy, PartialEq)]
174pub enum ResponseType {
175 Success,
176 Error,
177 Warning,
178 Info,
179 Progress,
180 ScriptDisplay,
181}
182
183pub use crate::events::{RuntimeCommand, RuntimeStatus};