Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
03e7ef4
feat(linux-grid): add row numbers, row height and NULL text preferences
sedax90 Nov 8, 2026
390a0a3
feat(linux-grid): let the data grid have its own cell font
sedax90 Nov 8, 2026
8c415d7
feat(linux-grid): choose the format Copy writes for several rows
sedax90 Nov 8, 2026
2bc031b
feat(linux-grid): open row details when a row is selected, if asked
sedax90 Nov 8, 2026
ff5eae3
fix(linux-grid): show the chosen NULL text in editable cells too
sedax90 Nov 8, 2026
e13f6f5
Merge branch 'feat/linux-grid-display-settings' into feat/linux-grid-…
sedax90 Nov 8, 2026
4db6483
Merge branch 'feat/linux-grid-font' into feat/linux-row-copy-format
sedax90 Nov 8, 2026
d31a4f6
Merge branch 'feat/linux-row-copy-format' into feat/linux-auto-inspector
sedax90 Nov 8, 2026
ab70c2d
fix(linux-grid): share live display preferences across grids
datlechin Nov 8, 2026
1d3f362
fix(linux-grid): merge updated NULL display behavior
datlechin Nov 8, 2026
b0f30c2
feat(linux-grid): scope cell fonts to each grid
datlechin Nov 8, 2026
76e860b
Merge branch 'feat/linux-grid-font' of https://github.com/sedax90/Tab…
datlechin Nov 8, 2026
1ad8564
fix(linux-grid): synchronize row copy format preferences
datlechin Nov 8, 2026
e1d1f5b
fix(linux-grid): open row details only for selected rows
datlechin Nov 8, 2026
c0da2cf
fix(linux-grid): keep display preferences when resetting columns
datlechin Nov 8, 2026
c03b4eb
test(linux-grid): load native styles for row height checks
datlechin Nov 8, 2026
45b2c6f
fix(linux-grid): merge display reset and test fixture fixes
datlechin Nov 8, 2026
a19f02a
fix(linux-grid): merge display reset and test fixture fixes
datlechin Nov 8, 2026
c791e77
fix(linux-grid): merge display reset and test fixture fixes
datlechin Nov 8, 2026
38801c1
fix(linux-grid): expose editor state within row details
datlechin Nov 8, 2026
f0b3070
test(linux-grid): isolate settings notification contexts
datlechin Nov 8, 2026
36f6505
test(linux-grid): merge isolated settings contexts
datlechin Nov 8, 2026
d702bda
test(linux-grid): merge isolated settings contexts
datlechin Nov 8, 2026
d671bf3
test(linux-grid): merge isolated settings contexts
datlechin Nov 8, 2026
65b6a7f
fix(linux-grid): type the settings test shutdown channel
datlechin Nov 8, 2026
1f2ca73
fix(linux-grid): merge the settings test channel type
datlechin Nov 8, 2026
4b52c85
fix(linux-grid): merge the settings test channel type
datlechin Nov 8, 2026
83a7fd8
fix(linux-grid): merge the settings test channel type
datlechin Nov 8, 2026
068db68
test(linux-grid): assert copied JSON without unordered maps
datlechin Nov 8, 2026
6c94494
test(linux-grid): merge the ordered JSON assertions
datlechin Nov 8, 2026
1d48659
Merge branch 'main' into feat/linux-grid-font
datlechin Nov 9, 2026
41df39f
fix(linux-grid): pass the NULL text to the row details search
datlechin Nov 9, 2026
8425752
Merge remote-tracking branch 'origin/main' into feat/linux-grid-font
datlechin Nov 9, 2026
8973772
Merge branch 'feat/linux-grid-font' into feat/linux-row-copy-format
datlechin Nov 9, 2026
ad05a62
Merge branch 'feat/linux-row-copy-format' into feat/linux-auto-inspector
datlechin Nov 9, 2026
5a0e6d9
Merge branch 'main' into feat/linux-row-copy-format
datlechin Nov 9, 2026
cac6093
Merge commit '5a0e6d95a' into feat/linux-auto-inspector
datlechin Nov 9, 2026
fb2017d
Merge remote-tracking branch 'origin/main' into feat/linux-row-copy-f…
datlechin Nov 10, 2026
eef6e33
Merge commit 'fb2017ddaf829ac51ca52574b481d2776eb4a684' into feat/lin…
datlechin Nov 10, 2026
b2a4b9c
Merge remote-tracking branch 'origin/main' into feat/linux-row-copy-f…
datlechin Nov 10, 2026
b9ff0f1
Merge commit 'b2a4b9c8fdef800402ee413bfadb55cfbc052832' into feat/lin…
datlechin Nov 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions linux/changelog.d/4137.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Preferences can set the format Copy writes when several rows are selected, as TSV, JSON, CSV or Markdown.
1 change: 1 addition & 0 deletions linux/changelog.d/4138.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Preferences can open the row details pane whenever a row is selected.
19 changes: 17 additions & 2 deletions linux/crates/app/src/ui/data_grid/copy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use gtk4::{self as gtk, glib};
use tablepro_core::column::{ColumnInfo, ResultColumn};
use tablepro_core::edit::CellInput;
use tablepro_core::{FilterRule, Value};
use tablepro_linux_platform::settings::RowCopyFormat;

use super::grid_actions::{add, add_for_column, enable};
use super::selection::Resolved;
Expand Down Expand Up @@ -165,15 +166,29 @@ impl ShownColumns {
}
}

/// Copy: the target cell's value when one row is in play, else the rows.
fn copy(grid: &DataGrid) {
let Some(target) = grid.target() else {
return;
};
let column = target.cell.as_ref().map(|(_, column)| *column);
match (copy_scope(target.rows.len(), column), &target.cell) {
(CopyScope::Value(column), Some((row, _))) => copy_value(grid, row, column),
_ => copy_rows(grid, &target.rows, CopyKind::Rows),
_ => copy_rows(grid, &target.rows, preferred_format(grid)),
}
}

fn preferred_format(grid: &DataGrid) -> CopyKind {
match grid
.config()
.map(|config| config.settings.row_copy_format())
.unwrap_or_default()
{
RowCopyFormat::Rows => CopyKind::Rows,
RowCopyFormat::RowsWithHeaders => CopyKind::RowsWithHeaders,
RowCopyFormat::Json => CopyKind::Json,
RowCopyFormat::Csv => CopyKind::Csv,
RowCopyFormat::CsvWithHeaders => CopyKind::CsvWithHeaders,
RowCopyFormat::Markdown => CopyKind::Markdown,
}
}

Expand Down
47 changes: 47 additions & 0 deletions linux/crates/app/src/ui/data_grid/copy/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use crate::ui::data_grid::{DataGrid, GridCell, GridRequest};
use crate::ui::export::ExportSource;

const BEFORE: &str = "nothing copied yet";
const TWO_TEXT_ROWS_JSON: &str = "[\n{\"id\":1,\"name\":\"A\"},\n{\"id\":2,\"name\":\"B\"}\n]";

/// What a copy test drives: a grid and the requests it made.
trait Copies {
Expand Down Expand Up @@ -747,3 +748,49 @@ fn the_text_copies_take_the_columns_on_screen() {
assert_eq!(lines, "{\"id\":1,\"name\":\"Ada\"}\n{\"id\":2,\"name\":\"Grace\"}\n");
assert_eq!(one_row, "1, 'Ada', 2, 'Grace'");
}

#[gtk4::test]
fn copy_writes_several_rows_in_the_preferred_format() {
use tablepro_linux_platform::settings::RowCopyFormat;

let grid = Grid::open(two_text_columns(), two_text_values());
select_all(&grid);
let settings = &grid.grid.config().expect("a configured grid").settings;
for format in RowCopyFormat::ALL {
settings.set_row_copy_format(format.nick()).expect("store the format");

let text = copied(&grid, || activate(&grid.grid, "copy"));

match format {
RowCopyFormat::Rows => assert_eq!(text, "1\tA\n2\tB\n"),
RowCopyFormat::RowsWithHeaders => assert_eq!(text, "id\tname\n1\tA\n2\tB\n"),
RowCopyFormat::Csv => assert_eq!(text, "1,A\n2,B\n"),
RowCopyFormat::CsvWithHeaders => assert_eq!(text, "id,name\n1,A\n2,B\n"),
RowCopyFormat::Markdown => assert_eq!(text, "| id | name |\n| --- | --- |\n| 1 | A |\n| 2 | B |"),
RowCopyFormat::Json => assert_eq!(text, TWO_TEXT_ROWS_JSON),
}
}
}

#[gtk4::test]
fn preferred_row_format_preserves_single_cell_copy_and_explicit_formats() {
let grid = Grid::open(two_text_columns(), two_text_values());
grid.grid
.config()
.expect("a configured grid")
.settings
.set_row_copy_format("json")
.expect("store the format");
grid.grid.selection().select_item(0, true);
grid.focus(0, 1);

assert_eq!(copied(&grid, || activate(&grid.grid, "copy")), "A");

select_all(&grid);
assert_eq!(
copied(&grid, || activate(&grid.grid, "copy-csv-headers")),
"id,name\n1,A\n2,B\n"
);
let text = copied(&grid, || activate(&grid.grid, "copy"));
assert_eq!(text, TWO_TEXT_ROWS_JSON);
}
96 changes: 95 additions & 1 deletion linux/crates/app/src/ui/data_grid/edit/tests/rows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use libadwaita::prelude::*;
use tablepro_core::Value;
use tablepro_core::edit::CellInput;

use super::{editing, none, pending, press, two_text_rows};
use super::{details_shown, editing, none, pending, press, two_text_rows};
use crate::services::change_tracker::RowState;
use crate::services::grid::edit_policy;
use crate::test_support::{drain_main_context, respond, wait_until};
Expand Down Expand Up @@ -526,3 +526,97 @@ fn a_deleted_focus_does_not_disable_presets_for_other_selected_rows() {
assert_eq!(pending(&grid, 2, 1), Some(CellInput::Value(Value::Null)));
assert_eq!(grid.tracker.row_state(&key(1)), RowState::PendingDelete);
}

#[gtk4::test]
fn selecting_a_row_opens_the_details_only_when_preferences_ask() {
let grid = two_text_rows();
let settings = grid.grid.config().expect("a configured grid").settings.clone();

grid.focus(0, 1);
grid.grid.selection().select_item(0, true);
assert!(!details_shown(&grid), "off by default");

settings.set_auto_show_inspector(true).expect("store the flag");
drain_main_context();
assert!(!details_shown(&grid), "the preference waits for a new selection");
grid.focus(0, 0);
assert!(!details_shown(&grid), "focus alone does not select a row");
grid.grid.selection().select_item(1, true);
drain_main_context();
assert!(details_shown(&grid));

settings
.set_auto_show_inspector(false)
.expect("turn automatic opening off");
drain_main_context();
assert!(details_shown(&grid), "turning the preference off leaves the pane open");
grid.activate("show-details");
grid.grid.selection().select_item(0, true);
drain_main_context();
assert!(!details_shown(&grid));
}

#[gtk4::test]
fn closing_details_keeps_it_closed_through_focus_moves_and_escape() {
let grid = two_text_rows();
let settings = grid.grid.config().expect("a configured grid").settings.clone();
settings
.set_auto_show_inspector(true)
.expect("enable automatic opening");
select_all_from(&grid, 0, 1);
assert!(details_shown(&grid));

assert!(press(&grid, gdk::Key::Return, gdk::ModifierType::ALT_MASK));
assert!(!details_shown(&grid));
grid.focus(1, 0);
assert!(
!details_shown(&grid),
"moving focus with the same selection keeps it closed"
);
assert!(press(&grid, gdk::Key::Escape, none()));
drain_main_context();
assert!(grid.grid.selection().selection().is_empty());
assert!(
grid.grid.focused_cell().is_some(),
"the action target still has a focused row"
);
assert!(!details_shown(&grid), "clearing the selection must not reopen details");
grid.focus(0, 1);
assert!(
!details_shown(&grid),
"a focused cell without a selection keeps it closed"
);

grid.grid.selection().select_item(0, true);
drain_main_context();
assert!(details_shown(&grid), "a new selection opens details again");
}

#[gtk4::test]
fn open_grids_use_the_shared_auto_details_preference_on_their_next_selection() {
let first = two_text_rows();
let settings = first.grid.config().expect("a configured grid").settings.clone();
let second = Grid::build(
GridSpec {
settings: Some(settings.clone()),
..GridSpec::table(two_text_columns())
},
page(1..3),
);
let isolated = two_text_rows();
for grid in [&first, &second, &isolated] {
grid.grid.selection().unselect_all();
assert!(!details_shown(grid));
}

settings
.set_auto_show_inspector(true)
.expect("enable automatic opening");
for grid in [&first, &second, &isolated] {
grid.grid.selection().select_item(0, true);
}
drain_main_context();
assert!(details_shown(&first));
assert!(details_shown(&second));
assert!(!details_shown(&isolated));
}
14 changes: 14 additions & 0 deletions linux/crates/app/src/ui/data_grid/grid_actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,20 @@ impl DataGrid {
self.target()?.cell.map(|(_, column)| column)
}

pub(super) fn open_details_for_selection(&self) {
let wanted = self
.config()
.is_some_and(|config| config.settings.auto_show_inspector());
// Action targets include a focused row after Escape clears the selection.
let selected = !self.selection().selection().is_empty();
if wanted
&& selected
&& let Some(details) = self.imp().actions.lookup_action("show-details")
{
details.change_state(&true.to_variant());
}
}

/// Open the detail pane on the focused row, with `column`'s field.
pub(crate) fn show_details_for(&self, column: usize) {
self.imp().detail_pane.select_field(column);
Expand Down
1 change: 1 addition & 0 deletions linux/crates/app/src/ui/data_grid/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ impl DataGrid {
fn selection_moved(&self) {
self.refresh_actions();
self.imp().detail_pane.follow_focus();
self.open_details_for_selection();
self.emit_by_name::<()>("selection-changed", &[]);
}

Expand Down
21 changes: 21 additions & 0 deletions linux/crates/app/src/ui/data_grid/row_detail/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1968,3 +1968,24 @@ fn search_keys_and_tab_order_reach_the_filter_list_and_value() {
.expect("Escape");
wait_until(WAIT, || !grid.grid.imp().split_view.shows_sidebar()).expect("Escape closes the empty overlay search");
}

#[gtk4::test]
fn changing_automatic_details_opening_keeps_an_active_value_draft() {
let (grid, pane) = opened(two_text_columns(), two_text_values());
edit_field(&grid, &pane, 0, 1);
type_value(&pane, "unfinished");
let settings = grid.grid.config().expect("a configured grid").settings.clone();

settings
.set_auto_show_inspector(true)
.expect("enable automatic opening");
settings
.set_auto_show_inspector(false)
.expect("disable automatic opening");
drain_main_context();

assert!(pane.is_open());
assert!(pane.is_editing_value());
assert_eq!(pane.typed_text(), "unfinished");
assert_eq!(pending(&grid, 1, 1), None);
}
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ impl RowDetailPane {
}
}

fn is_editing_value(&self) -> bool {
pub(super) fn is_editing_value(&self) -> bool {
self.imp().edit.borrow().is_some()
}

Expand Down
90 changes: 77 additions & 13 deletions linux/crates/app/src/ui/preferences_dialog/data_browser_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use gtk4::prelude::*;
use gtk4::subclass::prelude::*;
use libadwaita as adw;
use tablepro_linux_platform::AppSettings;
use tablepro_linux_platform::settings::{GridRowHeight, keys};
use tablepro_linux_platform::settings::{GridRowHeight, RowCopyFormat, keys};

mod imp {
use libadwaita::prelude::*;
Expand All @@ -30,6 +30,10 @@ mod imp {
#[template_child]
pub row_numbers_row: TemplateChild<adw::SwitchRow>,
#[template_child]
pub auto_inspector_row: TemplateChild<adw::SwitchRow>,
#[template_child]
pub row_copy_format_row: TemplateChild<adw::ComboRow>,
#[template_child]
pub row_height_row: TemplateChild<adw::ComboRow>,
#[template_child]
pub null_display_row: TemplateChild<adw::EntryRow>,
Expand Down Expand Up @@ -113,22 +117,43 @@ impl DataBrowserGroup {
})
.build();
gio_settings
.bind(keys::GRID_ROW_HEIGHT, &imp.row_height_row.get(), "selected")
.mapping(|variant, _| {
let height = variant.str()?;
let index = GridRowHeight::ALL
.iter()
.position(|candidate| candidate.nick() == height)?;
Some((index as u32).to_value())
})
.set_mapping(|value, _| {
let index = value.get::<u32>().ok()?;
Some(GridRowHeight::ALL.get(index as usize)?.nick().to_variant())
})
.bind(keys::AUTO_SHOW_INSPECTOR, &imp.auto_inspector_row.get(), "active")
.build();
bind_choice(
&imp.row_height_row.get(),
gio_settings,
keys::GRID_ROW_HEIGHT,
GridRowHeight::ALL.map(GridRowHeight::nick),
);
bind_choice(
&imp.row_copy_format_row.get(),
gio_settings,
keys::ROW_COPY_FORMAT,
RowCopyFormat::ALL.map(RowCopyFormat::nick),
);
}
}

fn bind_choice<const N: usize>(
row: &adw::ComboRow,
settings: &gio::Settings,
key: &'static str,
words: [&'static str; N],
) {
settings
.bind(key, row, "selected")
.mapping(move |variant, _| {
let word = variant.str()?;
let index = words.iter().position(|candidate| *candidate == word)?;
Some((index as u32).to_value())
})
.set_mapping(move |value, _| {
let index = value.get::<u32>().ok()?;
Some(words.get(index as usize)?.to_variant())
})
.build();
}

#[cfg(test)]
mod tests {
use libadwaita::prelude::*;
Expand Down Expand Up @@ -169,6 +194,21 @@ mod tests {
assert!(settings.get().show_alternate_rows());
}

#[gtk4::test]
fn automatic_details_switches_stay_in_sync() {
let settings = MemorySettings::new();
let first = bound_group(&settings);
let second = bound_group(&settings);
assert!(!first.imp().auto_inspector_row.is_active());

first.imp().auto_inspector_row.set_active(true);
assert!(settings.get().auto_show_inspector());
assert!(second.imp().auto_inspector_row.is_active());
settings.get().set_auto_show_inspector(false).expect("store the flag");
assert!(!first.imp().auto_inspector_row.is_active());
assert!(!second.imp().auto_inspector_row.is_active());
}

#[gtk4::test]
fn the_group_is_titled_for_the_data_browser() {
let settings = MemorySettings::new();
Expand Down Expand Up @@ -258,4 +298,28 @@ mod tests {
assert!(first.imp().grid_system_font_row.is_active());
assert!(!second.imp().grid_font_row.is_sensitive());
}

#[gtk4::test]
fn copy_format_rows_follow_every_choice_from_both_windows() {
let settings = MemorySettings::new();
let first = bound_group(&settings);
let second = bound_group(&settings);

for (index, format) in RowCopyFormat::ALL.into_iter().enumerate() {
first.imp().row_copy_format_row.set_selected(index as u32);
assert_eq!(settings.get().row_copy_format(), format);
assert_eq!(second.imp().row_copy_format_row.selected(), index as u32);
}
for (index, format) in RowCopyFormat::ALL.into_iter().enumerate().rev() {
settings
.get()
.set_row_copy_format(format.nick())
.expect("store copy format");
assert_eq!(first.imp().row_copy_format_row.selected(), index as u32);
assert_eq!(second.imp().row_copy_format_row.selected(), index as u32);
}
second.imp().row_copy_format_row.set_selected(2);
assert_eq!(first.imp().row_copy_format_row.selected(), 2);
assert_eq!(settings.get().row_copy_format(), RowCopyFormat::Json);
}
}
Loading
Loading