Skip to content

feat(linux-grid): sum, average and count the selected rows' focused column - #3877

Merged
datlechin merged 12 commits into
TableProApp:mainfrom
sedax90:feat/linux-grid-selection-summary
Oct 30, 2026
Merged

datlechin merged 12 commits into
TableProApp:mainfrom
sedax90:feat/linux-grid-selection-summary

Conversation

@sedax90

@sedax90 sedax90 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Selecting two or more rows shows the focused column's sum, average and count in the bottom bar of a table tab, an editor result and a Redis key tab. The popover lists count, numbers, empty, not-a-number, sum, average, minimum and maximum, each with a Copy button that copies plain text with no grouping.
  • Exact arithmetic on the values as their cells show them: integers of any width, decimals by their digits (SqlDecimal::parts, new in core), floats by the shortest text the cell shows. Sum, minimum and maximum keep the widest scale and at least the column's declared one; the average carries four more digits. No digit caps.
  • A number column sums (a value that is not a number, such as NaN, counts as one); a column of no declared type sums text that reads as a number, Value::Other included; any other column only counts. NULL and a cell left to its default count as empty. Rows marked for deletion are left out, also after a failed save.
  • The summed column is the last focused data column, so the readout stays while the focus is in its popover or Row Details. A hidden column is not summed.
  • The sum runs off the GTK thread on the grid's Tasks, once per main-loop turn, over the summed column alone, sharing the page's cells. A newer selection or closing the grid stops a run still out; Copy is off while one is out.
  • Closing a grid also stops a find-bar search still out.
  • Structure tab: Discard on a table that changed elsewhere shows the definition as last read while it reads the table again, and through a failed read, instead of the discarded edits.
  • The change tracker keeps pending drafts in an IndexMap by id, so reading every draft of a 100,000-row paste (the summary, copy, find, duplicate) or undoing it no longer scans every draft per row.
  • Stock widgets only: a GtkMenuButton with can-shrink, so a narrow bar ellipsizes the sentence and keeps the arrow, inside a slide-right GtkRevealer, which keeps the bar's height while hidden. The popover is built once and updated in place.
  • The browse tab hides the readout behind its error and loading pages, as it does the selected-row count.
  • The editor result footer is now a fixed 34 px (the button's height) instead of 22 px, so selecting a second row no longer shifts the grid.

Screenshots

Light Dark
Before Before, light Before, dark
After After, light After, dark

Test plan

  • services::grid::selection_summary::tests (11): exact decimal, float32 and float64 sums, widths past i128, a 1,500-digit decimal, the declared scale, rounding, NULL and NaN, untyped text and Value::Other, the rule per column type, cancellation.
  • ui::data_grid::tests::summary (11): sums the focused column, a text column only counts, one row hides it, an edit counts while the focus is elsewhere, deleted rows left out after a failed save, a hidden column, constant height, the popover's figures and Copy's plain text, a long figure on one line, the readout freed with its grid, closing the grid stops the run.
  • ui::data_grid::tracked_values::tests: a column snapshot reads a pending edit, a draft's cell, and a default as NULL.
  • ui::data_grid::find_bar::tests::closing_the_grid_stops_the_search_still_running. It and the summary's closing test fail with the two stop() lines taken out of dispose.
  • ui::structure_tab::tests::a_discard_whose_read_fails_leaves_the_discarded_column_out; a_discard_after_a_save_found_the_table_changed_reads_it_again no longer races the read.
  • services::change_tracker::tests::the_largest_paste_reads_back_and_undoes_without_a_scan_per_draft: 100,000 drafts read back and undone in under 2 s.
  • ui::browse_tab::tests::load::the_selection_summary_hides_behind_the_error_page, ui::key_tab::tests::the_footer_sums_the_selected_entries (also checks the popover's first Copy button takes the focus).
  • value::decimal::tests::parts_round_trip_through_from_parts.
  • verify.sh --platform linux test tablepro: 2,561 of 2,563 passed; the other two are fixed here, after which ui::structure_tab and ui::data_grid (416) pass. lint: clean.

@datlechin
datlechin merged commit 42a9721 into TableProApp:main Oct 30, 2026
42 of 43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants