Skip to repository content58 lines · 1.9 KB · rust
tenant.openagents/omega
No repository description is available.
OpenAgents Git authority 2026-07-28T02:34:12.958Z Public web read
NIP-34 coordinate
30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omegaMaintainersHidden in public view
References2 branches · 1 tag
Read-only clone
git clone https://openagents.com/git/tenant.openagents/omega.gitBrowse files
settings.rs
1#[derive(Default, Clone, Copy, PartialEq)]
2pub enum RowRenderMechanism {
3 /// More correct for multiline content, but slower.
4 #[default]
5 VariableList,
6 /// Default behaviour for now while resizable columns are being stabilized.
7 #[allow(dead_code)] // Will be used when settings ui is added
8 UniformList,
9}
10
11#[derive(Default, Clone, Copy)]
12pub enum VerticalAlignment {
13 /// Align text to the top of cells
14 #[default]
15 Top,
16 /// Center text vertically in cells
17 Center,
18}
19
20#[derive(Default, Clone, Copy)]
21pub enum RowIdentifiers {
22 /// Show original line numbers from CSV file
23 #[default]
24 SrcLines,
25 /// Show sequential row numbers starting from 1
26 RowNum,
27}
28
29#[derive(Default, Clone, Copy, PartialEq)]
30pub enum FilterSortOrder {
31 /// Sort alphabetically (A→Z), then by number of occurrences descending within ties
32 #[default]
33 AlphaThenCount,
34 /// Sort by number of occurrences descending, then alphabetically within ties
35 CountThenAlpha,
36}
37
38#[derive(Clone, Default)]
39pub(crate) struct CsvPreviewSettings {
40 pub(crate) rendering_with: RowRenderMechanism,
41 pub(crate) vertical_alignment: VerticalAlignment,
42 pub(crate) numbering_type: RowIdentifiers,
43 pub(crate) filter_sort_order: FilterSortOrder,
44 pub(crate) show_debug_info: bool,
45 #[cfg(feature = "dev-tools")]
46 pub(crate) show_perf_metrics_overlay: bool,
47 pub(crate) multiline_cells_enabled: bool,
48}
49
50impl CsvPreviewSettings {
51 /// `multiline_cells_enabled` only makes sense with `VariableList`, which
52 /// supports per-row heights; `UniformList` requires every row to share one
53 /// height, so multiline is never honored there regardless of the setting.
54 pub(crate) fn multiline_cells_effectively_enabled(&self) -> bool {
55 self.multiline_cells_enabled && self.rendering_with == RowRenderMechanism::VariableList
56 }
57}
58