rmux_core/input/commands.rs
1//! Terminal input command types surfaced by the VT parser tables.
2
3/// ESC sequence commands (15 entries).
4#[derive(Debug, Clone, Copy, PartialEq, Eq)]
5pub enum EscCommand {
6 /// ESC ( 0 — G0 ACS on.
7 Scsg0On,
8 /// ESC ) 0 — G1 ACS on.
9 Scsg1On,
10 /// ESC 7 — Save cursor (DECSC).
11 Decsc,
12 /// ESC 8 — Restore cursor (DECRC).
13 Decrc,
14 /// ESC # 8 — Alignment test (DECALN).
15 Decaln,
16 /// ESC = — Keypad application mode (DECKPAM).
17 Deckpam,
18 /// ESC > — Keypad numeric mode (DECKPNM).
19 Deckpnm,
20 /// ESC ( B — G0 ACS off.
21 Scsg0Off,
22 /// ESC ) B — G1 ACS off.
23 Scsg1Off,
24 /// ESC D — Index (IND).
25 Ind,
26 /// ESC E — Next line (NEL).
27 Nel,
28 /// ESC H — Horizontal tab set (HTS).
29 Hts,
30 /// ESC M — Reverse index (RI).
31 Ri,
32 /// ESC \ — String terminator (ST).
33 St,
34 /// ESC c — Reset to initial state (RIS).
35 Ris,
36}
37
38/// CSI command types (40 entries).
39#[derive(Debug, Clone, Copy, PartialEq, Eq)]
40pub enum CsiCommand {
41 /// ICH — Insert Character (@).
42 Ich,
43 /// CUU — Cursor Up (A).
44 Cuu,
45 /// CUD — Cursor Down (B).
46 Cud,
47 /// CUF — Cursor Forward (C).
48 Cuf,
49 /// CUB — Cursor Back (D).
50 Cub,
51 /// CNL — Cursor Next Line (E).
52 Cnl,
53 /// CPL — Cursor Previous Line (F).
54 Cpl,
55 /// HPA — Horizontal Position Absolute (G or \`).
56 Hpa,
57 /// CUP — Cursor Position (H or f).
58 Cup,
59 /// ED — Erase in Display (J).
60 Ed,
61 /// EL — Erase in Line (K).
62 El,
63 /// IL — Insert Line (L).
64 Il,
65 /// DL — Delete Line (M).
66 Dl,
67 /// DCH — Delete Character (P).
68 Dch,
69 /// SU — Scroll Up (S).
70 Su,
71 /// SM_GRAPHICS — Set/query graphics mode (?S).
72 SmGraphics,
73 /// SD — Scroll Down (T).
74 Sd,
75 /// ECH — Erase Character (X).
76 Ech,
77 /// CBT — Cursor Backward Tabulation (Z).
78 Cbt,
79 /// REP — Repeat preceding character (b).
80 Rep,
81 /// DA — Device Attributes primary (c).
82 Da,
83 /// DA_TWO — Device Attributes secondary (>c).
84 DaTwo,
85 /// VPA — Vertical Position Absolute (d).
86 Vpa,
87 /// TBC — Tab Clear (g).
88 Tbc,
89 /// SM — Set Mode (h).
90 Sm,
91 /// SM_PRIVATE — Set Private Mode (?h).
92 SmPrivate,
93 /// RM — Reset Mode (l).
94 Rm,
95 /// RM_PRIVATE — Reset Private Mode (?l).
96 RmPrivate,
97 /// SGR — Select Graphic Rendition (m).
98 Sgr,
99 /// MODSET — Set modifier key mode (>m).
100 Modset,
101 /// DSR — Device Status Report (n).
102 Dsr,
103 /// MODOFF — Reset modifier key mode (>n).
104 Modoff,
105 /// DSR_PRIVATE — Private Device Status Report (?n).
106 DsrPrivate,
107 /// QUERY_PRIVATE — DECRPM Query (?$p).
108 QueryPrivate,
109 /// DECSCUSR — Set Cursor Style ( q).
110 Decscusr,
111 /// XDA — Extended Device Attributes (>q).
112 Xda,
113 /// DECSTBM — Set Top and Bottom Margins (r).
114 Decstbm,
115 /// SCP — Save Cursor Position (s).
116 Scp,
117 /// WINOPS — Window Operations (t).
118 Winops,
119 /// RCP — Restore Cursor Position (u).
120 Rcp,
121}
122
123/// OSC command numbers.
124#[derive(Debug, Clone, Copy, PartialEq, Eq)]
125pub enum OscCommand {
126 /// OSC 0/2 — Set title.
127 SetTitle,
128 /// OSC 4 — Set/query palette colour.
129 Palette,
130 /// OSC 7 — Set current directory path.
131 SetPath,
132 /// OSC 8 — Hyperlink.
133 Hyperlink,
134 /// OSC 9 — Desktop notification.
135 Notification,
136 /// OSC 10 — Set/query foreground colour.
137 FgColour,
138 /// OSC 11 — Set/query background colour.
139 BgColour,
140 /// OSC 12 — Set/query cursor colour.
141 CursorColour,
142 /// OSC 52 — Clipboard.
143 Clipboard,
144 /// OSC 104 — Reset palette colour.
145 ResetPalette,
146 /// OSC 110 — Reset foreground colour.
147 ResetFg,
148 /// OSC 111 — Reset background colour.
149 ResetBg,
150 /// OSC 112 — Reset cursor colour.
151 ResetCursor,
152 /// OSC 133 — Shell integration / prompt mark.
153 ShellIntegration,
154}
155
156/// DCS payload delivered to the screen writer.
157#[derive(Debug, Clone)]
158pub enum DcsPayload {
159 /// DECRQSS query (the string after `$q`).
160 Decrqss(Vec<u8>),
161 /// tmux passthrough (data after `tmux;` prefix).
162 Passthrough(Vec<u8>),
163 /// Sixel image data (deferred/deferred).
164 Sixel(Vec<u8>),
165}
166
167/// Actions that the parser surfaces to the caller.
168#[derive(Debug, Clone)]
169pub enum InputAction {
170 /// A reply string to write back to the PTY fd.
171 Reply(Vec<u8>),
172}