1use crate::chunks::IndexedChunkMeta;
2use crate::config::PreviewMode;
3use ck_core::SearchMode;
4use ck_core::SearchResult;
5use ck_index::IndexStats;
6use ratatui::text::Line;
7use std::collections::HashSet;
8use std::path::PathBuf;
9use std::time::Instant;
10
11pub struct TuiState {
12 pub query: String,
13 pub mode: SearchMode,
14 pub results: Vec<SearchResult>,
15 pub selected_idx: usize,
16 pub preview_content: String,
17 pub preview_lines: Vec<Line<'static>>, pub preview_mode: PreviewMode,
19 pub full_file_mode: bool, pub scroll_offset: usize, pub status_message: String,
22 pub search_path: PathBuf,
23 pub selected_files: HashSet<PathBuf>, pub search_history: Vec<String>, pub history_index: usize, pub command_mode: bool, pub index_stats: Option<IndexStats>,
28 pub last_index_stats_refresh: Option<Instant>,
29 pub index_stats_error: Option<String>,
30 pub preview_cache: Option<PreviewCache>,
31 pub indexing_message: Option<String>,
32 pub indexing_progress: Option<f32>,
33 pub indexing_active: bool,
34 pub indexing_started_at: Option<Instant>,
35 pub last_indexing_update: Option<Instant>,
36 pub search_in_progress: bool,
37}
38
39pub struct PreviewCache {
40 pub file: PathBuf,
41 pub lines: Vec<String>,
42 pub is_pdf: bool,
43 pub chunks: Vec<IndexedChunkMeta>,
44}