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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
//! # Summary
//! ANSI escape sequence constants for terminal rendering.
//!
//! # Description
//! Contains static string slices for DECSTBM, SGR colors, and cursor manipulation.
/// # Summary
/// Warning message emitted when CRC mismatch triggers a factory reset.
///
/// # Description
/// Uses ANSI yellow text to alert the user that persistent state was lost.
///
/// # Examples
/// ```rust
/// use cli_chat_core::state::ansi::CRC_MISMATCH_WARNING;
/// assert!(CRC_MISMATCH_WARNING.contains("CRC mismatch"));
/// ```
///
/// # Panics
/// None.
///
/// # Errors
/// None.
///
/// # Safety
/// Safe.
///
/// # See Also
/// [`crate::state::AppState::init`]
pub const CRC_MISMATCH_WARNING: &str =
"\x1b[33m[WARNING] CRC mismatch: factory reset applied\x1b[0m\r\n";
/// # Summary
/// ANSI escape sequence to clear the entire screen.
///
/// # Description
/// Uses the `CSI 2 J` sequence to clear the terminal display.
///
/// # Examples
/// ```rust
/// use cli_chat_core::state::ansi::CLEAR_SCREEN;
/// assert_eq!(CLEAR_SCREEN, "\x1b[2J");
/// ```
///
/// # Panics
/// None.
///
/// # Errors
/// None.
///
/// # Safety
/// Safe.
///
/// # See Also
/// [`CURSOR_HOME`]
pub const CLEAR_SCREEN: &str = "\x1b[2J";
/// # Summary
/// ANSI escape sequence to move the cursor to the top-left corner.
///
/// # Description
/// Uses the `CSI H` sequence to reset the cursor position to row 1, column 1.
///
/// # Examples
/// ```rust
/// use cli_chat_core::state::ansi::CURSOR_HOME;
/// assert_eq!(CURSOR_HOME, "\x1b[H");
/// ```
///
/// # Panics
/// None.
///
/// # Errors
/// None.
///
/// # Safety
/// Safe.
///
/// # See Also
/// [`CLEAR_SCREEN`]
pub const CURSOR_HOME: &str = "\x1b[H";
/// # Summary
/// ANSI escape sequence to set the scrolling region (DECSTBM).
///
/// # Description
/// Restricts the scrolling area to lines 1 through 22, reserving the bottom for input.
///
/// # Examples
/// ```rust
/// use cli_chat_core::state::ansi::SCROLL_REGION_22;
/// assert_eq!(SCROLL_REGION_22, "\x1b[1;22r");
/// ```
///
/// # Panics
/// None.
///
/// # Errors
/// None.
///
/// # Safety
/// Safe.
///
/// # See Also
/// [`CURSOR_INPUT_LINE`]
pub const SCROLL_REGION_22: &str = "\x1b[1;22r";
/// # Summary
/// ANSI escape sequence to move the cursor to the input line.
///
/// # Description
/// Moves the cursor to row 24, column 1 for the line editor prompt.
///
/// # Examples
/// ```rust
/// use cli_chat_core::state::ansi::CURSOR_INPUT_LINE;
/// assert_eq!(CURSOR_INPUT_LINE, "\x1b[24;1H");
/// ```
///
/// # Panics
/// None.
///
/// # Errors
/// None.
///
/// # Safety
/// Safe.
///
/// # See Also
/// [`CURSOR_DIVIDER_LINE`]
pub const CURSOR_INPUT_LINE: &str = "\x1b[24;1H";
/// # Summary
/// ANSI escape sequence to move the cursor to the divider line.
///
/// # Description
/// Moves the cursor to row 23, column 1 to draw the UI separator.
///
/// # Examples
/// ```rust
/// use cli_chat_core::state::ansi::CURSOR_DIVIDER_LINE;
/// assert_eq!(CURSOR_DIVIDER_LINE, "\x1b[23;1H");
/// ```
///
/// # Panics
/// None.
///
/// # Errors
/// None.
///
/// # Safety
/// Safe.
///
/// # See Also
/// [`CURSOR_INPUT_LINE`]
pub const CURSOR_DIVIDER_LINE: &str = "\x1b[23;1H";
/// # Summary
/// ANSI escape sequence to erase the current line.
///
/// # Description
/// Uses the `CSI 2 K` sequence to clear all characters on the active line.
///
/// # Examples
/// ```rust
/// use cli_chat_core::state::ansi::ERASE_LINE;
/// assert_eq!(ERASE_LINE, "\x1b[2K");
/// ```
///
/// # Panics
/// None.
///
/// # Errors
/// None.
///
/// # Safety
/// Safe.
///
/// # See Also
/// [`CLEAR_SCREEN`]
pub const ERASE_LINE: &str = "\x1b[2K";
/// # Summary
/// ANSI escape sequence to reset text formatting.
///
/// # Description
/// Uses the `CSI 0 m` sequence to clear all SGR color and style attributes.
///
/// # Examples
/// ```rust
/// use cli_chat_core::state::ansi::COLOR_RESET;
/// assert_eq!(COLOR_RESET, "\x1b[0m");
/// ```
///
/// # Panics
/// None.
///
/// # Errors
/// None.
///
/// # Safety
/// Safe.
///
/// # See Also
/// [`COLOR_PROMPT`]
pub const COLOR_RESET: &str = "\x1b[0m";
/// # Summary
/// ANSI escape sequence for the prompt color (Green).
///
/// # Description
/// Uses the `CSI 32 m` sequence to set the foreground text color to green.
///
/// # Examples
/// ```rust
/// use cli_chat_core::state::ansi::COLOR_PROMPT;
/// assert_eq!(COLOR_PROMPT, "\x1b[32m");
/// ```
///
/// # Panics
/// None.
///
/// # Errors
/// None.
///
/// # Safety
/// Safe.
///
/// # See Also
/// [`COLOR_RESET`]
pub const COLOR_PROMPT: &str = "\x1b[32m";
/// # Summary
/// ANSI escape sequence for the divider color (Blue).
///
/// # Description
/// Uses the `CSI 34 m` sequence to set the foreground text color to blue.
///
/// # Examples
/// ```rust
/// use cli_chat_core::state::ansi::COLOR_DIVIDER;
/// assert_eq!(COLOR_DIVIDER, "\x1b[34m");
/// ```
///
/// # Panics
/// None.
///
/// # Errors
/// None.
///
/// # Safety
/// Safe.
///
/// # See Also
/// [`COLOR_RESET`]
pub const COLOR_DIVIDER: &str = "\x1b[34m";
/// # Summary
/// ANSI escape sequence for system messages (Yellow).
///
/// # Description
/// Uses the `CSI 33 m` sequence to set the foreground text color to yellow.
///
/// # Examples
/// ```rust
/// use cli_chat_core::state::ansi::COLOR_SYSTEM;
/// assert_eq!(COLOR_SYSTEM, "\x1b[33m");
/// ```
///
/// # Panics
/// None.
///
/// # Errors
/// None.
///
/// # Safety
/// Safe.
///
/// # See Also
/// [`COLOR_RESET`]
pub const COLOR_SYSTEM: &str = "\x1b[33m";
/// # Summary
/// ANSI escape sequence for info messages (Cyan).
///
/// # Description
/// Uses the `CSI 36 m` sequence to set the foreground text color to cyan.
///
/// # Examples
/// ```rust
/// use cli_chat_core::state::ansi::COLOR_INFO;
/// assert_eq!(COLOR_INFO, "\x1b[36m");
/// ```
///
/// # Panics
/// None.
///
/// # Errors
/// None.
///
/// # Safety
/// Safe.
///
/// # See Also
/// [`COLOR_RESET`]
pub const COLOR_INFO: &str = "\x1b[36m";
/// # Summary
/// ANSI escape sequence to save the current cursor position.
///
/// # Description
/// Uses the `ESC 7` sequence to memorize where the cursor currently is.
///
/// # Examples
/// ```rust
/// use cli_chat_core::state::ansi::SAVE_CURSOR;
/// assert_eq!(SAVE_CURSOR, "\x1b7");
/// ```
///
/// # Panics
/// None.
///
/// # Errors
/// None.
///
/// # Safety
/// Safe.
///
/// # See Also
/// [`RESTORE_CURSOR`]
pub const SAVE_CURSOR: &str = "\x1b7";
/// # Summary
/// ANSI escape sequence to restore the saved cursor position.
///
/// # Description
/// Uses the `ESC 8` sequence to move the cursor back to the saved location.
///
/// # Examples
/// ```rust
/// use cli_chat_core::state::ansi::RESTORE_CURSOR;
/// assert_eq!(RESTORE_CURSOR, "\x1b8");
/// ```
///
/// # Panics
/// None.
///
/// # Errors
/// None.
///
/// # Safety
/// Safe.
///
/// # See Also
/// [`SAVE_CURSOR`]
pub const RESTORE_CURSOR: &str = "\x1b8";
/// # Summary
/// ANSI escape sequence to move the cursor to the bottom of the scrolling region.
///
/// # Description
/// Moves the cursor to row 22, column 1.
///
/// # Examples
/// ```rust
/// use cli_chat_core::state::ansi::CURSOR_SCROLL_BOTTOM;
/// assert_eq!(CURSOR_SCROLL_BOTTOM, "\x1b[22;1H");
/// ```
///
/// # Panics
/// None.
///
/// # Errors
/// None.
///
/// # Safety
/// Safe.
///
/// # See Also
/// [`SCROLL_REGION_22`]
pub const CURSOR_SCROLL_BOTTOM: &str = "\x1b[22;1H";