From 4972675b1b0e2d309dcf94442e8372a6e4741089 Mon Sep 17 00:00:00 2001 From: vangel76 Date: Mon, 12 Oct 2026 21:03:01 +0200 Subject: [PATCH 01/94] UI: Quick Analysis (Ctrl+Q) (#791) A corner button on multi-cell selections and Ctrl+Q open a popup of one-click analyses (formatting, charts, totals, tables, sparklines). Totals and sparklines are new engine commands, analysis.addTotal and analysis.addSparklines, each one undo step, never overwriting data unless asked. Co-Authored-By: Claude Sonnet 5.5 --- ROADMAP.md | 1 + crates/engine/src/cmd/mod.rs | 2 + crates/engine/src/cmd/quick_analysis.rs | 269 +++++++++++++++++ crates/engine/src/tests.rs | 71 +++++ crates/ui-egui/examples/snapshot.rs | 20 +- crates/ui-egui/src/grid.rs | 3 + crates/ui-egui/src/i18n.rs | 24 ++ crates/ui-egui/src/i18n/cs.rs | 24 ++ crates/ui-egui/src/i18n/de.rs | 24 ++ crates/ui-egui/src/i18n/es.rs | 24 ++ crates/ui-egui/src/i18n/fr.rs | 24 ++ crates/ui-egui/src/i18n/ko.rs | 24 ++ crates/ui-egui/src/i18n/pt.rs | 24 ++ crates/ui-egui/src/i18n/ru.rs | 24 ++ crates/ui-egui/src/i18n/zh.rs | 24 ++ crates/ui-egui/src/icons.rs | 9 + crates/ui-egui/src/lib.rs | 2 + crates/ui-egui/src/quick_analysis.rs | 364 ++++++++++++++++++++++++ crates/ui-egui/src/ribbon.rs | 5 + docs/ui-parity.md | 10 +- 20 files changed, 967 insertions(+), 5 deletions(-) create mode 100644 crates/engine/src/cmd/quick_analysis.rs create mode 100644 crates/ui-egui/src/quick_analysis.rs diff --git a/ROADMAP.md b/ROADMAP.md index e8e1c06b38..25b8d9b803 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -132,6 +132,7 @@ Ranked; estimates in Opus 5.5 agent-hours. Detail and the full beta-gate list in | Date | What landed | |---|---| +| 2026-10-12 | Quick Analysis (Ctrl+Q): a corner button and popup on multi-cell selections run conditional formats, charts, totals (`analysis.addTotal`), tables, PivotTables and sparklines (`analysis.addSparklines`) in one click (#791) | | 2026-10-12 | File › Print selects a system printer, copies, duplex and grayscale, submits PDF jobs through craft-print on a worker and shows spooler errors; browser printing and PDF export remain available | | 2026-10-11 | Command-sequence fuzzing: random command sequences checked against undo/redo, XLSX round-trip and full recalculation; fixes for the table, legacy-array, spill, AutoSum, Watch Window and sheet-copy bugs it found | | 2026-10-11 | Password-protected workbooks open: GridCraft asks for the password and decrypts Agile and Standard encryption (#11) | diff --git a/crates/engine/src/cmd/mod.rs b/crates/engine/src/cmd/mod.rs index 50865a2b7d..d016fbb494 100644 --- a/crates/engine/src/cmd/mod.rs +++ b/crates/engine/src/cmd/mod.rs @@ -14,6 +14,7 @@ pub mod insert; pub mod inspect; pub mod pivot; pub mod print; +pub mod quick_analysis; pub mod review; pub mod sheet; pub mod slicer; @@ -144,6 +145,7 @@ pub fn command_specs() -> &'static [CommandSpec] { v.extend(forecast::specs()); v.extend(analysis::specs()); v.extend(print::specs()); + v.extend(quick_analysis::specs()); v }) } diff --git a/crates/engine/src/cmd/quick_analysis.rs b/crates/engine/src/cmd/quick_analysis.rs new file mode 100644 index 0000000000..94f4197020 --- /dev/null +++ b/crates/engine/src/cmd/quick_analysis.rs @@ -0,0 +1,269 @@ +//! Quick Analysis › Totals: appends totals (or per-cell percentages / running totals) next to a +//! block of numbers as ordinary formulas, in one undoable edit. The popup in the UI +//! (`ui.quickAnalysis`) is a thin front end for this command; the control channel, CLI and MCP +//! call it directly. The layout is GridCraft's own: aggregates go in the row below the block (or +//! the column to its right), per-cell results in a block of the same shape next to it. + +use std::collections::BTreeSet; + +use gridcraft_core::{CellRef, MAX_COLS, MAX_ROWS, RangeRef}; +use gridcraft_model::{Color, NumFmt, Sparkline, SparklineKind}; +use serde_json::{Value as Json, json}; + +use super::*; + +const CMD: &str = "analysis.addTotal"; +const SPARK: &str = "analysis.addSparklines"; +/// Most sparklines one call may add. +const MAX_SPARKLINES: u64 = 10_000; +/// Most cells one call may write (a per-cell block on a huge selection is refused). +const MAX_OUTPUT_CELLS: u64 = 200_000; +/// Largest block (after clipping to the used range) the command scans for numbers. +const MAX_SCAN_CELLS: u64 = 5_000_000; + +pub fn specs() -> Vec { + vec![ + cmd!( + "analysis.addTotal", + "Add Totals", + [], + None, + "{function?: sum|average|count|min|max|percentTotal|runningTotal (default sum), direction?: columns|rows (default columns: one result per column, below the block; rows: one per row, right of it; percentTotal and runningTotal write a block of the same shape to the right (columns) or below (rows)), range?: \"A1:C9\" (default: the selection; limited to the used range), overwrite?: bool (else non-empty output cells are refused)} → {function, direction, output, cells}. Quick Analysis › Totals. A header row (columns) or label column (rows) is skipped; columns without numbers get no total. One undo step.", + has_doc, + add_total + ), + cmd!( + "analysis.addSparklines", + "Add Sparklines", + [], + None, + "{type?: line|column|winLoss (default line), direction?: rows|columns (default rows: one sparkline per row, in the column right of the block; columns: one per column, in the row below), markers?: bool, range?: \"A1:F9\" (default: the selection; limited to the used range), overwrite?: bool} → {output, sparklines}. Quick Analysis › Sparklines. A header row (columns) or label column (rows) is skipped; lines without numbers get none. One undo step.", + has_doc, + add_sparklines + ), + ] +} + +#[derive(Clone, Copy, PartialEq)] +enum Func { + Aggregate(&'static str), + Percent, + Running, +} + +fn parse_func(name: &str) -> Result { + Ok(match name.to_ascii_lowercase().replace(['_', '-', ' ', '%'], "").as_str() { + "sum" => Func::Aggregate("SUM"), + "average" | "avg" => Func::Aggregate("AVERAGE"), + "count" => Func::Aggregate("COUNT"), + "min" => Func::Aggregate("MIN"), + "max" => Func::Aggregate("MAX"), + "percenttotal" | "percent" => Func::Percent, + "runningtotal" | "running" => Func::Running, + _ => return Err(bad(CMD, format!("unknown function `{name}` (use sum, average, count, min, max, percentTotal or runningTotal)"))), + }) +} + +/// The block a Quick Analysis result is computed from. +struct Block { + sheet: usize, + /// The selection clipped to the used range. + range: RangeRef, + /// `range` without its header row (columns) or label column (rows). + data: RangeRef, + /// The columns (or, `by_rows`, the rows) of `data` that hold numbers. + lines: BTreeSet, + by_rows: bool, +} + +impl Block { + fn cell_at(&self, line: u32, i: u32) -> CellRef { + if self.by_rows { CellRef::new(line, i) } else { CellRef::new(i, line) } + } + /// First and last position along a line of `data`. + fn span_of_line(&self) -> (u32, u32) { + if self.by_rows { (self.data.start.col, self.data.end.col) } else { (self.data.start.row, self.data.end.row) } + } + fn line_range(&self, line: u32, from: u32, to: u32) -> RangeRef { + RangeRef::new(self.cell_at(line, from), self.cell_at(line, to)) + } +} + +fn block(s: &Session, p: &Json, by_rows: bool) -> Result { + let sheet = target_sheet(s, p)?; + let sel = match str_param(p, "range") { + Some(_) => target_range(s, p)?, + None => s.doc()?.selection.current(), + }; + if sel.is_single() { + return Err(bad(CMD, "select at least two cells")); + } + let d = s.doc()?; + let sh = d.wb.sheet(sheet).ok_or(EngineError::NoDocument)?; + // Whole rows / columns are limited to what holds data. + let used = sh.cells.used_range().ok_or_else(|| EngineError::Other("There is no data to analyse.".into()))?; + let r = sel.intersection(&used).ok_or_else(|| EngineError::Other("There is no data to analyse in the selection.".into()))?; + if r.count() > MAX_SCAN_CELLS { + return Err(bad(CMD, "selection too large to analyse")); + } + let is_num = |c: CellRef| sh.value(c).is_number(); + let is_text = |c: CellRef| sh.value(c).is_text(); + // Header row (columns) / label column (rows): text only, with at least one entry. + let lead: Vec = if by_rows { + (r.start.row..=r.end.row).map(|row| CellRef::new(row, r.start.col)).collect() + } else { + (r.start.col..=r.end.col).map(|c| CellRef::new(r.start.row, c)).collect() + }; + let longer_than_one = if by_rows { r.width() > 1 } else { r.height() > 1 }; + let has_label = longer_than_one && lead.iter().any(|c| is_text(*c)) && !lead.iter().any(|c| is_num(*c)); + let data = if by_rows { + RangeRef::new(CellRef::new(r.start.row, r.start.col + u32::from(has_label)), r.end) + } else { + RangeRef::new(CellRef::new(r.start.row + u32::from(has_label), r.start.col), r.end) + }; + let mut lines: BTreeSet = BTreeSet::new(); + for (c, _) in sh.cells.iter_range(data) { + if is_num(c) { + lines.insert(if by_rows { c.row } else { c.col }); + } + } + if lines.is_empty() { + return Err(EngineError::Other("The selection holds no numbers.".into())); + } + Ok(Block { sheet, range: r, data, lines, by_rows }) +} + +fn add_total(s: &mut Session, p: &Json) -> Result { + let func = parse_func(str_param(p, "function").unwrap_or("sum"))?; + let by_rows = match str_param(p, "direction") { + None | Some("columns") => false, + Some("rows") => true, + Some(other) => return Err(bad(CMD, format!("direction must be columns or rows, not `{other}`"))), + }; + let overwrite = bool_param(p, "overwrite").unwrap_or(false); + let b = block(s, p, by_rows)?; + let (r, sheet) = (b.range, b.sheet); + let (lo, hi) = b.span_of_line(); + let out_cells = match func { + Func::Aggregate(_) => b.lines.len() as u64, + _ => b.lines.len() as u64 * (u64::from(hi - lo) + 1), + }; + if out_cells > MAX_OUTPUT_CELLS { + return Err(bad(CMD, "selection too large for this result")); + } + // `$` pins a part of a reference like a hand-written formula would. + let abs = |c: CellRef, row: bool, col: bool| { + let a = c.a1(); + let letters: String = a.chars().take_while(|ch| ch.is_ascii_alphabetic()).collect(); + let digits = &a[letters.len()..]; + format!("{}{letters}{}{digits}", if col { "$" } else { "" }, if row { "$" } else { "" }) + }; + // (target, formula) pairs. + let mut writes: Vec<(CellRef, String)> = Vec::with_capacity(out_cells as usize); + let (height, width) = (r.height(), r.width()); + for &line in &b.lines { + match func { + Func::Aggregate(name) => { + let target = if by_rows { CellRef::new(line, r.end.col.saturating_add(1)) } else { CellRef::new(r.end.row.saturating_add(1), line) }; + writes.push((target, format!("={name}({})", b.line_range(line, lo, hi).a1()))); + } + Func::Percent | Func::Running => { + for i in lo..=hi { + let src = b.cell_at(line, i); + let target = if by_rows { + CellRef::new(src.row.saturating_add(height), src.col) + } else { + CellRef::new(src.row, src.col.saturating_add(width)) + }; + let formula = if func == Func::Percent { + // The summed block is locked on the axis the formula is filled along. + let (a, z) = (b.cell_at(line, lo), b.cell_at(line, hi)); + format!("={}/SUM({}:{})", src.a1(), abs(a, !by_rows, by_rows), abs(z, !by_rows, by_rows)) + } else { + format!("=SUM({}:{})", abs(b.cell_at(line, lo), !by_rows, by_rows), src.a1()) + }; + writes.push((target, formula)); + } + } + } + } + // Everything has to fit on the sheet and may not overwrite data. + if writes.iter().any(|(t, _)| t.row >= MAX_ROWS || t.col >= MAX_COLS) { + return Err(EngineError::Other("There's no room next to the selection for the result.".into())); + } + let sh = s.doc()?.wb.sheet(sheet).ok_or(EngineError::NoDocument)?; + if !overwrite && writes.iter().any(|(t, _)| !sh.value(*t).is_empty() || sh.cells.get(*t).is_some_and(|c| c.formula.is_some())) { + return Err(EngineError::Other("The cells next to the selection already hold data; clear them first.".into())); + } + let out = writes.iter().fold(None::, |acc, (t, _)| Some(acc.map_or(RangeRef::cell(*t), |a| a.union(&RangeRef::cell(*t))))); + let percent = func == Func::Percent; + let count = writes.len(); + edit(s, |cx| { + for (t, f) in &writes { + let cell = super::edit::input_to_cell(f, sheet, *t, &mut cx.wb)?.unwrap_or_default(); + cx.sheet_mut(sheet)?.set_cell(*t, cell); + if percent { + let cur = cx.wb.sheet(sheet).map(|sh| sh.style_id(*t)).unwrap_or_default(); + let new = cx.wb.styles.derive(cur, |st| st.num_fmt = NumFmt::new("0.0%")); + cx.sheet_mut(sheet)?.set_style(*t, new); + } + cx.touch(sheet, *t); + } + Ok(()) + })?; + let name = match func { + Func::Aggregate(n) => n.to_ascii_lowercase(), + Func::Percent => "percentTotal".into(), + Func::Running => "runningTotal".into(), + }; + Ok(json!({"function": name, "direction": if by_rows { "rows" } else { "columns" }, "output": out.map(|o| o.a1()), "cells": count})) +} + +fn add_sparklines(s: &mut Session, p: &Json) -> Result { + let by_rows = match str_param(p, "direction") { + None | Some("rows") => true, + Some("columns") => false, + Some(other) => return Err(bad(SPARK, format!("direction must be rows or columns, not `{other}`"))), + }; + let kind = match str_param(p, "type") { + None | Some("line") => SparklineKind::Line, + Some("column") => SparklineKind::Column, + Some("winLoss") => SparklineKind::WinLoss, + Some(other) => return Err(bad(SPARK, format!("type must be line, column or winLoss, not `{other}`"))), + }; + let markers = bool_param(p, "markers").unwrap_or(false); + let overwrite = bool_param(p, "overwrite").unwrap_or(false); + let b = block(s, p, by_rows)?; + if b.lines.len() as u64 > MAX_SPARKLINES { + return Err(bad(SPARK, "selection too large for this result")); + } + let (lo, hi) = b.span_of_line(); + let r = b.range; + let sparks: Vec<(CellRef, String)> = b + .lines + .iter() + .map(|&line| { + let at = if by_rows { CellRef::new(line, r.end.col.saturating_add(1)) } else { CellRef::new(r.end.row.saturating_add(1), line) }; + (at, b.line_range(line, lo, hi).a1()) + }) + .collect(); + if sparks.iter().any(|(t, _)| t.row >= MAX_ROWS || t.col >= MAX_COLS) { + return Err(EngineError::Other("There's no room next to the selection for the sparklines.".into())); + } + let sheet = b.sheet; + let sh = s.doc()?.wb.sheet(sheet).ok_or(EngineError::NoDocument)?; + if !overwrite && sparks.iter().any(|(t, _)| !sh.value(*t).is_empty() || sh.sparklines.iter().any(|x| x.cell == *t)) { + return Err(EngineError::Other("The cells next to the selection already hold data; clear them first.".into())); + } + let out = sparks.iter().fold(None::, |acc, (t, _)| Some(acc.map_or(RangeRef::cell(*t), |a| a.union(&RangeRef::cell(*t))))); + let count = sparks.len(); + edit(s, |cx| { + let sh = cx.sheet_mut(sheet)?; + for (cell, source) in sparks { + sh.sparklines.retain(|x| x.cell != cell); + sh.sparklines.push(Sparkline { cell, source, kind, color: Color::Theme(4, 0), markers }); + } + Ok(()) + })?; + Ok(json!({"output": out.map(|o| o.a1()), "sparklines": count})) +} diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 33fdc113e0..c348dbaff2 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -2795,3 +2795,74 @@ fn a_decrypted_workbook_never_overwrites_its_encrypted_original() { assert_eq!(std::fs::read(&path).unwrap(), bytes, "the encrypted original is untouched"); std::fs::remove_dir_all(dir).unwrap(); } + +fn quick_analysis_block(s: &mut Session) { + for (a, t) in [("A1", "Item"), ("B1", "Q1"), ("C1", "Q2"), ("A2", "x"), ("A3", "y"), ("A4", "z")] { + s.execute("cell.set", json!({"cell": a, "input": t})).unwrap(); + } + for (r, (q1, q2)) in [(1.0, 10.0), (2.0, 20.0), (3.0, 30.0)].into_iter().enumerate() { + s.execute("cell.set", json!({"cell": format!("B{}", r + 2), "input": q1.to_string()})).unwrap(); + s.execute("cell.set", json!({"cell": format!("C{}", r + 2), "input": q2.to_string()})).unwrap(); + } +} + +#[test] +fn analysis_add_total_writes_formulas_in_one_undo_step() { + // Issue #791 (Quick Analysis › Totals). + let mut s = s(); + quick_analysis_block(&mut s); + let before = s.doc().unwrap().undo.len(); + // The header row and the text-only column are skipped; the selection is the default range. + s.execute("selection.set", json!({"range": "A1:C4"})).unwrap(); + let r = s.execute("analysis.addTotal", json!({"function": "sum"})).unwrap(); + assert_eq!(r["output"], "B5:C5"); + assert_eq!(v(&s, "B5"), Value::Number(6.0)); + assert_eq!(v(&s, "C5"), Value::Number(60.0)); + assert_eq!(v(&s, "A5"), Value::Empty, "text columns get no total"); + s.execute("analysis.addTotal", json!({"range": "B1:C4", "function": "average", "direction": "rows"})).unwrap(); + assert_eq!(v(&s, "D2"), Value::Number(5.5)); + s.execute("analysis.addTotal", json!({"range": "B1:C4", "function": "runningTotal", "overwrite": true})).unwrap(); + assert_eq!(v(&s, "D4"), Value::Number(6.0), "running total down column B"); + assert_eq!(v(&s, "E4"), Value::Number(60.0)); + s.execute("analysis.addTotal", json!({"range": "B1:B4", "function": "percentTotal", "overwrite": true})).unwrap(); + assert_eq!(v(&s, "C4"), Value::Number(0.5), "overwrite replaces the C column cell next to B"); + assert_eq!(s.doc().unwrap().undo.len(), before + 4, "one undo step per call"); + s.execute("edit.undo", json!({})).unwrap(); + assert_eq!(v(&s, "C4"), Value::Number(30.0)); + // A second sum into the occupied row is refused rather than overwriting. + assert!(s.execute("analysis.addTotal", json!({"range": "A1:C4"})).is_err()); +} + +#[test] +fn analysis_add_total_refuses_bad_and_huge_input() { + let mut s = s(); + quick_analysis_block(&mut s); + // Empty params on a single cell, unknown function, no numbers, whole columns, no room. + assert!(s.execute("analysis.addTotal", json!({})).is_err()); + assert!(s.execute("analysis.addTotal", json!({"range": "A1:C4", "function": "median"})).is_err()); + assert!(s.execute("analysis.addTotal", json!({"range": "A1:A4"})).is_err()); + let before = s.doc().unwrap().undo.len(); + let r = s.execute("analysis.addTotal", json!({"range": "B:C"})).unwrap(); + assert_eq!(r["output"], "B5:C5", "whole columns are clipped to the used range"); + assert_eq!(s.doc().unwrap().undo.len(), before + 1); + s.execute("cell.set", json!({"cell": "B1048575", "input": "1"})).unwrap(); + s.execute("cell.set", json!({"cell": "B1048576", "input": "2"})).unwrap(); + assert!(s.execute("analysis.addTotal", json!({"range": "B1048575:C1048576"})).is_err(), "no row below the last one"); + assert!(s.execute("analysis.addTotal", json!({"range": "B1:C1048576", "function": "runningTotal"})).is_err(), "per-cell block over the cap"); +} + +#[test] +fn analysis_add_sparklines_one_per_row_in_one_undo_step() { + let mut s = s(); + quick_analysis_block(&mut s); + let before = s.doc().unwrap().undo.len(); + let r = s.execute("analysis.addSparklines", json!({"range": "A1:C4", "type": "column"})).unwrap(); + assert_eq!(r["output"], "D2:D4", "header row and label column are skipped"); + let sparks = s.doc().unwrap().wb.active().unwrap().sparklines.clone(); + assert_eq!(sparks.len(), 3); + assert!(sparks.iter().any(|x| x.cell == CellRef::parse("D3").unwrap() && x.source == "B3:C3")); + assert_eq!(s.doc().unwrap().undo.len(), before + 1); + s.execute("edit.undo", json!({})).unwrap(); + assert!(s.doc().unwrap().wb.active().unwrap().sparklines.is_empty()); + assert!(s.execute("analysis.addSparklines", json!({"range": "A1:A4"})).is_err()); +} diff --git a/crates/ui-egui/examples/snapshot.rs b/crates/ui-egui/examples/snapshot.rs index a171199a1c..8b8a3bc465 100644 --- a/crates/ui-egui/examples/snapshot.rs +++ b/crates/ui-egui/examples/snapshot.rs @@ -2,7 +2,7 @@ //! //! `cargo run --release -p gridcraft-ui-egui --example snapshot -- [--sample sales] [--in file.xlsx] //! [--size 1440x900] [--scale 2] [--cmd 'id={json}']... [--tab Insert] [--dark] [--language en|zh|ja|ko|ru|pt|cs] -//! [--dialog 'name={json}'] [--hf-edit header|footer] out.png` +//! [--dialog 'name={json}'] [--quick-analysis formatting|charts|totals|tables|sparklines] [--hf-edit header|footer] out.png` use gridcraft_engine::Session; use gridcraft_ui_egui::SheetApp; @@ -22,6 +22,7 @@ fn main() { let mut dialog: Option = None; let mut language: Option = None; let mut hf_edit: Option = None; + let mut quick: Option = None; let mut out = "snapshot.png".to_string(); let mut i = 0; while i < args.len() { @@ -67,6 +68,10 @@ fn main() { i += 1; dialog = args.get(i).cloned(); } + "--quick-analysis" => { + i += 1; + quick = args.get(i).cloned(); + } "--hf-edit" => { i += 1; hf_edit = args.get(i).cloned(); @@ -118,6 +123,19 @@ fn main() { d.split_once('=').map(|(a, b)| (a, serde_json::from_str(b).unwrap_or(json!({})))).unwrap_or((d.as_str(), json!({}))); app.open_dialog(name, p); } + if let Some(name) = &quick { + use gridcraft_ui_egui::quick_analysis::Tab; + app.grid.quick_analysis.tab = match name.as_str() { + "charts" => Tab::Charts, + "totals" => Tab::Totals, + "tables" => Tab::Tables, + "sparklines" => Tab::Sparklines, + _ => Tab::Formatting, + }; + if let Err(e) = gridcraft_ui_egui::quick_analysis::toggle(&mut app, Some(true)) { + eprintln!("quick analysis: {e}"); + } + } // Page Layout view: edit the first page's centre header (or footer) section. let active = app.session.active().and_then(|d| d.wb.active().cloned().map(|s| (d.wb.active_sheet, s))); if let (Some(part), Some((si, sh))) = (&hf_edit, active) { diff --git a/crates/ui-egui/src/grid.rs b/crates/ui-egui/src/grid.rs index d0eef85668..1f9efbad6a 100644 --- a/crates/ui-egui/src/grid.rs +++ b/crates/ui-egui/src/grid.rs @@ -96,6 +96,8 @@ pub struct GridState { /// Page ranges for Page Break Preview, cached per (doc uid, revision, sheet). pub pages: Option<((u64, u64, usize), Vec<(RangeRef, u32)>)>, pub header_menu: Option<(Pos2, bool)>, + /// Quick Analysis button and popup (Ctrl+Q). + pub quick_analysis: crate::quick_analysis::State, /// Page Layout view pagination, cached per (doc uid, revision, sheet, rows, columns). pub paper: Option, /// Header or footer being edited in place (Page Layout view). @@ -624,6 +626,7 @@ pub fn show(app: &mut SheetApp, ui: &mut egui::Ui) { list_picker(app, ui, &geo, previous_popups.1 == app.grid.list_picker); header_menu(app, ui, previous_popups.2 == app.grid.header_menu); context_menu(app, ui); + crate::quick_analysis::show(app, ui, &geo, sh); let track_x = if rtl { (available.left(), rect.left()) } else { (rect.right(), available.right()) }; vertical_scrollbar(app, ui, sh, &geo, track_x, max_y, &t); if app.session.clipboard.is_some() { diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rs index 406cc3dd51..25b4feb01b 100644 --- a/crates/ui-egui/src/i18n.rs +++ b/crates/ui-egui/src/i18n.rs @@ -565,6 +565,30 @@ const JAPANESE: &[(&str, &str)] = &[ ("Workbook calculation", "ブックの計算"), ("Enable iterative calculation", "反復計算を行う"), ("Calculation settings are saved with the workbook.", "計算の設定はブックと共に保存されます。"), + ("Quick Analysis (Ctrl+Q)", "クイック分析 (Ctrl+Q)"), + ("Formatting", "書式設定"), + ("Charts", "グラフ"), + ("Totals", "集計"), + ("Tables", "テーブル"), + ("Color Scale", "カラー スケール"), + ("Icon Set", "アイコン セット"), + ("Greater Than…", "指定の値より大きい…"), + ("Clear Rules", "ルールのクリア"), + ("Clustered Column", "集合縦棒"), + ("Line", "折れ線"), + ("Pie", "円"), + ("Bar", "横棒"), + ("Scatter", "散布図"), + ("Recommended Charts", "おすすめグラフ"), + ("Sum", "合計"), + ("Average", "平均"), + ("Count", "個数"), + ("% Total", "合計に対する割合"), + ("Running Total", "累計"), + ("By Column", "列ごと"), + ("By Row", "行ごと"), + ("Column", "縦棒"), + ("Win/Loss", "勝敗"), ]; #[cfg(test)] diff --git a/crates/ui-egui/src/i18n/cs.rs b/crates/ui-egui/src/i18n/cs.rs index ca2e559428..fadf40d50a 100644 --- a/crates/ui-egui/src/i18n/cs.rs +++ b/crates/ui-egui/src/i18n/cs.rs @@ -391,6 +391,30 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "More\nFunctions" => "Další\nfunkce", "Sheet Options|View" => "Zobrazit", "Print" => "Tisknout", + "Quick Analysis (Ctrl+Q)" => "Rychlá analýza (Ctrl+Q)", + "Formatting" => "Formátování", + "Charts" => "Grafy", + "Totals" => "Součty", + "Tables" => "Tabulky", + "Color Scale" => "Barevná škála", + "Icon Set" => "Sada ikon", + "Greater Than…" => "Větší než…", + "Clear Rules" => "Vymazat pravidla", + "Clustered Column" => "Skupinový sloupcový", + "Line" => "Spojnicový", + "Pie" => "Výsečový", + "Bar" => "Pruhový", + "Scatter" => "Bodový", + "Recommended Charts" => "Doporučené grafy", + "Sum" => "Součet", + "Average" => "Průměr", + "Count" => "Počet", + "% Total" => "% z celku", + "Running Total" => "Průběžný součet", + "By Column" => "Podle sloupců", + "By Row" => "Podle řádků", + "Column" => "Sloupec", + "Win/Loss" => "Zisk/ztráta", _ => return None, }) } diff --git a/crates/ui-egui/src/i18n/de.rs b/crates/ui-egui/src/i18n/de.rs index 2ad37f675f..2fc143105b 100644 --- a/crates/ui-egui/src/i18n/de.rs +++ b/crates/ui-egui/src/i18n/de.rs @@ -394,6 +394,30 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "Dark" => "Dunkel", "Sheet Options|View" => "Anzeige", "Print" => "Drucken", + "Quick Analysis (Ctrl+Q)" => "Schnellanalyse (Strg+Q)", + "Formatting" => "Formatierung", + "Charts" => "Diagramme", + "Totals" => "Ergebnisse", + "Tables" => "Tabellen", + "Color Scale" => "Farbskala", + "Icon Set" => "Symbolsatz", + "Greater Than…" => "Größer als…", + "Clear Rules" => "Regeln löschen", + "Clustered Column" => "Gruppierte Säulen", + "Line" => "Linie", + "Pie" => "Kreis", + "Bar" => "Balken", + "Scatter" => "Punkt (XY)", + "Recommended Charts" => "Empfohlene Diagramme", + "Sum" => "Summe", + "Average" => "Mittelwert", + "Count" => "Anzahl", + "% Total" => "% des Gesamtergebnisses", + "Running Total" => "Laufende Summe", + "By Column" => "Nach Spalte", + "By Row" => "Nach Zeile", + "Column" => "Säule", + "Win/Loss" => "Gewinn/Verlust", _ => return None, }) } diff --git a/crates/ui-egui/src/i18n/es.rs b/crates/ui-egui/src/i18n/es.rs index da41bd7113..faad158341 100644 --- a/crates/ui-egui/src/i18n/es.rs +++ b/crates/ui-egui/src/i18n/es.rs @@ -393,6 +393,30 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "Dark" => "Oscuro", "Sheet Options|View" => "Ver", "Print" => "Imprimir", + "Quick Analysis (Ctrl+Q)" => "Análisis rápido (Ctrl+Q)", + "Formatting" => "Formato", + "Charts" => "Gráficos", + "Totals" => "Totales", + "Tables" => "Tablas", + "Color Scale" => "Escala de color", + "Icon Set" => "Conjunto de iconos", + "Greater Than…" => "Mayor que…", + "Clear Rules" => "Borrar reglas", + "Clustered Column" => "Columna agrupada", + "Line" => "Línea", + "Pie" => "Circular", + "Bar" => "Barras", + "Scatter" => "Dispersión", + "Recommended Charts" => "Gráficos recomendados", + "Sum" => "Suma", + "Average" => "Promedio", + "Count" => "Recuento", + "% Total" => "% del total", + "Running Total" => "Total acumulado", + "By Column" => "Por columna", + "By Row" => "Por fila", + "Column" => "Columna", + "Win/Loss" => "Ganancia/pérdida", _ => return None, }) } diff --git a/crates/ui-egui/src/i18n/fr.rs b/crates/ui-egui/src/i18n/fr.rs index 7bf9fd100d..04dd35b973 100644 --- a/crates/ui-egui/src/i18n/fr.rs +++ b/crates/ui-egui/src/i18n/fr.rs @@ -383,6 +383,30 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "Workbook calculation" => "Calcul du classeur", "Enable iterative calculation" => "Classeur Excel (*.xlsx)", "Calculation settings are saved with the workbook." => "Modifier le type de fichier", + "Quick Analysis (Ctrl+Q)" => "Analyse rapide (Ctrl+Q)", + "Formatting" => "Mise en forme", + "Charts" => "Graphiques", + "Totals" => "Totaux", + "Tables" => "Tableaux", + "Color Scale" => "Échelle de couleurs", + "Icon Set" => "Jeu d'icônes", + "Greater Than…" => "Supérieur à…", + "Clear Rules" => "Effacer les règles", + "Clustered Column" => "Histogramme groupé", + "Line" => "Courbe", + "Pie" => "Secteurs", + "Bar" => "Barres", + "Scatter" => "Nuage de points", + "Recommended Charts" => "Graphiques recommandés", + "Sum" => "Somme", + "Average" => "Moyenne", + "Count" => "Nombre", + "% Total" => "% du total", + "Running Total" => "Total cumulé", + "By Column" => "Par colonne", + "By Row" => "Par ligne", + "Column" => "Colonne", + "Win/Loss" => "Gain/perte", _ => return None, }) } diff --git a/crates/ui-egui/src/i18n/ko.rs b/crates/ui-egui/src/i18n/ko.rs index b684c78868..480e1fa417 100644 --- a/crates/ui-egui/src/i18n/ko.rs +++ b/crates/ui-egui/src/i18n/ko.rs @@ -393,6 +393,30 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "Workbook calculation" => "통합 문서 계산", "Enable iterative calculation" => "반복 계산 사용", "Calculation settings are saved with the workbook." => "계산 설정은 통합 문서와 함께 저장됩니다.", + "Quick Analysis (Ctrl+Q)" => "빠른 분석 (Ctrl+Q)", + "Formatting" => "서식", + "Charts" => "차트", + "Totals" => "합계", + "Tables" => "표", + "Color Scale" => "색 구성표", + "Icon Set" => "아이콘 집합", + "Greater Than…" => "보다 큼…", + "Clear Rules" => "규칙 지우기", + "Clustered Column" => "묶은 세로 막대형", + "Line" => "꺾은선형", + "Pie" => "원형", + "Bar" => "가로 막대형", + "Scatter" => "분산형", + "Recommended Charts" => "추천 차트", + "Sum" => "합계", + "Average" => "평균", + "Count" => "개수", + "% Total" => "총합계 비율", + "Running Total" => "누계", + "By Column" => "열 기준", + "By Row" => "행 기준", + "Column" => "열", + "Win/Loss" => "이익/손실", _ => return None, }) } diff --git a/crates/ui-egui/src/i18n/pt.rs b/crates/ui-egui/src/i18n/pt.rs index b554ef9776..8395b82238 100644 --- a/crates/ui-egui/src/i18n/pt.rs +++ b/crates/ui-egui/src/i18n/pt.rs @@ -394,6 +394,30 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "Workbook calculation" => "Cálculo da pasta de trabalho", "Enable iterative calculation" => "Habilitar cálculo iterativo", "Calculation settings are saved with the workbook." => "As configurações de cálculo são salvas com a pasta de trabalho.", + "Quick Analysis (Ctrl+Q)" => "Análise rápida (Ctrl+Q)", + "Formatting" => "Formatação", + "Charts" => "Gráficos", + "Totals" => "Totais", + "Tables" => "Tabelas", + "Color Scale" => "Escala de cor", + "Icon Set" => "Conjunto de ícones", + "Greater Than…" => "Maior que…", + "Clear Rules" => "Limpar regras", + "Clustered Column" => "Colunas agrupadas", + "Line" => "Linha", + "Pie" => "Pizza", + "Bar" => "Barras", + "Scatter" => "Dispersão", + "Recommended Charts" => "Gráficos recomendados", + "Sum" => "Soma", + "Average" => "Média", + "Count" => "Contagem", + "% Total" => "% do total", + "Running Total" => "Total acumulado", + "By Column" => "Por coluna", + "By Row" => "Por linha", + "Column" => "Coluna", + "Win/Loss" => "Ganho/perda", _ => return None, }) } diff --git a/crates/ui-egui/src/i18n/ru.rs b/crates/ui-egui/src/i18n/ru.rs index c8f0445d8c..e6273c486b 100644 --- a/crates/ui-egui/src/i18n/ru.rs +++ b/crates/ui-egui/src/i18n/ru.rs @@ -393,6 +393,30 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "Workbook calculation" => "Вычисления в книге", "Enable iterative calculation" => "Включить итеративные вычисления", "Calculation settings are saved with the workbook." => "Параметры вычислений сохраняются вместе с книгой.", + "Quick Analysis (Ctrl+Q)" => "Быстрый анализ (Ctrl+Q)", + "Formatting" => "Форматирование", + "Charts" => "Диаграммы", + "Totals" => "Итоги", + "Tables" => "Таблицы", + "Color Scale" => "Цветовая шкала", + "Icon Set" => "Набор значков", + "Greater Than…" => "Больше…", + "Clear Rules" => "Удалить правила", + "Clustered Column" => "Гистограмма с группировкой", + "Line" => "График", + "Pie" => "Круговая", + "Bar" => "Линейчатая", + "Scatter" => "Точечная", + "Recommended Charts" => "Рекомендуемые диаграммы", + "Sum" => "Сумма", + "Average" => "Среднее", + "Count" => "Количество", + "% Total" => "% от итога", + "Running Total" => "Нарастающий итог", + "By Column" => "По столбцам", + "By Row" => "По строкам", + "Column" => "Столбец", + "Win/Loss" => "Выигрыш/проигрыш", _ => return None, }) } diff --git a/crates/ui-egui/src/i18n/zh.rs b/crates/ui-egui/src/i18n/zh.rs index d1cf704cba..440962086e 100644 --- a/crates/ui-egui/src/i18n/zh.rs +++ b/crates/ui-egui/src/i18n/zh.rs @@ -385,6 +385,30 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "Workbook calculation" => "工作簿计算", "Enable iterative calculation" => "启用迭代计算", "Calculation settings are saved with the workbook." => "计算设置随工作簿一起保存。", + "Quick Analysis (Ctrl+Q)" => "快速分析 (Ctrl+Q)", + "Formatting" => "格式化", + "Charts" => "图表", + "Totals" => "汇总", + "Tables" => "表", + "Color Scale" => "色阶", + "Icon Set" => "图标集", + "Greater Than…" => "大于…", + "Clear Rules" => "清除规则", + "Clustered Column" => "簇状柱形图", + "Line" => "折线图", + "Pie" => "饼图", + "Bar" => "条形图", + "Scatter" => "散点图", + "Recommended Charts" => "推荐的图表", + "Sum" => "求和", + "Average" => "平均值", + "Count" => "计数", + "% Total" => "占总计的百分比", + "Running Total" => "累计", + "By Column" => "按列", + "By Row" => "按行", + "Column" => "柱形", + "Win/Loss" => "盈亏", _ => return None, }) } diff --git a/crates/ui-egui/src/icons.rs b/crates/ui-egui/src/icons.rs index fe9f7bf51d..2d14cc031a 100644 --- a/crates/ui-egui/src/icons.rs +++ b/crates/ui-egui/src/icons.rs @@ -129,6 +129,8 @@ pub enum Icon { OpenFolder, Info, Print, + /// Quick Analysis: a small table with a spark. + QuickAnalysis, } struct G<'a> { @@ -706,6 +708,13 @@ pub fn paint(p: &Painter, rect: Rect, icon: Icon, c: Color32) { g.line(&[(4.5, 9.0), (4.5, 14.5), (11.5, 14.5), (11.5, 9.0), (4.5, 9.0)], c, 1.1); g.circle(12.3, 7.6, 0.6, Some(c), None); } + Icon::QuickAnalysis => { + g.rect(2.0, 3.0, 12.0, 10.0, None, Some(c)); + g.stroke(&[(2.0, 6.5), (14.0, 6.5)], light); + g.stroke(&[(6.0, 3.0), (6.0, 13.0)], light); + g.stroke(&[(10.0, 3.0), (10.0, 13.0)], light); + g.line(&[(10.0, 1.0), (6.5, 8.0), (9.5, 8.0), (6.5, 15.0)], BLUE, 1.7); + } } } diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 0b19b2551d..c154945210 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -27,6 +27,7 @@ pub mod panes; pub mod paper_view; pub mod pivot_pane; pub mod printing; +pub mod quick_analysis; pub mod ribbon; pub mod selection_glide; pub mod tabs; @@ -531,6 +532,7 @@ impl SheetApp { self.ui.language = i18n::Language::Ja; Ok(json!({"language": i18n::Language::Ja})) } + "ui.quickAnalysis" => quick_analysis::toggle(self, p.get("open").and_then(Json::as_bool)), "ui.backstage" => { // `{"page": "info"}` opens File › Info; `{"page": "close"}` returns to the sheet. match p.get("page").and_then(Json::as_str).map(str::trim) { diff --git a/crates/ui-egui/src/quick_analysis.rs b/crates/ui-egui/src/quick_analysis.rs new file mode 100644 index 0000000000..7bfa454d95 --- /dev/null +++ b/crates/ui-egui/src/quick_analysis.rs @@ -0,0 +1,364 @@ +//! Quick Analysis (Ctrl+Q): a small button at the bottom-right corner of a multi-cell selection +//! that opens a popup of one-click analyses. The popup is a thin front end: every tile runs an +//! engine command through `app.run` (conditional formats, charts, `analysis.addTotal`, tables, +//! pivot tables, `analysis.addSparklines`), so nothing here is UI-only logic worth testing apart +//! from which command a tile maps to ([`tiles`]). + +use egui::{Align2, Id, Order, Rect, Sense, Stroke, StrokeKind, Ui, pos2, vec2}; +use gridcraft_engine::core::RangeRef; +use gridcraft_engine::model::Sheet; +use serde_json::{Value as Json, json}; + +use crate::SheetApp; +use crate::grid::{Drag, Geo}; +use crate::icons::{self, Icon}; +use crate::theme::{self, Tokens}; + +/// Side of the corner button, and its gap to the selection's corner (clear of the fill handle). +const BUTTON: f32 = 22.0; +const GAP: f32 = 6.0; +const TILE: egui::Vec2 = vec2(66.0, 62.0); + +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub enum Tab { + #[default] + Formatting, + Charts, + Totals, + Tables, + Sparklines, +} + +impl Tab { + const ALL: [Tab; 5] = [Tab::Formatting, Tab::Charts, Tab::Totals, Tab::Tables, Tab::Sparklines]; + fn label(self) -> &'static str { + match self { + Tab::Formatting => "Formatting", + Tab::Charts => "Charts", + Tab::Totals => "Totals", + Tab::Tables => "Tables", + Tab::Sparklines => "Sparklines", + } + } +} + +#[derive(Default)] +pub struct State { + /// The selection the popup was opened for; it closes when the selection changes. + pub open: Option, + pub tab: Tab, + /// Totals by row (results to the right) instead of by column (results below). + pub by_rows: bool, +} + +/// What a tile does. +#[derive(Clone, Debug, PartialEq)] +pub enum Action { + Run(&'static str, Json), + Dialog(&'static str, Json), +} + +#[derive(Clone, Copy, Debug, PartialEq)] +enum Glyph { + Icon(Icon), + Text(&'static str), + Bars, + Scale, + Dots, + Steps, + MiniColumns, + WinLoss, +} + +#[derive(Clone, Debug, PartialEq)] +pub struct Tile { + label: &'static str, + glyph: Glyph, + pub action: Action, +} + +fn tile(label: &'static str, glyph: Glyph, action: Action) -> Tile { + Tile { label, glyph, action } +} + +/// The tiles of a tab for the selection `range` (A1 text) on the sheet called `sheet_name`. +pub fn tiles(tab: Tab, range: &str, sheet_name: &str, by_rows: bool) -> Vec { + use Action::{Dialog, Run}; + let cf = |rule: Json| Run("home.conditionalFormat", json!({"range": range, "rule": rule})); + let chart = |kind: &str| Run("insert.chart", json!({"range": range, "type": kind})); + let total = |f: &str| Run("analysis.addTotal", json!({"range": range, "function": f, "direction": if by_rows { "rows" } else { "columns" }})); + let spark = |kind: &str| Run("analysis.addSparklines", json!({"range": range, "type": kind})); + match tab { + Tab::Formatting => vec![ + tile("Data Bars", Glyph::Bars, cf(json!({"type": "dataBar"}))), + tile("Color Scale", Glyph::Scale, cf(json!({"type": "colorScale"}))), + tile("Icon Set", Glyph::Dots, cf(json!({"type": "iconSet"}))), + tile("Greater Than…", Glyph::Text(">"), Dialog("cfQuick", json!({"type": "cellIs", "operator": "greater", "title": "Greater Than…"}))), + tile("Top 10 Items", Glyph::Text("10"), cf(json!({"type": "top10", "rank": 10}))), + tile("Clear Rules", Glyph::Icon(Icon::Eraser), Run("home.clearRules", json!({"range": range}))), + ], + Tab::Charts => vec![ + tile("Clustered Column", Glyph::Icon(Icon::ChartBar), chart("column")), + tile("Line", Glyph::Icon(Icon::ChartLine), chart("line")), + tile("Pie", Glyph::Icon(Icon::ChartPie), chart("pie")), + tile("Bar", Glyph::Icon(Icon::Chart), chart("bar")), + tile("Scatter", Glyph::Icon(Icon::ChartScatter), chart("scatter")), + tile("Recommended Charts", Glyph::Icon(Icon::Chart), Run("insert.recommendedCharts", json!({"range": range}))), + ], + Tab::Totals => vec![ + tile("Sum", Glyph::Icon(Icon::Sum), total("sum")), + tile("Average", Glyph::Text("avg"), total("average")), + tile("Count", Glyph::Text("#"), total("count")), + tile("% Total", Glyph::Icon(Icon::Percent), total("percentTotal")), + tile("Running Total", Glyph::Steps, total("runningTotal")), + ], + Tab::Tables => vec![ + tile("Table", Glyph::Icon(Icon::Table), Run("insert.table", json!({"range": range}))), + tile( + "PivotTable", + Glyph::Icon(Icon::PivotTable), + Run("insert.pivotTable", json!({"source": format!("'{}'!{range}", sheet_name.replace('\'', "''"))})), + ), + ], + Tab::Sparklines => vec![ + tile("Line", Glyph::Icon(Icon::Sparkline), spark("line")), + tile("Column", Glyph::MiniColumns, spark("column")), + tile("Win/Loss", Glyph::WinLoss, spark("winLoss")), + ], + } +} + +/// Ctrl+Q and the `ui.quickAnalysis` command: opens the popup for the selection (or closes it). +/// Errors for a single cell, where there is nothing to analyse. +pub fn toggle(app: &mut SheetApp, on: Option) -> Result { + let sel = app.session.active().map(|d| d.selection.current()).ok_or("no workbook open")?; + let want = on.unwrap_or(app.grid.quick_analysis.open.is_none()); + if !want { + app.grid.quick_analysis.open = None; + } else if sel.is_single() { + return Err("Select at least two cells to use Quick Analysis.".into()); + } else { + app.grid.quick_analysis.open = Some(sel); + } + Ok(json!({"open": app.grid.quick_analysis.open.is_some()})) +} + +/// Paints the corner button and, when open, the popup. Called once per grid frame. +pub fn show(app: &mut SheetApp, ui: &mut Ui, geo: &Geo, sh: &Sheet) { + let Some(d) = app.session.active() else { return }; + let sel = d.selection.current(); + let hidden = sel.is_single() + || app.editor.is_some() + || app.dialog.is_some() + || app.text_box_editor.is_some() + || app.grid.context_menu.is_some() + || geo.paper.is_some(); + // The popup belongs to one selection; a new one (or editing) closes it. + if hidden || app.grid.quick_analysis.open.is_some_and(|r| r != sel) { + app.grid.quick_analysis.open = None; + } + if hidden { + return; + } + let sheet_name = sh.name.clone(); + let ctx = ui.ctx().clone(); + let t = Tokens::get(&ctx); + let rect = geo.range_rect(sh, sel); + let corner = rect.right_bottom(); + let panes = geo.range_panes(RangeRef::cell(sel.end)); + let corner_visible = panes.iter().any(|p| p.contains(pos2(corner.x - 1.0, corner.y - 1.0))); + // Below and right of the corner (clear of the fill handle); flipped inside when at an edge. + let area = geo.cells.shrink(2.0); + let x = if corner.x + GAP + BUTTON > area.right() { corner.x - GAP - BUTTON } else { corner.x + GAP }; + let y = if corner.y + GAP + BUTTON > area.bottom() { corner.y - GAP - BUTTON } else { corner.y + GAP }; + let button = geo.mirror_rect(Rect::from_min_size( + pos2(x.clamp(area.left(), (area.right() - BUTTON).max(area.left())), y.clamp(area.top(), (area.bottom() - BUTTON).max(area.top()))), + vec2(BUTTON, BUTTON), + )); + let open = app.grid.quick_analysis.open.is_some(); + // While the mouse is down (selecting, filling) the button stays out of the way. + let busy = app.grid.drag != Drag::None || ctx.input(|i| i.pointer.any_down()); + let lang = crate::i18n::current(&ctx); + if corner_visible && (open || !busy) { + let mut clicked = false; + egui::Area::new(Id::new("quick_analysis_button")).fixed_pos(button.min).order(Order::Foreground).show(&ctx, |ui| { + let (r, resp) = ui.allocate_exact_size(button.size(), Sense::click()); + let fill = if resp.is_pointer_button_down_on() || open { + t.pressed + } else if resp.hovered() { + t.hover + } else { + t.menu_bg + }; + ui.painter().rect_filled(r, 4.0, fill); + ui.painter().rect_stroke(r, 4.0, Stroke::new(1.0, t.separator), StrokeKind::Inside); + icons::paint(ui.painter(), Rect::from_center_size(r.center(), vec2(16.0, 16.0)), Icon::QuickAnalysis, t.accent); + clicked = resp.on_hover_text(lang.tr("Quick Analysis (Ctrl+Q)")).clicked(); + }); + if clicked { + let _ = toggle(app, None); + } + } + let Some(opened_for) = app.grid.quick_analysis.open else { return }; + let pos = pos2(button.left(), button.bottom() + 4.0); + let mut picked: Option = None; + let resp = egui::Area::new(Id::new("quick_analysis_popup")).fixed_pos(pos).order(Order::Foreground).constrain(true).show(&ctx, |ui| { + egui::Frame::popup(ui.style()).show(ui, |ui| { + let state = &mut app.grid.quick_analysis; + ui.horizontal(|ui| { + for tab in Tab::ALL { + if ui.selectable_label(state.tab == tab, lang.tr(tab.label())).clicked() { + state.tab = tab; + } + } + }); + ui.separator(); + if state.tab == Tab::Totals { + ui.horizontal(|ui| { + ui.selectable_value(&mut state.by_rows, false, lang.tr("By Column")); + ui.selectable_value(&mut state.by_rows, true, lang.tr("By Row")); + }); + } + ui.horizontal(|ui| { + ui.spacing_mut().item_spacing.x = 2.0; + for item in tiles(state.tab, &opened_for.a1(), &sheet_name, state.by_rows) { + if paint_tile(ui, &t, &item, lang.tr(item.label)) { + picked = Some(item.action.clone()); + } + } + }); + }); + }); + let outside_click = ctx.input(|i| i.pointer.any_pressed()) + && ctx.input(|i| i.pointer.interact_pos()).is_some_and(|p| !resp.response.rect.contains(p) && !button.contains(p)); + if let Some(action) = picked { + app.grid.quick_analysis.open = None; + match action { + Action::Run(id, params) => app.run_or_alert(id, params), + Action::Dialog(name, params) => app.open_dialog(name, params), + } + } else if outside_click || ctx.input(|i| i.key_pressed(egui::Key::Escape)) { + app.grid.quick_analysis.open = None; + } +} + +/// One option of the popup: a small picture over a wrapped label. True when clicked. +fn paint_tile(ui: &mut Ui, t: &Tokens, item: &Tile, label: &str) -> bool { + let (rect, resp) = ui.allocate_exact_size(TILE, Sense::click()); + if resp.is_pointer_button_down_on() { + ui.painter().rect_filled(rect, 4.0, t.pressed); + } else if resp.hovered() { + ui.painter().rect_filled(rect, 4.0, t.hover); + } + let art = Rect::from_center_size(pos2(rect.center().x, rect.top() + 18.0), vec2(26.0, 26.0)); + paint_glyph(ui, t, item.glyph, art); + let galley = ui.painter().layout(label.to_string(), theme::ui_font(11.0), t.text, TILE.x - 4.0); + let at = pos2(rect.center().x - galley.size().x / 2.0, rect.top() + 34.0); + ui.painter().galley(at, galley, t.text); + resp.clicked() +} + +fn paint_glyph(ui: &Ui, t: &Tokens, glyph: Glyph, r: Rect) { + let p = ui.painter(); + let (green, blue, red, yellow) = (icons::GREEN, icons::BLUE, icons::RED, icons::YELLOW); + let cell = |i: f32, j: f32| Rect::from_min_size(r.min + vec2(i * r.width() / 3.0, j * r.height() / 3.0), vec2(r.width() / 3.0, r.height() / 3.0)); + match glyph { + Glyph::Icon(icon) => icons::paint(p, r, icon, t.text), + Glyph::Text(s) => { + p.text(r.center(), Align2::CENTER_CENTER, s, theme::ui_bold(15.0), t.accent); + } + Glyph::Bars => { + for (j, w) in [0.9, 0.55, 0.3].into_iter().enumerate() { + let row = cell(0.0, j as f32).shrink2(vec2(0.0, 1.0)); + p.rect_filled(Rect::from_min_size(row.min, vec2(r.width() * w, row.height())), 1.0, blue); + } + } + Glyph::Scale => { + for (i, c) in [red, yellow, green].into_iter().enumerate() { + p.rect_filled(cell(i as f32, 1.0).shrink(0.5), 1.0, c); + } + } + Glyph::Dots => { + for (j, c) in [green, yellow, red].into_iter().enumerate() { + p.circle_filled(cell(1.0, j as f32).center(), 3.2, c); + } + } + Glyph::Steps => { + for i in 0..3 { + let h = r.height() * (0.35 + 0.28 * i as f32); + p.rect_filled( + Rect::from_min_max( + pos2(r.left() + i as f32 * r.width() / 3.0 + 1.0, r.bottom() - h), + pos2(r.left() + (i + 1) as f32 * r.width() / 3.0 - 1.0, r.bottom()), + ), + 1.0, + green, + ); + } + } + Glyph::MiniColumns => { + for (i, h) in [0.5, 0.9, 0.65].into_iter().enumerate() { + let x = r.left() + i as f32 * r.width() / 3.0 + 2.0; + p.rect_filled(Rect::from_min_max(pos2(x, r.bottom() - r.height() * h), pos2(x + r.width() / 3.0 - 4.0, r.bottom())), 1.0, blue); + } + } + Glyph::WinLoss => { + let mid = r.center().y; + for (i, up) in [true, false, true].into_iter().enumerate() { + let x = r.left() + i as f32 * r.width() / 3.0 + 2.0; + let (a, b) = if up { (mid - 7.0, mid - 1.0) } else { (mid + 1.0, mid + 7.0) }; + p.rect_filled(Rect::from_min_max(pos2(x, a), pos2(x + r.width() / 3.0 - 4.0, b)), 1.0, if up { green } else { red }); + } + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use gridcraft_engine::Session; + + /// A header row, a label column and two numeric columns on Sheet1. + fn session() -> (Session, String) { + let mut s = Session::new(); + s.new_workbook(); + for (a, v) in [("A1", "Item"), ("B1", "Q1"), ("C1", "Q2"), ("A2", "x"), ("A3", "y"), ("A4", "z")] { + s.execute("cell.set", json!({"cell": a, "input": v})).unwrap(); + } + for (r, (q1, q2)) in [(1, 10), (2, 20), (3, 30)].into_iter().enumerate() { + s.execute("cell.set", json!({"cell": format!("B{}", r + 2), "input": q1.to_string()})).unwrap(); + s.execute("cell.set", json!({"cell": format!("C{}", r + 2), "input": q2.to_string()})).unwrap(); + } + let name = s.doc().unwrap().wb.active().unwrap().name.clone(); + (s, name) + } + + #[test] + fn every_engine_tile_runs_on_a_selection() { + for tab in Tab::ALL { + for by_rows in [false, true] { + let n = tiles(tab, "A1:C4", "Sheet1", by_rows).len(); + for i in 0..n { + let (mut s, name) = session(); + let item = tiles(tab, "A1:C4", &name, by_rows).remove(i); + if let Action::Run(id, params) = &item.action { + s.execute(id, params.clone()).unwrap_or_else(|e| panic!("{} / {}: {e}", tab.label(), item.label)); + } + } + } + } + } + + #[test] + fn dialog_tile_and_single_cell_are_not_engine_runs() { + let formatting = tiles(Tab::Formatting, "A1:C4", "Sheet1", false); + assert!(formatting.iter().any(|t| matches!(&t.action, Action::Dialog("cfQuick", _)))); + // A programmatic open on a single cell is an error, not a popup. + let (s, _) = session(); + let mut app = SheetApp::new(s, Default::default()); + assert!(toggle(&mut app, Some(true)).is_err()); + app.run("selection.set", json!({"range": "A1:C4"})).unwrap(); + assert_eq!(toggle(&mut app, Some(true)).unwrap(), json!({"open": true})); + assert_eq!(app.run("ui.quickAnalysis", json!({"open": false})).unwrap(), json!({"open": false})); + } +} diff --git a/crates/ui-egui/src/ribbon.rs b/crates/ui-egui/src/ribbon.rs index e8291accdc..b8054f9a0f 100644 --- a/crates/ui-egui/src/ribbon.rs +++ b/crates/ui-egui/src/ribbon.rs @@ -2429,6 +2429,11 @@ pub fn shortcut(app: &mut SheetApp, key: Key, m: Modifiers) { Key::T if shift => Some(("formulas.autoSum", json!({}))), Key::T => Some(("insert.table", json!({}))), Key::E => Some(("edit.flashFill", json!({}))), + Key::Q => { + // Quick Analysis; a single cell has nothing to analyse, which is not worth an alert. + let _ = crate::quick_analysis::toggle(app, None); + None + } Key::Num1 => { app.open_dialog("formatCells", json!({})); None diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 10abcbccc2..50048c09ea 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-11 · **Change:** minor (AutoFit reserves filter dropdown space, observed against Windows Excel) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-12 · **Change:** minor (Quick Analysis, Ctrl+Q) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4 Interaction, controls and feel, against Excel. Part of [target-app-parity.md](target-app-parity.md). **UI/UX fidelity: ~55% ready, 50–80 h** (estimated). Ribbon command coverage is measured @@ -58,7 +58,7 @@ this logic, with one undo step. | Context menu on cells | 16 items (Cut, Copy, Paste, Paste Special, Insert, Delete, Clear Contents, Filter by value, Sort, New Comment, New Note, Format Cells, Pick From Drop-down List, Define Name, Link). Insert Copied Cells (Insert Cut Cells for whole rows/columns) while the clipboard holds a copy (#21). Missing: Insert Cut Cells for a cell block, paste-option icons, Quick Analysis, Get Data from Table, Show Changes, Smart Lookup | | Move and resize charts, pictures and shapes | charts can't be resized (#190) | | Context menus on row/column headers, sheet tabs, charts, shapes | headers and tabs done; objects partial | -| Quick Analysis (Ctrl+Q) | missing | +| Quick Analysis (Ctrl+Q) | done (#791): button at the selection's bottom-right corner (hidden while editing or dragging) and Ctrl+Q open a popup with Formatting (data bars, colour scale, icon set, greater than, top 10, clear), Charts, Totals (`analysis.addTotal`: sum, average, count, % total, running total, by column or row), Tables (table, PivotTable) and Sparklines (`analysis.addSparklines`); every tile is an engine command. Missing: hover preview, Quick Analysis for non-contiguous selections, Excel's exact tile set | | Smooth scrolling, scrollbars | done; vertical scrollbar added 10-09 (#73); horizontal scrollbar reported missing (#176) | | Text overflow into empty neighbours, wrap, rotation, shrink to fit | done | @@ -123,7 +123,8 @@ otherwise. Number-format and border keys match the physical key (Ctrl+Shift+4, w | F5, Shift+F5 (Mac), F7, Shift+F9, Ctrl+Alt+F9, F12, Ctrl+F4 | same | Go To, Find, Spelling, calculate sheet / all, Save As, close | **added** | | Shift+F10, Alt+Shift+F10, Ctrl+F1 | Shift+F10, Cmd+Option+R | context menu, Error Checking, ribbon | **added** | | F1, F3, F4 (repeat), F6 / Shift+F6, F8 / Shift+F8, F11, End mode | same | help, Paste Name, Repeat, pane cycling, extend/add mode, chart sheet | missing (no such feature yet) | -| Ctrl+6, Ctrl+8, Ctrl+Q, Ctrl+Shift+A, Ctrl+A after a function name, Ctrl+Shift+U, Ctrl+Alt+P | same | objects, outline symbols, Quick Analysis, argument names, Function Arguments, formula bar height, tooltips | missing | +| Ctrl+Q | Ctrl+Q | Quick Analysis | **added** (#791) | +| Ctrl+6, Ctrl+8, Ctrl+Shift+A, Ctrl+A after a function name, Ctrl+Shift+U, Ctrl+Alt+P | same | objects, outline symbols, argument names, Function Arguments, formula bar height, tooltips | missing | | Ctrl+Shift+Page Up / Down, Ctrl+Alt+5, Ctrl+Shift+F1, Ctrl+F5–F10, Alt+F8 / F11 / F12 | same | group sheets, shape cycling, full screen, window keys, macros, VBA, Power Query | missing | | — | Cmd+= (calculate), Cmd+T (references while editing; F4 works), Shift+F7, Cmd+Shift+L | Mac-only extras | missing (Cmd+= is egui's zoom key; no thesaurus or Modify Cell Style) | @@ -152,7 +153,7 @@ by rule and will never match Office's, by design. ## Work (50–80 h) -Key tips 3–5 · remaining shortcuts with their features 2–4 · context menus and Quick Analysis 5–8 · Page Layout view +Key tips 3–5 · remaining shortcuts with their features 2–4 · context menus 3–5 · Page Layout view 8–12 · Options dialog and ribbon/QAT customization 6–10 · accessibility 12–18 · selection and scrollbar bugs 2–4 · pixel/feel pass against observed Excel 7–12. @@ -160,6 +161,7 @@ scrollbar bugs 2–4 · pixel/feel pass against observed Excel 7–12. | Date | Change | Summary | |---|---|---| +| 2026-10-12 | minor | Quick Analysis (Ctrl+Q): corner button and popup with formatting, charts, totals, tables and sparklines; new commands `analysis.addTotal` and `analysis.addSparklines` (#791) | | 2026-10-11 | minor | AutoFit accounts for table and ordinary filter dropdowns, including low zoom; header text excludes the button area | | 2026-10-11 | minor | Outline band for grouped rows and columns, Show / Hide Detail on the Data tab, numpad navigation keys in shortcuts (#373) | | 2026-10-11 | minor | Shift+Space / Ctrl+Space no longer start an edit; Control+Space selects the column on Mac (#338) | From a7e1a4a99bdda6698dbdff64a9876498246c355a Mon Sep 17 00:00:00 2001 From: vangel76 Date: Mon, 12 Oct 2026 21:05:29 +0200 Subject: [PATCH 02/94] Quick Analysis: button tests, several-areas refusal, more formatting tiles (#791) Co-Authored-By: Claude Sonnet 5.5 --- crates/ui-egui/src/i18n.rs | 4 + crates/ui-egui/src/i18n/cs.rs | 4 + crates/ui-egui/src/i18n/de.rs | 4 + crates/ui-egui/src/i18n/es.rs | 4 + crates/ui-egui/src/i18n/fr.rs | 4 + crates/ui-egui/src/i18n/ko.rs | 4 + crates/ui-egui/src/i18n/pt.rs | 4 + crates/ui-egui/src/i18n/ru.rs | 4 + crates/ui-egui/src/i18n/zh.rs | 4 + crates/ui-egui/src/quick_analysis.rs | 99 ++++++++++++++----- crates/ui-egui/src/ribbon.rs | 9 +- crates/ui-egui/tests/quick_analysis_button.rs | 84 ++++++++++++++++ 12 files changed, 199 insertions(+), 29 deletions(-) create mode 100644 crates/ui-egui/tests/quick_analysis_button.rs diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rs index 25b4feb01b..3df27f8a75 100644 --- a/crates/ui-egui/src/i18n.rs +++ b/crates/ui-egui/src/i18n.rs @@ -589,6 +589,10 @@ const JAPANESE: &[(&str, &str)] = &[ ("By Row", "行ごと"), ("Column", "縦棒"), ("Win/Loss", "勝敗"), + ("Green Data Bars", "緑のデータ バー"), + ("Blue-White-Red Scale", "青-白-赤のスケール"), + ("White-Green Scale", "白-緑のスケール"), + ("Duplicate Values", "重複する値"), ]; #[cfg(test)] diff --git a/crates/ui-egui/src/i18n/cs.rs b/crates/ui-egui/src/i18n/cs.rs index fadf40d50a..e93dc7f01c 100644 --- a/crates/ui-egui/src/i18n/cs.rs +++ b/crates/ui-egui/src/i18n/cs.rs @@ -415,6 +415,10 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "By Row" => "Podle řádků", "Column" => "Sloupec", "Win/Loss" => "Zisk/ztráta", + "Green Data Bars" => "Zelené datové čáry", + "Blue-White-Red Scale" => "Škála modrá-bílá-červená", + "White-Green Scale" => "Škála bílá-zelená", + "Duplicate Values" => "Duplicitní hodnoty", _ => return None, }) } diff --git a/crates/ui-egui/src/i18n/de.rs b/crates/ui-egui/src/i18n/de.rs index 2fc143105b..70ed6204ef 100644 --- a/crates/ui-egui/src/i18n/de.rs +++ b/crates/ui-egui/src/i18n/de.rs @@ -418,6 +418,10 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "By Row" => "Nach Zeile", "Column" => "Säule", "Win/Loss" => "Gewinn/Verlust", + "Green Data Bars" => "Grüne Datenbalken", + "Blue-White-Red Scale" => "Blau-Weiß-Rot-Skala", + "White-Green Scale" => "Weiß-Grün-Skala", + "Duplicate Values" => "Doppelte Werte", _ => return None, }) } diff --git a/crates/ui-egui/src/i18n/es.rs b/crates/ui-egui/src/i18n/es.rs index faad158341..3230e48ff8 100644 --- a/crates/ui-egui/src/i18n/es.rs +++ b/crates/ui-egui/src/i18n/es.rs @@ -417,6 +417,10 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "By Row" => "Por fila", "Column" => "Columna", "Win/Loss" => "Ganancia/pérdida", + "Green Data Bars" => "Barras de datos verdes", + "Blue-White-Red Scale" => "Escala azul-blanco-rojo", + "White-Green Scale" => "Escala blanco-verde", + "Duplicate Values" => "Valores duplicados", _ => return None, }) } diff --git a/crates/ui-egui/src/i18n/fr.rs b/crates/ui-egui/src/i18n/fr.rs index 04dd35b973..fb9caa2ff4 100644 --- a/crates/ui-egui/src/i18n/fr.rs +++ b/crates/ui-egui/src/i18n/fr.rs @@ -407,6 +407,10 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "By Row" => "Par ligne", "Column" => "Colonne", "Win/Loss" => "Gain/perte", + "Green Data Bars" => "Barres de données vertes", + "Blue-White-Red Scale" => "Échelle bleu-blanc-rouge", + "White-Green Scale" => "Échelle blanc-vert", + "Duplicate Values" => "Valeurs en double", _ => return None, }) } diff --git a/crates/ui-egui/src/i18n/ko.rs b/crates/ui-egui/src/i18n/ko.rs index 480e1fa417..948b3c8333 100644 --- a/crates/ui-egui/src/i18n/ko.rs +++ b/crates/ui-egui/src/i18n/ko.rs @@ -417,6 +417,10 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "By Row" => "행 기준", "Column" => "열", "Win/Loss" => "이익/손실", + "Green Data Bars" => "녹색 데이터 막대", + "Blue-White-Red Scale" => "파랑-흰색-빨강 눈금", + "White-Green Scale" => "흰색-녹색 눈금", + "Duplicate Values" => "중복 값", _ => return None, }) } diff --git a/crates/ui-egui/src/i18n/pt.rs b/crates/ui-egui/src/i18n/pt.rs index 8395b82238..6118274fb9 100644 --- a/crates/ui-egui/src/i18n/pt.rs +++ b/crates/ui-egui/src/i18n/pt.rs @@ -418,6 +418,10 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "By Row" => "Por linha", "Column" => "Coluna", "Win/Loss" => "Ganho/perda", + "Green Data Bars" => "Barras de dados verdes", + "Blue-White-Red Scale" => "Escala azul-branco-vermelho", + "White-Green Scale" => "Escala branco-verde", + "Duplicate Values" => "Valores duplicados", _ => return None, }) } diff --git a/crates/ui-egui/src/i18n/ru.rs b/crates/ui-egui/src/i18n/ru.rs index e6273c486b..e7930a0d6e 100644 --- a/crates/ui-egui/src/i18n/ru.rs +++ b/crates/ui-egui/src/i18n/ru.rs @@ -417,6 +417,10 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "By Row" => "По строкам", "Column" => "Столбец", "Win/Loss" => "Выигрыш/проигрыш", + "Green Data Bars" => "Зелёные гистограммы", + "Blue-White-Red Scale" => "Шкала сине-бело-красная", + "White-Green Scale" => "Шкала бело-зелёная", + "Duplicate Values" => "Повторяющиеся значения", _ => return None, }) } diff --git a/crates/ui-egui/src/i18n/zh.rs b/crates/ui-egui/src/i18n/zh.rs index 440962086e..9bbd6514d7 100644 --- a/crates/ui-egui/src/i18n/zh.rs +++ b/crates/ui-egui/src/i18n/zh.rs @@ -409,6 +409,10 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "By Row" => "按行", "Column" => "柱形", "Win/Loss" => "盈亏", + "Green Data Bars" => "绿色数据条", + "Blue-White-Red Scale" => "蓝-白-红色阶", + "White-Green Scale" => "白-绿色阶", + "Duplicate Values" => "重复值", _ => return None, }) } diff --git a/crates/ui-egui/src/quick_analysis.rs b/crates/ui-egui/src/quick_analysis.rs index 7bfa454d95..94032e4d38 100644 --- a/crates/ui-egui/src/quick_analysis.rs +++ b/crates/ui-egui/src/quick_analysis.rs @@ -4,7 +4,7 @@ //! pivot tables, `analysis.addSparklines`), so nothing here is UI-only logic worth testing apart //! from which command a tile maps to ([`tiles`]). -use egui::{Align2, Id, Order, Rect, Sense, Stroke, StrokeKind, Ui, pos2, vec2}; +use egui::{Align2, Color32, Id, Order, Rect, Sense, Stroke, StrokeKind, Ui, pos2, vec2}; use gridcraft_engine::core::RangeRef; use gridcraft_engine::model::Sheet; use serde_json::{Value as Json, json}; @@ -64,6 +64,9 @@ enum Glyph { Text(&'static str), Bars, Scale, + GreenBars, + BlueScale, + GreenScale, Dots, Steps, MiniColumns, @@ -96,6 +99,12 @@ pub fn tiles(tab: Tab, range: &str, sheet_name: &str, by_rows: bool) -> Vec"), Dialog("cfQuick", json!({"type": "cellIs", "operator": "greater", "title": "Greater Than…"}))), tile("Top 10 Items", Glyph::Text("10"), cf(json!({"type": "top10", "rank": 10}))), tile("Clear Rules", Glyph::Icon(Icon::Eraser), Run("home.clearRules", json!({"range": range}))), + tile("Green Data Bars", Glyph::GreenBars, cf(json!({"type": "dataBar", "color": "#63BE7B"}))), + tile("Blue-White-Red Scale", Glyph::BlueScale, cf(json!({"type": "colorScale", "colors": ["#5A8AC6", "#FCFCFF", "#F8696B"]}))), + tile("White-Green Scale", Glyph::GreenScale, cf(json!({"type": "colorScale", "colors": ["#FCFCFF", "#63BE7B"]}))), + tile("Top 10%", Glyph::Text("10%"), cf(json!({"type": "top10", "rank": 10, "percent": true}))), + tile("Below Average", Glyph::Text(" vec![ tile("Clustered Column", Glyph::Icon(Icon::ChartBar), chart("column")), @@ -131,7 +140,11 @@ pub fn tiles(tab: Tab, range: &str, sheet_name: &str, by_rows: bool) -> Vec) -> Result { - let sel = app.session.active().map(|d| d.selection.current()).ok_or("no workbook open")?; + let d = app.session.active().ok_or("no workbook open")?; + if d.selection.ranges.len() > 1 { + return Err("Quick Analysis works on one block of cells; select a single contiguous range.".into()); + } + let sel = d.selection.current(); let want = on.unwrap_or(app.grid.quick_analysis.open.is_none()); if !want { app.grid.quick_analysis.open = None; @@ -143,16 +156,38 @@ pub fn toggle(app: &mut SheetApp, on: Option) -> Result { Ok(json!({"open": app.grid.quick_analysis.open.is_some()})) } -/// Paints the corner button and, when open, the popup. Called once per grid frame. -pub fn show(app: &mut SheetApp, ui: &mut Ui, geo: &Geo, sh: &Sheet) { - let Some(d) = app.session.active() else { return }; - let sel = d.selection.current(); - let hidden = sel.is_single() +/// Whether the button (and popup) stay out of the way: a single cell or several areas, editing, +/// an open dialog or menu, and the paged views have no corner to hang them on. +pub fn is_hidden(app: &SheetApp, geo: &Geo, sh: &Sheet) -> bool { + let Some(d) = app.session.active() else { return true }; + d.selection.ranges.len() > 1 + || d.selection.current().is_single() || app.editor.is_some() || app.dialog.is_some() || app.text_box_editor.is_some() || app.grid.context_menu.is_some() - || geo.paper.is_some(); + || geo.paper.is_some() + || sh.view == gridcraft_engine::model::SheetViewMode::PageLayout +} + +/// Where the corner button sits for `sel` (on screen), and whether the selection's corner is in +/// view. Below and right of the corner, clear of the fill handle; flipped inside at the grid edge. +pub fn button_rect(geo: &Geo, sh: &Sheet, sel: RangeRef) -> (Rect, bool) { + let corner = geo.range_rect(sh, sel).right_bottom(); + let panes = geo.range_panes(RangeRef::cell(sel.end)); + let visible = panes.iter().any(|p| p.contains(pos2(corner.x - 1.0, corner.y - 1.0))); + let area = geo.cells.shrink(2.0); + let x = if corner.x + GAP + BUTTON > area.right() { corner.x - GAP - BUTTON } else { corner.x + GAP }; + let y = if corner.y + GAP + BUTTON > area.bottom() { corner.y - GAP - BUTTON } else { corner.y + GAP }; + let at = pos2(x.clamp(area.left(), (area.right() - BUTTON).max(area.left())), y.clamp(area.top(), (area.bottom() - BUTTON).max(area.top()))); + (geo.mirror_rect(Rect::from_min_size(at, vec2(BUTTON, BUTTON))), visible) +} + +/// Paints the corner button and, when open, the popup. Called once per grid frame. +pub fn show(app: &mut SheetApp, ui: &mut Ui, geo: &Geo, sh: &Sheet) { + let Some(d) = app.session.active() else { return }; + let sel = d.selection.current(); + let hidden = is_hidden(app, geo, sh); // The popup belongs to one selection; a new one (or editing) closes it. if hidden || app.grid.quick_analysis.open.is_some_and(|r| r != sel) { app.grid.quick_analysis.open = None; @@ -163,18 +198,7 @@ pub fn show(app: &mut SheetApp, ui: &mut Ui, geo: &Geo, sh: &Sheet) { let sheet_name = sh.name.clone(); let ctx = ui.ctx().clone(); let t = Tokens::get(&ctx); - let rect = geo.range_rect(sh, sel); - let corner = rect.right_bottom(); - let panes = geo.range_panes(RangeRef::cell(sel.end)); - let corner_visible = panes.iter().any(|p| p.contains(pos2(corner.x - 1.0, corner.y - 1.0))); - // Below and right of the corner (clear of the fill handle); flipped inside when at an edge. - let area = geo.cells.shrink(2.0); - let x = if corner.x + GAP + BUTTON > area.right() { corner.x - GAP - BUTTON } else { corner.x + GAP }; - let y = if corner.y + GAP + BUTTON > area.bottom() { corner.y - GAP - BUTTON } else { corner.y + GAP }; - let button = geo.mirror_rect(Rect::from_min_size( - pos2(x.clamp(area.left(), (area.right() - BUTTON).max(area.left())), y.clamp(area.top(), (area.bottom() - BUTTON).max(area.top()))), - vec2(BUTTON, BUTTON), - )); + let (button, corner_visible) = button_rect(geo, sh, sel); let open = app.grid.quick_analysis.open.is_some(); // While the mouse is down (selecting, filling) the button stays out of the way. let busy = app.grid.drag != Drag::None || ctx.input(|i| i.pointer.any_down()); @@ -219,14 +243,17 @@ pub fn show(app: &mut SheetApp, ui: &mut Ui, geo: &Geo, sh: &Sheet) { ui.selectable_value(&mut state.by_rows, true, lang.tr("By Row")); }); } - ui.horizontal(|ui| { - ui.spacing_mut().item_spacing.x = 2.0; - for item in tiles(state.tab, &opened_for.a1(), &sheet_name, state.by_rows) { - if paint_tile(ui, &t, &item, lang.tr(item.label)) { - picked = Some(item.action.clone()); + let items = tiles(state.tab, &opened_for.a1(), &sheet_name, state.by_rows); + for row in items.chunks(6) { + ui.horizontal(|ui| { + ui.spacing_mut().item_spacing.x = 2.0; + for item in row { + if paint_tile(ui, &t, item, lang.tr(item.label)) { + picked = Some(item.action.clone()); + } } - } - }); + }); + } }); }); let outside_click = ctx.input(|i| i.pointer.any_pressed()) @@ -278,6 +305,24 @@ fn paint_glyph(ui: &Ui, t: &Tokens, glyph: Glyph, r: Rect) { p.rect_filled(cell(i as f32, 1.0).shrink(0.5), 1.0, c); } } + Glyph::GreenBars => { + for (j, w) in [0.9, 0.55, 0.3].into_iter().enumerate() { + let row = cell(0.0, j as f32).shrink2(vec2(0.0, 1.0)); + p.rect_filled(Rect::from_min_size(row.min, vec2(r.width() * w, row.height())), 1.0, green); + } + } + Glyph::BlueScale | Glyph::GreenScale => { + let cols = if glyph == Glyph::BlueScale { [blue, Color32::WHITE, red] } else { [Color32::WHITE, green.gamma_multiply(0.5), green] }; + for (i, c) in cols.into_iter().enumerate() { + p.rect_filled(cell(i as f32, 1.0).shrink(0.5), 1.0, c); + } + p.rect_stroke( + Rect::from_min_size(cell(0.0, 1.0).min, vec2(r.width(), r.height() / 3.0)), + 1.0, + Stroke::new(1.0, t.separator), + StrokeKind::Inside, + ); + } Glyph::Dots => { for (j, c) in [green, yellow, red].into_iter().enumerate() { p.circle_filled(cell(1.0, j as f32).center(), 3.2, c); diff --git a/crates/ui-egui/src/ribbon.rs b/crates/ui-egui/src/ribbon.rs index b8054f9a0f..dcc963dc3e 100644 --- a/crates/ui-egui/src/ribbon.rs +++ b/crates/ui-egui/src/ribbon.rs @@ -2430,8 +2430,13 @@ pub fn shortcut(app: &mut SheetApp, key: Key, m: Modifiers) { Key::T => Some(("insert.table", json!({}))), Key::E => Some(("edit.flashFill", json!({}))), Key::Q => { - // Quick Analysis; a single cell has nothing to analyse, which is not worth an alert. - let _ = crate::quick_analysis::toggle(app, None); + // Quick Analysis; a single cell has nothing to analyse, which is not worth an alert, + // but several areas deserve to be told why nothing opened. + if let Err(e) = crate::quick_analysis::toggle(app, None) + && app.session.active().is_some_and(|d| d.selection.ranges.len() > 1) + { + app.alert(e); + } None } Key::Num1 => { diff --git a/crates/ui-egui/tests/quick_analysis_button.rs b/crates/ui-egui/tests/quick_analysis_button.rs new file mode 100644 index 0000000000..65fa142d91 --- /dev/null +++ b/crates/ui-egui/tests/quick_analysis_button.rs @@ -0,0 +1,84 @@ +//! Quick Analysis: where the corner button sits, and when it keeps out of the way. + +use egui::{Rect, Vec2, pos2, vec2}; +use gridcraft_engine::Session; +use gridcraft_engine::core::RangeRef; +use gridcraft_ui_egui::SheetApp; +use gridcraft_ui_egui::grid::Geo; +use gridcraft_ui_egui::quick_analysis::{button_rect, is_hidden, toggle}; +use serde_json::json; + +fn app() -> SheetApp { + let mut s = Session::new(); + s.new_workbook(); + SheetApp::new(s, Default::default()) +} + +fn geo(app: &SheetApp) -> Geo { + let sheet = app.session.active().unwrap().wb.active().unwrap(); + Geo::new(sheet, Rect::from_min_max(pos2(0.0, 0.0), pos2(1200.0, 800.0)), Vec2::ZERO) +} + +#[test] +fn the_button_sits_below_right_of_the_corner_clear_of_the_fill_handle() { + let app = app(); + let (g, sh) = (geo(&app), app.session.active().unwrap().wb.active().unwrap()); + let sel = RangeRef::parse("B2:D5").unwrap(); + let corner = g.range_rect(sh, sel).right_bottom(); + let (button, visible) = button_rect(&g, sh, sel); + assert!(visible); + assert!(button.left() > corner.x && button.top() > corner.y, "below and right of the corner"); + // The fill handle is a 9 x 9 square centred on the corner. + assert!(!button.intersects(Rect::from_center_size(corner, vec2(9.0, 9.0))), "clear of the fill handle"); +} + +#[test] +fn at_the_grid_edge_the_button_flips_inside_and_far_corners_are_not_visible() { + let app = app(); + let (g, sh) = (geo(&app), app.session.active().unwrap().wb.active().unwrap()); + let near_edge = RangeRef::parse("A1:ZZ1").unwrap(); + let (far, visible) = button_rect(&g, sh, near_edge); + assert!(!visible, "the corner is scrolled out of view"); + assert!(g.cells.contains_rect(far), "the popup still has an anchor inside the grid"); + let (b, _) = button_rect(&g, sh, RangeRef::parse("A1:A200").unwrap()); + assert!(g.cells.contains_rect(b)); +} + +#[test] +fn the_button_hides_for_single_cells_several_areas_editing_dialogs_and_page_layout() { + let mut app = app(); + app.run("selection.set", json!({"cell": "B2"})).unwrap(); + let hidden = |app: &SheetApp| { + let g = geo(app); + is_hidden(app, &g, app.session.active().unwrap().wb.active().unwrap()) + }; + assert!(hidden(&app), "a single cell"); + app.run("selection.set", json!({"range": "B2:D5"})).unwrap(); + assert!(!hidden(&app)); + app.begin_edit(None, false); + assert!(hidden(&app), "while editing"); + app.editor = None; + app.open_dialog("find", json!({})); + assert!(hidden(&app), "while a dialog is open"); + app.dialog = None; + assert!(!hidden(&app)); + app.run("view.pageLayout", json!({})).unwrap(); + assert!(hidden(&app), "Page Layout view"); + app.run("view.normal", json!({})).unwrap(); + assert!(!hidden(&app)); +} + +#[test] +fn several_areas_are_refused_with_a_message_rather_than_guessed() { + let mut app = app(); + app.run("selection.set", json!({"range": "B2:D5,F2:G5"})).unwrap(); + let err = toggle(&mut app, Some(true)).unwrap_err(); + assert!(err.contains("one block"), "{err}"); + assert!(app.grid.quick_analysis.open.is_none()); + assert!(hidden_for_areas(&app)); +} + +fn hidden_for_areas(app: &SheetApp) -> bool { + let g = geo(app); + is_hidden(app, &g, app.session.active().unwrap().wb.active().unwrap()) +} From 7d3516ab331924603b1ed9ba340079e2dc0b046e Mon Sep 17 00:00:00 2001 From: vangel76 Date: Mon, 12 Oct 2026 21:09:27 +0200 Subject: [PATCH 03/94] Calc: SUBTOTAL(10x) recalculates when Row Height, AutoFit Row Height or Ungroup reveal rows home.rowHeight, home.autofitRowHeight and data.ungroup change row hidden state without marking the edit structural, so SUBTOTAL(101-111) kept a stale value. Found by the command-sequence fuzz (seed 3). Co-Authored-By: Claude Sonnet 5.5 --- ROADMAP.md | 1 + crates/engine/src/cmd/data.rs | 1 + crates/engine/src/cmd/format.rs | 2 ++ crates/engine/src/tests.rs | 16 ++++++++++++++++ 4 files changed, 20 insertions(+) diff --git a/ROADMAP.md b/ROADMAP.md index 25b8d9b803..acacee974f 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -133,6 +133,7 @@ Ranked; estimates in Opus 5.5 agent-hours. Detail and the full beta-gate list in | Date | What landed | |---|---| | 2026-10-12 | Quick Analysis (Ctrl+Q): a corner button and popup on multi-cell selections run conditional formats, charts, totals (`analysis.addTotal`), tables, PivotTables and sparklines (`analysis.addSparklines`) in one click (#791) | +| 2026-10-12 | SUBTOTAL(109) over hidden rows recalculates after Row Height, AutoFit Row Height and Ungroup reveal rows (found by the command-sequence fuzz) | | 2026-10-12 | File › Print selects a system printer, copies, duplex and grayscale, submits PDF jobs through craft-print on a worker and shows spooler errors; browser printing and PDF export remain available | | 2026-10-11 | Command-sequence fuzzing: random command sequences checked against undo/redo, XLSX round-trip and full recalculation; fixes for the table, legacy-array, spill, AutoSum, Watch Window and sheet-copy bugs it found | | 2026-10-11 | Password-protected workbooks open: GridCraft asks for the password and decrypts Agile and Standard encryption (#11) | diff --git a/crates/engine/src/cmd/data.rs b/crates/engine/src/cmd/data.rs index e4aa3baa6e..d2b3612b7d 100644 --- a/crates/engine/src/cmd/data.rs +++ b/crates/engine/src/cmd/data.rs @@ -1129,6 +1129,7 @@ fn group(s: &mut Session, p: &Json, on: bool) -> Result { { e.collapsed = false; } + cx.structural = true; // ungrouping reveals hidden rows: SUBTOTAL(10x) depends on it Ok(Json::Null) }) } diff --git a/crates/engine/src/cmd/format.rs b/crates/engine/src/cmd/format.rs index dde5fa120d..8d46010299 100644 --- a/crates/engine/src/cmd/format.rs +++ b/crates/engine/src/cmd/format.rs @@ -953,6 +953,7 @@ fn row_height(s: &mut Session, p: &Json) -> Result { e.custom = true; } } + cx.structural = true; // setting a height shows or hides rows: SUBTOTAL(10x) depends on it Ok(Json::Null) }) } @@ -1069,6 +1070,7 @@ fn autofit_rows(s: &mut Session, p: &Json) -> Result { } cx.fit_rows.extend((a..=b).map(|r| (si, r))); } + cx.structural = true; // autofit reveals hidden rows: SUBTOTAL(10x) depends on it Ok(Json::Null) }) } diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index c348dbaff2..123afa8064 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -2866,3 +2866,19 @@ fn analysis_add_sparklines_one_per_row_in_one_undo_step() { assert!(s.doc().unwrap().wb.active().unwrap().sparklines.is_empty()); assert!(s.execute("analysis.addSparklines", json!({"range": "A1:A4"})).is_err()); } + +#[test] +fn subtotal_109_recalculates_when_row_height_or_autofit_reveals_rows() { + let mut s = s(); + s.execute("range.setValues", json!({"range": "A1", "values": [[1], [2], [4], [8]]})).unwrap(); + s.execute("cell.set", json!({"cell": "C1", "input": "=SUBTOTAL(109,A1:A4)"})).unwrap(); + s.execute("home.hideRows", json!({"rows": "2:3"})).unwrap(); + assert_eq!(v(&s, "C1"), Value::Number(9.0)); + // A non-zero height unhides the rows (the fuzz found the stale SUBTOTAL). + s.execute("home.rowHeight", json!({"rows": "2:3", "height": 60.0})).unwrap(); + assert_eq!(v(&s, "C1"), Value::Number(15.0)); + s.execute("home.hideRows", json!({"rows": "2:3"})).unwrap(); + assert_eq!(v(&s, "C1"), Value::Number(9.0)); + s.execute("home.autofitRowHeight", json!({"rows": "2:3"})).unwrap(); + assert_eq!(v(&s, "C1"), Value::Number(15.0)); +} From 921405fa02a60ef883412a0eb630ea19ddf54d57 Mon Sep 17 00:00:00 2001 From: Harrison Booth Date: Wed, 14 Oct 2026 21:18:25 -0500 Subject: [PATCH 04/94] SORT, SORTBY and Data > Sort order numbers exactly, like Excel sort_compare compared numbers at 15 significant digits, so 0.3 and =0.1+0.2 (0.30000000000000004) tied and kept their input order. Excel 365 orders them exactly in SORT, SORTBY, Data > Sort, the AutoFilter sort and table sort: 0.3 first ascending, last descending, in either input order. Numbers now compare with partial_cmp in sort_compare (0 and -0 still tie). = and COUNTIF keep their 15-digit comparison; UNIQUE, RANK, LARGE, SMALL and MODE were already exact, as observed. Co-Authored-By: Claude Opus 5.5 --- ROADMAP.md | 4 ++- crates/calc/src/tests.rs | 59 +++++++++++++++++++++++++++++++++ crates/core/src/value.rs | 17 ++++++++++ crates/engine/src/tests.rs | 21 ++++++++++++ crates/functions/src/dynamic.rs | 15 +++++++++ docs/function-parity.md | 3 +- 6 files changed, 117 insertions(+), 2 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index 070552d07e..357f1bf8d5 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -2,7 +2,7 @@ **Stage: alpha** · next: beta, ~25 points of "ready for real work" and ~160–240 h away -> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-12 · **Change:** minor (rows auto-fit oversized fonts on open and whole-row/column formatting) · **Target:** Microsoft Excel (Microsoft 365) +> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-14 · **Change:** minor (SORT, SORTBY and Data > Sort order numbers exactly, like Excel) · **Target:** Microsoft Excel (Microsoft 365) GridCraft aims at full Microsoft Excel parity, and at being better in places: faster, open (XLSX is the native format), fully scriptable by agents (MCP, control channel, CLI), and on the web. @@ -132,6 +132,7 @@ Ranked; estimates in Opus 5.5 agent-hours. Detail and the full beta-gate list in | Date | What landed | |---|---| +| 2026-10-14 | SORT, SORTBY and Data > Sort (with the AutoFilter and table sorts) order numbers exactly like Excel, so 0.3 sorts before `=0.1+0.2` whatever the input order; `=` and COUNTIF keep their 15-digit comparison | | 2026-10-12 | Rows auto-fit oversized fonts: opening a file and whole-row/column formatting grow non-custom rows to their tallest font (#833) | | 2026-10-12 | Number formats: parsing a format code is linear in its length (long runs of `[`, `,` or `/` no longer take quadratic time), and an unclosed `[` is a literal when splitting sections as well as when tokenizing (#810) | | 2026-10-12 | Number formats: a fraction denominator with 65,536 zeros no longer crashes; format codes are capped at 255 characters like Excel (longer codes display as General, `TEXT` gives `#VALUE!`) (#807) | @@ -193,6 +194,7 @@ Ranked; estimates in Opus 5.5 agent-hours. Detail and the full beta-gate list in | Date | Change | Summary | |---|---|---| +| 2026-10-14 | minor | Progress log: sorts order numbers exactly | | 2026-10-12 | minor | Rows auto-fit oversized fonts on open and whole-row/column formatting (#833); progress log row | | 2026-10-12 | minor | Progress log: multi-area row/column delete (#758) | | 2026-10-12 | trivial | Progress log: XLSX chart sheets kept on save (#727) | diff --git a/crates/calc/src/tests.rs b/crates/calc/src/tests.rs index 196c57de78..ff13374fc8 100644 --- a/crates/calc/src/tests.rs +++ b/crates/calc/src/tests.rs @@ -1266,3 +1266,62 @@ fn offset_extreme_arguments_return_ref() { assert_eq!(crate::evaluate(&wb, 0, c("D1"), formula), Value::Number(expected), "{formula}"); } } + +/// Sorting and ranking compare numbers exactly while `=` and COUNTIF compare them at 15 +/// significant digits. Every expectation was observed in Excel 365 with these fixtures +/// (`=0.1+0.2` is 0.30000000000000004): 0.3 sorts first whatever the input order. +#[test] +fn sorts_and_ranks_compare_numbers_exactly() { + let mut t = T::new(); + for (at, input) in [ + // The noisy value first, then the exact one first. + ("A1", "=0.1+0.2"), + ("B1", "e"), + ("A2", "0.3"), + ("B2", "t"), + ("D1", "0.3"), + ("E1", "t"), + ("D2", "=0.1+0.2"), + ("E2", "e"), + ("G1", "=100+1E-14"), + ("H1", "e"), + ("G2", "100"), + ("H2", "t"), + ] { + t.set(at, input); + } + let e = 0.1 + 0.2; + let n = Value::Number; + let s = |x: &str| Value::from(x); + let cases: Vec<(&str, Value)> = vec![ + ("=A1=A2", Value::Bool(true)), + ("=COUNTIF(A1:A2,0.3)", n(2.0)), + ("=INDEX(SORT(A1:B2),1,2)", s("t")), + ("=INDEX(SORT(D1:E2),1,2)", s("t")), + ("=INDEX(SORT(A1:B2,1,-1),1,2)", s("e")), + ("=INDEX(SORT(D1:E2,1,-1),1,2)", s("e")), + ("=INDEX(SORT(G1:H2),1,2)", s("t")), + ("=INDEX(SORT(G1:H2,1,-1),1,2)", s("e")), + ("=INDEX(SORTBY(B1:B2,A1:A2),1,1)", s("t")), + ("=INDEX(SORTBY(E1:E2,D1:D2),1,1)", s("t")), + ("=INDEX(SORTBY(B1:B2,A1:A2,-1),1,1)", s("e")), + ("=INDEX(SORTBY(E1:E2,D1:D2,-1),1,1)", s("e")), + // Already exact: UNIQUE, RANK, LARGE/SMALL, MODE. + ("=ROWS(UNIQUE(A1:A2))", n(2.0)), + ("=RANK.EQ(0.3,A1:A2)", n(2.0)), + ("=RANK.EQ(0.3,A1:A2,1)", n(1.0)), + ("=RANK.AVG(0.3,A1:A2)", n(2.0)), + ("=RANK.EQ(0.3,A1)", Value::Error(CellError::NA)), + ("=LARGE(A1:A2,1)", n(e)), + ("=SMALL(A1:A2,1)", n(0.3)), + ("=MODE.SNGL(A1:A2,5)", Value::Error(CellError::NA)), + ]; + let mut wrong = Vec::new(); + for (formula, expected) in cases { + let got = crate::evaluate(&t.wb, 0, c("Z1"), formula); + if got != expected { + wrong.push(format!("{formula}: got {got:?}, Excel {expected:?}")); + } + } + assert!(wrong.is_empty(), "{}", wrong.join("\n")); +} diff --git a/crates/core/src/value.rs b/crates/core/src/value.rs index cfef7ac57d..70c05036e2 100644 --- a/crates/core/src/value.rs +++ b/crates/core/src/value.rs @@ -339,12 +339,16 @@ pub fn compare_text(a: &str, b: &str) -> Ordering { } /// Sorting order used by Sort (ascending): numbers, text, booleans, errors, then blanks last. +/// Numbers compare exactly, not at the 15 digits of [`compare`]. Observed in Excel 365: SORT, +/// SORTBY, Data > Sort, the AutoFilter sort and table sort all put 0.3 before `=0.1+0.2` +/// (0.30000000000000004) ascending and after it descending, whatever the input order. pub fn sort_compare(a: &Value, b: &Value) -> Ordering { match (a, b) { (Value::Empty, Value::Empty) => Ordering::Equal, (Value::Empty, _) => Ordering::Greater, (_, Value::Empty) => Ordering::Less, (Value::Error(_), Value::Error(_)) => Ordering::Equal, + (Value::Number(x), Value::Number(y)) => x.partial_cmp(y).unwrap_or(Ordering::Equal), _ => compare(a, b), } } @@ -442,6 +446,19 @@ mod tests { assert_eq!(compare(&num(1.0), &num(2.0)), Ordering::Less); } + #[test] + fn sort_orders_numbers_exactly() { + let num = Value::Number; + let e = 0.1 + 0.2; + assert_eq!(sort_compare(&num(0.3), &num(e)), Ordering::Less); + assert_eq!(sort_compare(&num(e), &num(0.3)), Ordering::Greater); + assert_eq!(sort_compare(&num(100.0), &num(100.0 + 1e-14)), Ordering::Less); + assert_eq!(sort_compare(&num(0.0), &num(-0.0)), Ordering::Equal); + assert_eq!(sort_compare(&num(1.0), &Value::from("a")), Ordering::Less); + // `=` keeps its 15-digit comparison. + assert_eq!(compare(&num(0.3), &num(e)), Ordering::Equal); + } + #[test] fn arrays() { let a = Array::new(2, 2, vec![1.0.into(), 2.0.into(), 3.0.into(), 4.0.into()]).unwrap(); diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index ae499a1895..ee21430fd7 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -1027,6 +1027,27 @@ fn case_sensitive_sort_puts_lowercase_first() { assert_eq!(col, ["a", "A", "aB", "Ab", "b", "B"].map(Value::from)); } +/// Data > Sort orders numbers exactly, like Excel 365: 0.3 sorts before `=0.1+0.2` +/// (0.30000000000000004) ascending and after it descending, whatever the input order. +#[test] +fn sort_orders_numbers_exactly() { + for first_noisy in [true, false] { + let mut s = s(); + let (a1, a2, b1, b2) = if first_noisy { ("=0.1+0.2", "0.3", "e", "t") } else { ("0.3", "=0.1+0.2", "t", "e") }; + for (cell, input) in [("A1", a1), ("A2", a2), ("B1", b1), ("B2", b2)] { + s.execute("cell.set", json!({"cell": cell, "input": input})).unwrap(); + } + let labels = |s: &Session| [v(s, "B1"), v(s, "B2")]; + s.execute("data.sort", json!({"range": "A1:B2", "header": false, "keys": [{"column": "A"}]})).unwrap(); + assert_eq!(labels(&s), ["t", "e"].map(Value::from), "ascending, noisy first: {first_noisy}"); + s.execute("data.sort", json!({"range": "A1:B2", "header": false, "keys": [{"column": "A", "order": "desc"}]})).unwrap(); + assert_eq!(labels(&s), ["e", "t"].map(Value::from), "descending, noisy first: {first_noisy}"); + s.execute("selection.set", json!({"range": "A1:B2"})).unwrap(); + s.execute("data.sortAscending", json!({"range": "A1:B2", "column": "A"})).unwrap(); + assert_eq!(labels(&s), ["t", "e"].map(Value::from), "quick sort, noisy first: {first_noisy}"); + } +} + #[test] fn remove_duplicates_compares_shown_text() { let mut s = s(); diff --git a/crates/functions/src/dynamic.rs b/crates/functions/src/dynamic.rs index 2e29b416ca..d983bc2d33 100644 --- a/crates/functions/src/dynamic.rs +++ b/crates/functions/src/dynamic.rs @@ -1102,6 +1102,21 @@ mod tests { is_err(ev("SORTBY", vec![av(col(&[1.0, 2.0])), av(col(&[1.0, 2.0])), n(0.0)]), CellError::Value); } + /// SORT and SORTBY order numbers exactly, not at 15 digits (observed in Excel 365). + #[test] + fn sort_orders_numbers_exactly() { + for (t, e) in [(0.3, 0.1 + 0.2), (100.0, 100.0 + 1e-14), (3.3, 1.1 * 3.0)] { + for input in [[e, t], [t, e]] { + let asc = vec![vec![nv(t)], vec![nv(e)]]; + let desc = vec![vec![nv(e)], vec![nv(t)]]; + assert_eq!(rows_of(&ev("SORT", vec![av(col(&input))])), asc); + assert_eq!(rows_of(&ev("SORT", vec![av(col(&input)), n(1.0), n(-1.0)])), desc); + assert_eq!(rows_of(&ev("SORTBY", vec![av(col(&input)), av(col(&input))])), asc); + assert_eq!(rows_of(&ev("SORTBY", vec![av(col(&input)), av(col(&input)), n(-1.0)])), desc); + } + } + } + #[test] fn unique() { let v = arr(vec![vec![tv("a")], vec![tv("B")], vec![tv("A")], vec![tv("c")], vec![tv("b")]]); diff --git a/docs/function-parity.md b/docs/function-parity.md index 760ffd6ac3..e35ef547f7 100644 --- a/docs/function-parity.md +++ b/docs/function-parity.md @@ -1,6 +1,6 @@ # Function parity: worksheet functions and formulas -> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-12 · **Change:** minor (USDOLLAR added as a compatibility function; MIRR, COUNTIF and INDIRECT edge cases match Excel 365) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4 +> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-14 · **Change:** minor (SORT and SORTBY order numbers exactly, like Excel 365) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4 Excel's worksheet functions, category by category, against GridCraft's function library. Part of [target-app-parity.md](target-app-parity.md); gaps feed [gaps.md](gaps.md). @@ -108,6 +108,7 @@ workbooks; results checked in as data, not Excel files) and fixing what it finds | Date | Change | Summary | |---|---|---| +| 2026-10-14 | minor | SORT, SORTBY and Data > Sort (including the AutoFilter and table sorts) order numbers exactly, as Excel 365 does: 0.3 sorts before `=0.1+0.2` (0.30000000000000004) ascending and after it descending, in either input order. UNIQUE, RANK / RANK.EQ / RANK.AVG, LARGE, SMALL and MODE were already exact, also as observed; `=` and COUNTIF keep comparing at 15 significant digits | | 2026-10-12 | minor | USDOLLAR added as a Compatibility function (not on Microsoft's list, so the counts don't change); MIRR with no positive flow is -1, COUNTIF's bare `"<="` / `">="` skip empty strings, INDIRECT with `a1` = FALSE gives `#REF!` for A1-style text (#738) | | 2026-10-11 | minor | TEXT / number formats fixed against Excel-cached results: fraction literals and zero fractions, `0` denominators zero padded, `?` pads the thousands separator, booleans use the text section (226 mismatches → 0 in 352 TEXT cells) | | 2026-10-11 | minor | Iterative calculation: circular references iterate up to Maximum Iterations / Maximum Change when enabled | From df34dac2d1da73ab8876e19496a5dc419fb0ba25 Mon Sep 17 00:00:00 2001 From: Harrison Booth Date: Thu, 15 Oct 2026 02:29:30 -0500 Subject: [PATCH 05/94] Recalc: array-entering over a selection updates readers of the cells it clears cell.set with array:true over a multi-cell selection cleared the other cells of the range but marked only the first cell changed, so formulas reading the cleared cells kept stale values until a full recalc (array formulas hid this because their results refresh the range; a constant input didn't). The clearing loop also stopped after a million addresses, so a whole-column array left content further down in place. The array branch now walks the cells the sheet holds in the range and marks each one it clears. Clear (Delete and the Clear commands) had the same cap on the addresses it marked: readers of cells past the first million of a large range stayed stale. It now marks the cells it clears. Found by the command-sequence fuzzer (seeds 4 and 1213). Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/cmd/edit.rs | 112 +++++++++++++++++++++++++++++++--- 1 file changed, 103 insertions(+), 9 deletions(-) diff --git a/crates/engine/src/cmd/edit.rs b/crates/engine/src/cmd/edit.rs index 82dbe0be72..0cb6382e5c 100644 --- a/crates/engine/src/cmd/edit.rs +++ b/crates/engine/src/cmd/edit.rs @@ -246,15 +246,23 @@ fn cell_set(s: &mut Session, p: &Json) -> Result { std::sync::Arc::make_mut(f).array = Some(range); } let sh = cx.sheet_mut(sheet)?; - // The array takes the whole range: other cells in it lose their contents. - for c in range.iter().skip(1).take(1_000_000) { - if let Some(old) = sh.cells.get(c).filter(|x| !x.value.is_empty() || x.formula.is_some()) { - let style = old.style; - sh.set_cell(c, Cell { style, ..Cell::default() }); - } + // The array takes the whole range: other cells in it lose their contents. Walk the + // cells the sheet holds rather than every address, so a whole-column array clears + // all of its area, and mark each cleared cell so formulas reading it recalculate. + let cleared: Vec<(CellRef, StyleId)> = sh + .cells + .iter_range(range) + .filter(|(c, x)| *c != range.start && (!x.value.is_empty() || x.formula.is_some())) + .map(|(c, x)| (c, x.style)) + .collect(); + for &(c, style) in &cleared { + sh.set_cell(c, Cell { style, ..Cell::default() }); } sh.set_cell(range.start, cell); cx.touch(sheet, range.start); + for (c, _) in cleared { + cx.touch(sheet, c); + } return Ok(Json::Null); } let cell = input_to_cell(&input, sheet, at, &mut cx.wb)?; @@ -1261,6 +1269,9 @@ fn clear(s: &mut Session, p: &Json, what: &str) -> Result { } } } + // Mark the cells the sheet held, not every address of the range: a whole-column range + // holds millions of addresses, and a cap on them left readers of cells past it stale. + cx.changed.extend(cells.iter().map(|(c, _)| (sheet, *c))); let sh = cx.sheet_mut(sheet)?; for (c, mut cell) in cells { match what { @@ -1286,9 +1297,6 @@ fn clear(s: &mut Session, p: &Json, what: &str) -> Result { if matches!(what, "all" | "formats") { sh.merges.retain(|m| !r.contains_range(m)); } - for c in r.iter().take(1_000_000) { - cx.changed.push((sheet, c)); - } } Ok(Json::Null) }) @@ -1636,6 +1644,92 @@ mod tests { assert_eq!(sh.value(CellRef::parse("K20").unwrap()), Value::text("keep")); } + /// The value a full recalculation from scratch gives `a1` on the active sheet. + fn fully_recalculated(s: &Session, a1: &str) -> Value { + let mut fresh = (*s.doc().unwrap().wb).clone(); + gridcraft_calc::Calc::new().recalc_all(&mut fresh); + fresh.active().unwrap().value(CellRef::parse(a1).unwrap()) + } + + #[test] + fn array_entering_a_constant_recalculates_readers_of_the_cleared_cells() { + // Found by the command-sequence fuzzer (seeds 4, 1213): only the array's first cell was + // marked changed, so formulas reading the cells it cleared kept their old values. + let mut s = Session::new(); + s.new_workbook(); + s.execute("range.setValues", json!({"range": "A1", "values": [[5, 6, "=B1+1"]]})).unwrap(); + s.execute("selection.set", json!({"active": "A1", "range": "A1:B1"})).unwrap(); + s.execute("cell.set", json!({"cell": "A1", "input": "7", "array": true})).unwrap(); + let sh = s.doc().unwrap().wb.active().unwrap(); + assert_eq!(sh.value(CellRef::parse("B1").unwrap()), Value::Empty); + assert_eq!(sh.value(CellRef::parse("C1").unwrap()), Value::number(1.0)); + + // The fuzzer's minimal repro on the budget sample. + let mut s = Session::new(); + s.execute("file.new", json!({"sample": "budget"})).unwrap(); + s.execute("selection.set", json!({"active": "C5", "range": "C5:D5"})).unwrap(); + s.execute("cell.set", json!({"array": true, "cell": "C5", "input": "7"})).unwrap(); + let in_memory = s.doc().unwrap().wb.active().unwrap().value(CellRef::parse("D15").unwrap()); + assert_eq!(in_memory, fully_recalculated(&s, "D15")); + } + + #[test] + fn a_whole_column_array_clears_its_whole_area() { + // The clearing loop stopped after a million addresses, so content further down the + // column survived inside the array (and its readers weren't recalculated). + let mut s = Session::new(); + s.new_workbook(); + s.execute("cell.set", json!({"cell": "D1048000", "input": "41"})).unwrap(); + s.execute("cell.set", json!({"cell": "F1", "input": "=D1048000+1"})).unwrap(); + s.execute("selection.set", json!({"active": "D1", "range": "D:D"})).unwrap(); + s.execute("cell.set", json!({"cell": "D1", "input": "1", "array": true})).unwrap(); + let sh = s.doc().unwrap().wb.active().unwrap(); + assert_eq!(sh.value(CellRef::parse("D1048000").unwrap()), Value::Empty); + assert_eq!(sh.value(CellRef::parse("F1").unwrap()), Value::number(1.0)); + assert_eq!(fully_recalculated(&s, "F1"), Value::number(1.0)); + } + + #[test] + fn clearing_more_than_a_million_cells_recalculates_readers_of_all_of_them() { + // Clear marked only the first million addresses of the range as changed, so formulas + // reading a cleared cell further down kept its old value. + let mut s = Session::new(); + s.new_workbook(); + s.execute("cell.set", json!({"cell": "D1", "input": "1"})).unwrap(); + s.execute("cell.set", json!({"cell": "D1048000", "input": "41"})).unwrap(); + s.execute("cell.set", json!({"cell": "F1", "input": "=D1048000+1"})).unwrap(); + s.execute("edit.clearContents", json!({"range": "D:D"})).unwrap(); + let sh = s.doc().unwrap().wb.active().unwrap(); + assert_eq!(sh.value(CellRef::parse("D1048000").unwrap()), Value::Empty); + assert_eq!(sh.value(CellRef::parse("F1").unwrap()), Value::number(1.0)); + } + + #[test] + fn clearing_a_spill_recalculates_readers_of_its_spilled_cells() { + // Clear marks only the cells the sheet holds; a spill's other cells go with its anchor. + let mut s = Session::new(); + s.new_workbook(); + s.execute("cell.set", json!({"cell": "A1", "input": "=SEQUENCE(5)"})).unwrap(); + s.execute("cell.set", json!({"cell": "C1", "input": "=A3+1"})).unwrap(); + assert_eq!(s.doc().unwrap().wb.active().unwrap().value(CellRef::parse("C1").unwrap()), Value::number(4.0)); + s.execute("edit.clearContents", json!({"range": "A1:A5"})).unwrap(); + assert_eq!(s.doc().unwrap().wb.active().unwrap().value(CellRef::parse("C1").unwrap()), Value::number(1.0)); + assert_eq!(fully_recalculated(&s, "C1"), Value::number(1.0)); + } + + #[test] + fn readers_of_an_array_formulas_cells_see_its_results() { + let mut s = Session::new(); + s.new_workbook(); + s.execute("range.setValues", json!({"range": "B2", "values": [[1], [2]]})).unwrap(); + s.execute("cell.set", json!({"cell": "C3", "input": "100"})).unwrap(); + s.execute("cell.set", json!({"cell": "E1", "input": "=C3+C4+1"})).unwrap(); + s.execute("selection.set", json!({"range": "C2:C4"})).unwrap(); + s.execute("cell.set", json!({"cell": "C2", "input": "=B2:B3*2", "array": true})).unwrap(); + let sh = s.doc().unwrap().wb.active().unwrap(); + assert_eq!(sh.value(CellRef::parse("E1").unwrap()), fully_recalculated(&s, "E1")); + } + #[test] fn wildcards() { assert!(wildcard("hello", "h*o")); From 480b8a88b5b822000c536359f766c53ba7e56aad Mon Sep 17 00:00:00 2001 From: vangel76 Date: Tue, 20 Oct 2026 01:35:21 +0200 Subject: [PATCH 06/94] Quick Analysis: report calling command in block errors, clip tile labels Co-Authored-By: Claude Sonnet 5.5 --- crates/engine/src/cmd/quick_analysis.rs | 10 +++++----- crates/ui-egui/src/quick_analysis.rs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/engine/src/cmd/quick_analysis.rs b/crates/engine/src/cmd/quick_analysis.rs index 94f4197020..5a5158118e 100644 --- a/crates/engine/src/cmd/quick_analysis.rs +++ b/crates/engine/src/cmd/quick_analysis.rs @@ -89,14 +89,14 @@ impl Block { } } -fn block(s: &Session, p: &Json, by_rows: bool) -> Result { +fn block(s: &Session, p: &Json, by_rows: bool, cmd: &str) -> Result { let sheet = target_sheet(s, p)?; let sel = match str_param(p, "range") { Some(_) => target_range(s, p)?, None => s.doc()?.selection.current(), }; if sel.is_single() { - return Err(bad(CMD, "select at least two cells")); + return Err(bad(cmd, "select at least two cells")); } let d = s.doc()?; let sh = d.wb.sheet(sheet).ok_or(EngineError::NoDocument)?; @@ -104,7 +104,7 @@ fn block(s: &Session, p: &Json, by_rows: bool) -> Result { let used = sh.cells.used_range().ok_or_else(|| EngineError::Other("There is no data to analyse.".into()))?; let r = sel.intersection(&used).ok_or_else(|| EngineError::Other("There is no data to analyse in the selection.".into()))?; if r.count() > MAX_SCAN_CELLS { - return Err(bad(CMD, "selection too large to analyse")); + return Err(bad(cmd, "selection too large to analyse")); } let is_num = |c: CellRef| sh.value(c).is_number(); let is_text = |c: CellRef| sh.value(c).is_text(); @@ -141,7 +141,7 @@ fn add_total(s: &mut Session, p: &Json) -> Result { Some(other) => return Err(bad(CMD, format!("direction must be columns or rows, not `{other}`"))), }; let overwrite = bool_param(p, "overwrite").unwrap_or(false); - let b = block(s, p, by_rows)?; + let b = block(s, p, by_rows, CMD)?; let (r, sheet) = (b.range, b.sheet); let (lo, hi) = b.span_of_line(); let out_cells = match func { @@ -233,7 +233,7 @@ fn add_sparklines(s: &mut Session, p: &Json) -> Result { }; let markers = bool_param(p, "markers").unwrap_or(false); let overwrite = bool_param(p, "overwrite").unwrap_or(false); - let b = block(s, p, by_rows)?; + let b = block(s, p, by_rows, SPARK)?; if b.lines.len() as u64 > MAX_SPARKLINES { return Err(bad(SPARK, "selection too large for this result")); } diff --git a/crates/ui-egui/src/quick_analysis.rs b/crates/ui-egui/src/quick_analysis.rs index 94032e4d38..798f68c4f8 100644 --- a/crates/ui-egui/src/quick_analysis.rs +++ b/crates/ui-egui/src/quick_analysis.rs @@ -281,7 +281,7 @@ fn paint_tile(ui: &mut Ui, t: &Tokens, item: &Tile, label: &str) -> bool { paint_glyph(ui, t, item.glyph, art); let galley = ui.painter().layout(label.to_string(), theme::ui_font(11.0), t.text, TILE.x - 4.0); let at = pos2(rect.center().x - galley.size().x / 2.0, rect.top() + 34.0); - ui.painter().galley(at, galley, t.text); + ui.painter().with_clip_rect(rect.intersect(ui.clip_rect())).galley(at, galley, t.text); resp.clicked() } From 4215f07bb34cac01e1c377ee0ef941238ea3b9f7 Mon Sep 17 00:00:00 2001 From: kezmdor <15539254+kezmdor@users.noreply.github.com> Date: Tue, 20 Oct 2026 07:24:25 +0200 Subject: [PATCH 07/94] Formula entry: a leading + or - starts a formula, like Excel (fixes #2023) Typing `+5+4` entered the text `+5+4`: a leading sign started a formula only when a letter or `(` came next. Now any entry that starts with `+` or `-` and isn't a number on its own is a formula, as in Excel, so `+5+4` enters `=+5+4`. `+5`, `-5` and a lone sign are unchanged. The rule lives in `gridcraft_core::parse::starts_formula`, shared by the engine's entry and the Spanish formula-locale path in the UI, where a signed decimal-comma number (`-1,5`) stays a number. Text to Columns keeps a part that isn't a valid formula as text instead of emptying its cell, as paste and Replace already do. Co-Authored-By: Claude Opus 5.5 --- crates/core/src/parse.rs | 20 +++++++++++++ crates/engine/src/cmd/data.rs | 3 +- crates/engine/src/cmd/edit.rs | 7 +---- crates/engine/src/tests.rs | 42 ++++++++++++++++++++++++++ crates/ui-egui/src/formula_locale.rs | 44 +++++++++++++++++++++------- docs/ui-parity.md | 5 ++-- 6 files changed, 102 insertions(+), 19 deletions(-) diff --git a/crates/core/src/parse.rs b/crates/core/src/parse.rs index b465beaf9e..33127c5e0a 100644 --- a/crates/core/src/parse.rs +++ b/crates/core/src/parse.rs @@ -49,6 +49,13 @@ pub fn parse_number_text_in(s: &str, sys: DateSystem) -> Option { parse_numeric(s.trim(), sys).map(|(n, _)| n) } +/// Whether typed cell input is a formula: it starts with `=`, or, as Lotus 1-2-3 users type it, +/// with `+` or `-` and isn't a number on its own. `+5+4` is the formula `=+5+4`, `-5` the number +/// -5, and a lone `+` or `-` is text. A leading space or apostrophe makes the input text. +pub fn starts_formula(input: &str) -> bool { + input.starts_with('=') || (input.len() > 1 && input.starts_with(['+', '-']) && parse_number_text(input).is_none()) +} + fn parse_numeric(t: &str, sys: DateSystem) -> Option<(f64, Option<&'static str>)> { if t.is_empty() { return None; @@ -363,6 +370,19 @@ mod tests { assert_eq!(p("1.2.3.4").value, Value::text("1.2.3.4")); } + #[test] + fn a_leading_sign_starts_a_formula_unless_the_entry_is_a_number() { + // #2023: Excel reads `+5+4` as `=+5+4`, as Lotus 1-2-3 did. + for s in ["=1", "=", "+5+4", "-5+4", "--5", "+-5", "-.5*2", "-3/4", "+A1", "-SUM(1,2)", "+(5+4)", "-abc", "--"] { + assert!(starts_formula(s), "{s}"); + } + // Signed numbers, percentages and currency stay numbers; a lone sign, a leading space or + // apostrophe and other text stay text. + for s in ["+5", "-5", "+5%", "-$5", "-1e3", "+.5", "-1,234.5", "+", "-", " +5+4", "'+5+4", "5+4", "", "a-b"] { + assert!(!starts_formula(s), "{s}"); + } + } + #[test] fn dates_and_times() { assert_eq!(p("10/7/2026").value, Value::Number(46302.0)); diff --git a/crates/engine/src/cmd/data.rs b/crates/engine/src/cmd/data.rs index 24bd043f7d..7b77953e1b 100644 --- a/crates/engine/src/cmd/data.rs +++ b/crates/engine/src/cmd/data.rs @@ -839,7 +839,8 @@ fn text_to_columns(s: &mut Session, p: &Json) -> Result { } } for (c, t) in out { - let cell = super::edit::input_to_cell(&t, sheet, c, &mut cx.wb).unwrap_or(None); + // A part that isn't a valid formula (`--`) stays text, as it does when pasted. + let cell = super::edit::input_to_cell(&t, sheet, c, &mut cx.wb).unwrap_or_else(|_| Some(Cell::value(Value::text(t.as_str())))); let shm = cx.sheet_mut(sheet)?; match cell { Some(x) => shm.set_cell(c, x), diff --git a/crates/engine/src/cmd/edit.rs b/crates/engine/src/cmd/edit.rs index fe7f1fe8bc..86b0eeeec7 100644 --- a/crates/engine/src/cmd/edit.rs +++ b/crates/engine/src/cmd/edit.rs @@ -131,12 +131,7 @@ pub(crate) fn input_to_cell(input: &str, sheet: usize, at: CellRef, wb: &mut gri if fmt_is_text { return Ok(Some(Cell { value: Value::text(input), formula: None, style })); } - let is_formula = input.starts_with('=') - || (input.len() > 1 - && (input.starts_with('+') || input.starts_with('-')) - && gridcraft_core::parse::parse_number_text(input).is_none() - && input.chars().nth(1).is_some_and(|c| c.is_ascii_alphabetic() || c == '(')); - if is_formula { + if gridcraft_core::parse::starts_formula(input) { let body = input.strip_prefix('=').unwrap_or(input); // Excel closes missing parentheses for you. let mut text = body.to_string(); diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 2ac2906548..506bd01915 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -202,6 +202,48 @@ fn enter_values_and_formulas() { assert_eq!(crate::display::cell_text(&d.wb, sh, CellRef::parse("B1").unwrap()), "12%"); } +#[test] +fn a_leading_plus_or_minus_starts_a_formula() { + // #2023: like Excel (and Lotus 1-2-3 before it), typing `+5+4` enters the formula `=+5+4`. + let mut s = s(); + let input = |s: &Session, a: &str| s.doc().unwrap().wb.active().unwrap().cell(CellRef::parse(a).unwrap()).map(|c| c.input_text()); + for (cell, typed, value) in + [("A1", "+5+4", 9.0), ("A2", "-5+4", -1.0), ("A3", "--5", 5.0), ("A4", "-3/4", -0.75), ("A5", "+A1*2", 18.0), ("A6", "-(A1)", -9.0)] + { + s.execute("cell.set", json!({"cell": cell, "input": typed})).unwrap_or_else(|e| panic!("{typed}: {e}")); + assert_eq!(input(&s, cell), Some(format!("={typed}")), "{typed}"); + assert_eq!(v(&s, cell), Value::Number(value), "{typed}"); + } + // A signed number is a number, a lone sign is text, and an apostrophe keeps the text. + for (typed, value) in [ + ("+5", Value::Number(5.0)), + ("-5", Value::Number(-5.0)), + ("-12%", Value::Number(-0.12)), + ("-$5", Value::Number(-5.0)), + ("-", Value::text("-")), + ("+", Value::text("+")), + ("'+5+4", Value::text("+5+4")), + ] { + s.execute("cell.set", json!({"cell": "B1", "input": typed})).unwrap(); + assert_eq!(v(&s, "B1"), value, "{typed}"); + assert!(!input(&s, "B1").is_some_and(|t| t.starts_with('=')), "{typed}"); + } + // Typed, a sign that doesn't start a valid formula is refused like `=--` and the cell keeps + // its value; pasted or split by Text to Columns it stays text. + s.execute("cell.set", json!({"cell": "C1", "input": "kept"})).unwrap(); + for typed in ["--", "+5+", "+49 170 1234567"] { + let e = s.execute("cell.set", json!({"cell": "C1", "input": typed})).unwrap_err().to_string(); + assert!(e.contains("problem with this formula"), "{typed}: {e}"); + assert_eq!(v(&s, "C1"), Value::text("kept"), "{typed}"); + } + s.execute("edit.paste", json!({"at": "D1", "text": "--\t-5+4\n"})).unwrap(); + assert_eq!(v(&s, "D1"), Value::text("--")); + assert_eq!(v(&s, "E1"), Value::Number(-1.0)); + s.execute("cell.set", json!({"cell": "F1", "input": "a,--,b"})).unwrap(); + s.execute("data.textToColumns", json!({"range": "F1", "delimiters": [","]})).unwrap(); + assert_eq!([v(&s, "F1"), v(&s, "G1"), v(&s, "H1")], [Value::text("a"), Value::text("--"), Value::text("b")]); +} + #[test] fn formulas_with_the_wrong_argument_count_are_refused_on_entry() { // #363: =DATEDIF(start, end) was stored and showed #VALUE!. Like Excel, entry refuses it and diff --git a/crates/ui-egui/src/formula_locale.rs b/crates/ui-egui/src/formula_locale.rs index 6e833b95db..26b7ac007d 100644 --- a/crates/ui-egui/src/formula_locale.rs +++ b/crates/ui-egui/src/formula_locale.rs @@ -20,14 +20,16 @@ pub(crate) fn canonical( if locale == FormulaLocale::En || wb.sheet(sheet).is_some_and(|sh| wb.styles.get(sh.style_id(cell)).num_fmt.as_str() == "@") { return Ok(text.to_string()); } - // Same formula detection as the engine's `input_to_cell` (no trimming: " =1" is text). - let body = text; - if body.starts_with('=') - || ((body.starts_with('+') || body.starts_with('-')) && body.chars().nth(1).is_some_and(|c| c.is_ascii_alphabetic() || c == '(')) - { + // Decimal-comma number entry follows the same preference, without rewriting text or dates. + let normalized = text.trim().replace(locale.decimal_separator(), "."); + let number = normalized.strip_suffix('%').unwrap_or(&normalized); + let is_number = number.parse::().is_ok_and(f64::is_finite); + // Same formula detection as the engine's `input_to_cell` (no trimming: " =1" is text), except + // that a signed number in this locale (`-1,5`) is a number, not a formula. + if !is_number && gridcraft_engine::core::parse::starts_formula(text) { let known = |name: &str| wb.name(name, sheet).is_some() || wb.table(name).is_some(); // Match the engine's existing convenience for missing closing parentheses. - let mut body = body.to_string(); + let mut body = text.to_string(); let mut expr = formula::parse_input(&body, locale, known); for _ in 0..8 { if expr.is_ok() { @@ -38,10 +40,7 @@ pub(crate) fn canonical( } return Ok(format!("={}", formula::print(&expr?))); } - // Decimal-comma number entry follows the same preference, without rewriting text or dates. - let normalized = body.trim().replace(locale.decimal_separator(), "."); - let number = normalized.strip_suffix('%').unwrap_or(&normalized); - if number.parse::().is_ok_and(f64::is_finite) { + if is_number { return Ok(normalized); } Ok(text.to_string()) @@ -138,3 +137,28 @@ pub(crate) fn display_template(text: &str, locale: FormulaLocale, wb: &Workbook, } display(text, locale, wb, sheet) } + +#[cfg(test)] +mod tests { + use gridcraft_engine::core::CellRef; + use gridcraft_engine::formula::FormulaLocale; + use gridcraft_engine::model::Workbook; + + use super::canonical; + + #[test] + fn a_leading_sign_starts_a_formula_in_spanish_too() { + // #2023: `+5+4` is a formula in every formula language; in Spanish `-1,5` stays the + // number -1.5 rather than becoming a formula. + let wb = Workbook::new(); + let at = CellRef::parse("A1").unwrap(); + let entry = |text: &str| canonical(text, FormulaLocale::Es, &wb, 0, at).ok(); + assert_eq!(entry("+5+4").as_deref(), Some("=+5+4")); + assert_eq!(entry("-5+4").as_deref(), Some("=-5+4")); + assert_eq!(entry("-SUMA(1;2)").as_deref(), Some("=-SUM(1,2)")); + assert_eq!(entry("-1,5").as_deref(), Some("-1.5")); + assert_eq!(entry("+2,5%").as_deref(), Some("+2.5%")); + assert_eq!(entry("-").as_deref(), Some("-")); + assert_eq!(entry("--"), None); + } +} diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 34cb502f54..64cf2810e1 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-19 · **Change:** minor (Ctrl+Enter fill gives each cell the automatic number format typing gives it; keytip letters typed with Alt held, #1846) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-20 · **Change:** minor (a leading + or - starts a formula, #2023) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4 Interaction, controls and feel, against Excel. Part of [target-app-parity.md](target-app-parity.md). **UI/UX fidelity: ~55% ready, 50–80 h** (estimated). Ribbon command coverage is measured @@ -47,7 +47,7 @@ this logic, with one undo step. | Selection outline glides to a new selection (Excel: "Provide feedback with animation") | done (10-11): 0.12 s, decelerating, with the fill and fill handle; View ▸ Animations (`view.animations`) turns it off. The timing is an estimate, not yet measured against Excel; the system's reduced-motion setting isn't followed yet | | Fill handle: drag to fill series, double-click to fill down, right-drag menu | fill done (Ctrl+drag swaps copy and series); right-drag menu missing | | Drag-move and drag-copy cells (border drag, Ctrl/Option, Shift to insert) | done (M3) | -| In-cell editing, Enter/Tab movement, Alt/Option+Enter line breaks | done | +| In-cell editing, Enter/Tab movement, Alt/Option+Enter line breaks | done; a leading `+` or `-` starts a formula, as in Excel (`+5+4` enters `=+5+4`, #2023) | | Point mode (click/drag/arrow references), reference colouring, F4 | done | | AutoComplete in columns, function autocomplete and argument tips | done; cell helpers clip to the worksheet and hide when the editor scrolls out (#200) | | Header resize and double-click AutoFit | done (#42, #88 for header dividers) | @@ -161,6 +161,7 @@ scrollbar bugs 2–4 · pixel/feel pass against observed Excel 7–12. | Date | Change | Summary | |---|---|---| +| 2026-10-20 | minor | Typing a leading `+` or `-` starts a formula whenever the entry isn't a number on its own, as in Excel: `+5+4` enters `=+5+4` and `-5+4` enters `=-5+4` (they stayed text; only a letter or `(` after the sign started one). `+5`, `-5` and `-$5` stay numbers, a lone `+` or `-` stays text, and an entry like `--` that isn't a valid formula is refused like `=--`; pasted or split by Text to Columns it stays text (#2023) | | 2026-10-19 | minor | Ctrl+Enter (`range.fill`) gives each cell what typing the input there gives: a General cell gets the automatic number format (`5%`, `$5`, `3/4/2026`, `=TODAY()`) even when it already held a value, and a cell with its own format, a formatted row or column, or Text keeps it. Cells that held a value used to keep General (`5%` showed 0.05), and empty cells took the active cell's format | | 2026-10-18 | minor | Keytip letters typed with left Alt held continue the sequence (Alt+H, O, A / Alt+H, O, I ran nothing before: Alt+letter cancelled keytips); other Alt combinations, AltGr and macOS Option are unchanged (#1846) | | 2026-10-12 | minor | The File view's recent list tells when each workbook was last changed, read off the UI thread | From 1af4d38e716f926781d36af7b09976a177964c09 Mon Sep 17 00:00:00 2001 From: kezmdor <15539254+kezmdor@users.noreply.github.com> Date: Tue, 20 Oct 2026 07:45:49 +0200 Subject: [PATCH 08/94] Formula entry: keep canonical's body binding, so the diff stays small Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/formula_locale.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/formula_locale.rs b/crates/ui-egui/src/formula_locale.rs index 26b7ac007d..132aef258a 100644 --- a/crates/ui-egui/src/formula_locale.rs +++ b/crates/ui-egui/src/formula_locale.rs @@ -20,16 +20,17 @@ pub(crate) fn canonical( if locale == FormulaLocale::En || wb.sheet(sheet).is_some_and(|sh| wb.styles.get(sh.style_id(cell)).num_fmt.as_str() == "@") { return Ok(text.to_string()); } + let body = text; // Decimal-comma number entry follows the same preference, without rewriting text or dates. - let normalized = text.trim().replace(locale.decimal_separator(), "."); + let normalized = body.trim().replace(locale.decimal_separator(), "."); let number = normalized.strip_suffix('%').unwrap_or(&normalized); let is_number = number.parse::().is_ok_and(f64::is_finite); // Same formula detection as the engine's `input_to_cell` (no trimming: " =1" is text), except // that a signed number in this locale (`-1,5`) is a number, not a formula. - if !is_number && gridcraft_engine::core::parse::starts_formula(text) { + if !is_number && gridcraft_engine::core::parse::starts_formula(body) { let known = |name: &str| wb.name(name, sheet).is_some() || wb.table(name).is_some(); // Match the engine's existing convenience for missing closing parentheses. - let mut body = text.to_string(); + let mut body = body.to_string(); let mut expr = formula::parse_input(&body, locale, known); for _ in 0..8 { if expr.is_ok() { From 0c78ddf79f5300c7e2df33da40ab567c9eaf05c4 Mon Sep 17 00:00:00 2001 From: kezmdor <15539254+kezmdor@users.noreply.github.com> Date: Tue, 20 Oct 2026 08:04:50 +0200 Subject: [PATCH 09/94] Formula entry: a + or - entry that isn't a valid formula stays text Observed in Excel for the web: `--`, `-----`, `+5+` and `+49 170 1234567` stay text, and `- item` is #NAME?. Only `=` entries are refused. Entry now tries a `+`/`-` entry as `=` followed by the entry and, when that doesn't parse, reads it as a number or text as before; the Spanish formula path does the same with its parser. Text to Columns no longer needs its own text fallback, so that change is dropped. Co-Authored-By: Claude Opus 5.5 --- crates/core/src/parse.rs | 7 ++++--- crates/engine/src/cmd/data.rs | 3 +-- crates/engine/src/cmd/edit.rs | 10 +++++++++- crates/engine/src/tests.rs | 19 ++++++++++++------- crates/ui-egui/src/formula_locale.rs | 16 ++++++++++++---- docs/ui-parity.md | 2 +- 6 files changed, 39 insertions(+), 18 deletions(-) diff --git a/crates/core/src/parse.rs b/crates/core/src/parse.rs index 33127c5e0a..949f9909f9 100644 --- a/crates/core/src/parse.rs +++ b/crates/core/src/parse.rs @@ -49,9 +49,10 @@ pub fn parse_number_text_in(s: &str, sys: DateSystem) -> Option { parse_numeric(s.trim(), sys).map(|(n, _)| n) } -/// Whether typed cell input is a formula: it starts with `=`, or, as Lotus 1-2-3 users type it, -/// with `+` or `-` and isn't a number on its own. `+5+4` is the formula `=+5+4`, `-5` the number -/// -5, and a lone `+` or `-` is text. A leading space or apostrophe makes the input text. +/// Whether typed cell input is meant as a formula: it starts with `=`, or, as Lotus 1-2-3 users +/// type it, with `+` or `-` and isn't a number on its own (`+5+4` is `=+5+4`, `-5` the number -5, +/// a lone `+` or `-` text). A leading space or apostrophe makes the input text. Callers parse +/// the formula; a `+` or `-` entry that doesn't parse (`--`) stays text, as in Excel. pub fn starts_formula(input: &str) -> bool { input.starts_with('=') || (input.len() > 1 && input.starts_with(['+', '-']) && parse_number_text(input).is_none()) } diff --git a/crates/engine/src/cmd/data.rs b/crates/engine/src/cmd/data.rs index 7b77953e1b..24bd043f7d 100644 --- a/crates/engine/src/cmd/data.rs +++ b/crates/engine/src/cmd/data.rs @@ -839,8 +839,7 @@ fn text_to_columns(s: &mut Session, p: &Json) -> Result { } } for (c, t) in out { - // A part that isn't a valid formula (`--`) stays text, as it does when pasted. - let cell = super::edit::input_to_cell(&t, sheet, c, &mut cx.wb).unwrap_or_else(|_| Some(Cell::value(Value::text(t.as_str())))); + let cell = super::edit::input_to_cell(&t, sheet, c, &mut cx.wb).unwrap_or(None); let shm = cx.sheet_mut(sheet)?; match cell { Some(x) => shm.set_cell(c, x), diff --git a/crates/engine/src/cmd/edit.rs b/crates/engine/src/cmd/edit.rs index 86b0eeeec7..cfdd1abeba 100644 --- a/crates/engine/src/cmd/edit.rs +++ b/crates/engine/src/cmd/edit.rs @@ -131,7 +131,15 @@ pub(crate) fn input_to_cell(input: &str, sheet: usize, at: CellRef, wb: &mut gri if fmt_is_text { return Ok(Some(Cell { value: Value::text(input), formula: None, style })); } - if gridcraft_core::parse::starts_formula(input) { + // As in Excel, a `+` or `-` entry is a formula when it reads as one (`+5+4` enters `=+5+4`) + // and text when it doesn't (`--`, `+49 170 1234567`); only `=` entries are refused. + if !input.starts_with('=') + && gridcraft_core::parse::starts_formula(input) + && let Ok(cell) = input_to_cell(&format!("={input}"), sheet, at, wb) + { + return Ok(cell); + } + if input.starts_with('=') { let body = input.strip_prefix('=').unwrap_or(input); // Excel closes missing parentheses for you. let mut text = body.to_string(); diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 506bd01915..7af82fbfc4 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -228,14 +228,19 @@ fn a_leading_plus_or_minus_starts_a_formula() { assert_eq!(v(&s, "B1"), value, "{typed}"); assert!(!input(&s, "B1").is_some_and(|t| t.starts_with('=')), "{typed}"); } - // Typed, a sign that doesn't start a valid formula is refused like `=--` and the cell keeps - // its value; pasted or split by Text to Columns it stays text. - s.execute("cell.set", json!({"cell": "C1", "input": "kept"})).unwrap(); - for typed in ["--", "+5+", "+49 170 1234567"] { - let e = s.execute("cell.set", json!({"cell": "C1", "input": typed})).unwrap_err().to_string(); - assert!(e.contains("problem with this formula"), "{typed}: {e}"); - assert_eq!(v(&s, "C1"), Value::text("kept"), "{typed}"); + // As observed in Excel for the web, an entry that doesn't read as a formula stays text, and + // one that does but names nothing known is #NAME?. Only `=` entries are refused. + for typed in ["--", "-----", "+5+", "+49 170 1234567"] { + s.execute("cell.set", json!({"cell": "C1", "input": typed})).unwrap_or_else(|e| panic!("{typed}: {e}")); + assert_eq!(v(&s, "C1"), Value::text(typed), "{typed}"); + assert_eq!(input(&s, "C1").as_deref(), Some(typed), "{typed}"); } + s.execute("cell.set", json!({"cell": "C2", "input": "- item"})).unwrap(); + assert_eq!(v(&s, "C2"), Value::Error(gridcraft_core::CellError::Name)); + let e = s.execute("cell.set", json!({"cell": "C1", "input": "=--"})).unwrap_err().to_string(); + assert!(e.contains("problem with this formula"), "{e}"); + assert_eq!(v(&s, "C1"), Value::text("+49 170 1234567"), "a refused entry keeps the cell"); + // Pasted or split by Text to Columns, the same rule applies. s.execute("edit.paste", json!({"at": "D1", "text": "--\t-5+4\n"})).unwrap(); assert_eq!(v(&s, "D1"), Value::text("--")); assert_eq!(v(&s, "E1"), Value::Number(-1.0)); diff --git a/crates/ui-egui/src/formula_locale.rs b/crates/ui-egui/src/formula_locale.rs index 132aef258a..dcc4d6db50 100644 --- a/crates/ui-egui/src/formula_locale.rs +++ b/crates/ui-egui/src/formula_locale.rs @@ -25,9 +25,14 @@ pub(crate) fn canonical( let normalized = body.trim().replace(locale.decimal_separator(), "."); let number = normalized.strip_suffix('%').unwrap_or(&normalized); let is_number = number.parse::().is_ok_and(f64::is_finite); - // Same formula detection as the engine's `input_to_cell` (no trimming: " =1" is text), except - // that a signed number in this locale (`-1,5`) is a number, not a formula. - if !is_number && gridcraft_engine::core::parse::starts_formula(body) { + // Same formula detection as the engine's `input_to_cell` (no trimming: " =1" is text): a `+` + // or `-` entry is a formula when it reads as one and text when it doesn't, and a signed number + // in this locale (`-1,5`) is a number. The apostrophe keeps the engine from reading such text + // again in English syntax. + if !body.starts_with('=') && !is_number && gridcraft_engine::core::parse::starts_formula(body) { + return Ok(canonical(&format!("={body}"), locale, wb, sheet, cell).unwrap_or_else(|_| format!("'{body}"))); + } + if body.starts_with('=') { let known = |name: &str| wb.name(name, sheet).is_some() || wb.table(name).is_some(); // Match the engine's existing convenience for missing closing parentheses. let mut body = body.to_string(); @@ -160,6 +165,9 @@ mod tests { assert_eq!(entry("-1,5").as_deref(), Some("-1.5")); assert_eq!(entry("+2,5%").as_deref(), Some("+2.5%")); assert_eq!(entry("-").as_deref(), Some("-")); - assert_eq!(entry("--"), None); + // An entry that doesn't read as a formula stays text; only `=` entries are refused. + assert_eq!(entry("--").as_deref(), Some("'--")); + assert_eq!(entry("+34 612 345 678").as_deref(), Some("'+34 612 345 678")); + assert_eq!(entry("=--"), None); } } diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 64cf2810e1..06e2039841 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -161,7 +161,7 @@ scrollbar bugs 2–4 · pixel/feel pass against observed Excel 7–12. | Date | Change | Summary | |---|---|---| -| 2026-10-20 | minor | Typing a leading `+` or `-` starts a formula whenever the entry isn't a number on its own, as in Excel: `+5+4` enters `=+5+4` and `-5+4` enters `=-5+4` (they stayed text; only a letter or `(` after the sign started one). `+5`, `-5` and `-$5` stay numbers, a lone `+` or `-` stays text, and an entry like `--` that isn't a valid formula is refused like `=--`; pasted or split by Text to Columns it stays text (#2023) | +| 2026-10-20 | minor | Typing a leading `+` or `-` starts a formula whenever the entry isn't a number on its own, as in Excel: `+5+4` enters `=+5+4` and `-5+4` enters `=-5+4` (they stayed text; only a letter or `(` after the sign started one). `+5`, `-5` and `-$5` stay numbers, and a lone `+` or `-` and an entry that doesn't read as a formula (`--`, `+49 170 1234567`) stay text, as observed in Excel for the web; only `=` entries are refused (#2023) | | 2026-10-19 | minor | Ctrl+Enter (`range.fill`) gives each cell what typing the input there gives: a General cell gets the automatic number format (`5%`, `$5`, `3/4/2026`, `=TODAY()`) even when it already held a value, and a cell with its own format, a formatted row or column, or Text keeps it. Cells that held a value used to keep General (`5%` showed 0.05), and empty cells took the active cell's format | | 2026-10-18 | minor | Keytip letters typed with left Alt held continue the sequence (Alt+H, O, A / Alt+H, O, I ran nothing before: Alt+letter cancelled keytips); other Alt combinations, AltGr and macOS Option are unchanged (#1846) | | 2026-10-12 | minor | The File view's recent list tells when each workbook was last changed, read off the UI thread | From fdad356fd25aa95166c5150a6e6aca5cb877f13a Mon Sep 17 00:00:00 2001 From: kezmdor <15539254+kezmdor@users.noreply.github.com> Date: Tue, 20 Oct 2026 08:39:07 +0200 Subject: [PATCH 10/94] AutoSum on one cell proposes its range in the editor, like Excel (fixes #1834) AutoSum from the ribbon or keyboard entered `=SUM(range)` at once, so the range could only be changed by editing the formula afterwards. On one cell it now runs with `enter: false` and leaves `=SUM(B2:B4)` in the editor with `B2:B4` pointed and selected: a click, drag, arrow key or typing replaces it, and Enter enters the formula. With nothing to sum the caret waits between the parentheses of `=SUM()`. A block still gets its totals at once, and programmatic `formulas.autoSum` (control channel, CLI, MCP) is unchanged. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/editor.rs | 43 ++++++ crates/ui-egui/src/formula_bar.rs | 6 +- crates/ui-egui/src/lib.rs | 22 +++ crates/ui-egui/tests/autosum_edit.rs | 149 +++++++++++++++++++++ crates/ui-egui/tests/keyboard_shortcuts.rs | 7 +- docs/ui-parity.md | 5 +- 6 files changed, 226 insertions(+), 6 deletions(-) create mode 100644 crates/ui-egui/tests/autosum_edit.rs diff --git a/crates/ui-egui/src/editor.rs b/crates/ui-egui/src/editor.rs index 799109f890..64fa3627d5 100644 --- a/crates/ui-egui/src/editor.rs +++ b/crates/ui-egui/src/editor.rs @@ -41,6 +41,8 @@ pub struct EditState { pub completion: Option, /// Move the caret to the end on the next frame. pub caret_to_end: bool, + /// Select from this char index to `caret` when the caret is next pushed into the widget. + pub select_from: Option, } impl EditState { @@ -62,6 +64,7 @@ impl EditState { sync_caret: true, caret_to_end: true, completion: None, + select_from: None, } } @@ -107,6 +110,23 @@ impl EditState { self.sync_caret = true; } + /// Points and selects the argument of the call that ends the text, as AutoSum proposes it + /// (`=SUM(B1:B3)`): a click, drag, arrow key or typing replaces `B1:B3`. An arrow key moves + /// from the range's first cell, as in Excel: ↑ on `=SUM(A2:A4)` gives `=SUM(A1)`. With no + /// argument (`=SUM()`) the caret goes between the parentheses. + pub fn point_last_argument(&mut self) { + let Some(open) = self.text.rfind('(') else { return }; + let Some(close) = self.text.len().checked_sub(1).filter(|&c| c > open && self.text.ends_with(')')) else { return }; + let chars = |byte: usize| self.text.get(..byte).map_or(0, |t| t.chars().count()); + let (start, end) = (open + 1, close); + self.caret = chars(end); + self.point = (start < end).then_some((start, end)); + self.select_from = (start < end).then(|| chars(start)); + self.point_cell = self.text.get(start..end).and_then(RangeRef::parse).map(|r| r.start); + self.caret_to_end = false; + self.sync_caret = true; + } + /// Updates function autocomplete for the word before the caret. pub fn update_autocomplete(&mut self, names: &[String]) { self.autocomplete.clear(); @@ -316,6 +336,29 @@ mod tests { assert!(!e2.can_point()); } + #[test] + fn autosum_points_and_selects_its_proposed_range() { + // #1834: Excel leaves AutoSum's range ready to be replaced by pointing or typing. + let mut e = EditState::new(0, CellRef::new(3, 0), "=SUM(A1:A3)".into(), true, false); + e.point_last_argument(); + assert!(e.can_point()); + assert_eq!((e.caret, e.select_from, e.point), (10, Some(5), Some((5, 10)))); + assert_eq!(e.point_cell, Some(CellRef::new(0, 0)), "arrow keys move from the range's first cell"); + e.insert_ref("A2"); + assert_eq!(e.text, "=SUM(A2)"); + // No proposal: the caret waits between the parentheses. + let mut e = EditState::new(0, CellRef::new(3, 0), "=SUMA()".into(), true, false); + e.point_last_argument(); + assert!(e.can_point()); + assert_eq!((e.caret, e.select_from, e.point), (6, None, None)); + e.insert_ref("B2"); + assert_eq!(e.text, "=SUMA(B2)"); + // Text without a closing call is left alone. + let mut e = EditState::new(0, CellRef::new(3, 0), "=SUM(".into(), true, false); + e.point_last_argument(); + assert_eq!((e.caret, e.point), (5, None)); + } + #[test] fn autocomplete_and_hints() { let names: Vec = ["SUM", "SUMIF", "SUMPRODUCT", "AVERAGE"].iter().map(|s| s.to_string()).collect(); diff --git a/crates/ui-egui/src/formula_bar.rs b/crates/ui-egui/src/formula_bar.rs index 7f1ad87fc1..012a570d01 100644 --- a/crates/ui-egui/src/formula_bar.rs +++ b/crates/ui-egui/src/formula_bar.rs @@ -298,7 +298,11 @@ pub fn editor_widget(app: &mut SheetApp, ui: &mut egui::Ui, id: egui::Id, font: ed.request_focus = false; ed.sync_caret = false; let cursor = egui::text::CCursor::new(ed.caret); - output.state.cursor.set_char_range(Some(egui::text::CCursorRange::one(cursor))); + let range = match ed.select_from.take() { + Some(from) => egui::text::CCursorRange::two(egui::text::CCursor::new(from), cursor), + None => egui::text::CCursorRange::one(cursor), + }; + output.state.cursor.set_char_range(Some(range)); output.state.store(ui.ctx(), id); } else if resp.clicked() || resp.gained_focus() { // Clicking into the other editor moves editing there. diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index f549aec2b5..4704ef20d2 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -528,11 +528,33 @@ impl SheetApp { if id == "file.exportPdf" && self.services.pick_save.is_some() && params.get("path").and_then(Json::as_str).is_none_or(str::is_empty) { return self.export_pdf_with_picker(params); } + // Menu-style AutoSum on one cell proposes its formula in the editor with the range + // pointed and selected, so a click, drag, arrow key or typing replaces it, as in Excel. + // Programmatic callers use `run` and get the total entered. + if id == "formulas.autoSum" && params.get("range").is_none() && self.session.active().is_some_and(|d| d.selection.current().is_single()) { + return self.auto_sum_in_editor(params); + } if let Err(e) = self.run(id, params) { self.alert(e); } } + fn auto_sum_in_editor(&mut self, params: Json) { + let mut params = if params.is_object() { params } else { json!({}) }; + if let Some(map) = params.as_object_mut() { + map.insert("enter".into(), Json::Bool(false)); + } + if let Err(e) = self.run("formulas.autoSum", params) { + return self.alert(e); + } + if let Some(ed) = self.editor.as_mut() { + ed.point_last_argument(); + if ed.can_point() { + self.session.mode = gridcraft_engine::Mode::Point; + } + } + } + /// Asks for a `.pdf` path with the save picker, then re-runs `file.exportPdf` with it. Other /// params (range, sheets, fitToPage) are kept. A cancelled picker does nothing. fn export_pdf_with_picker(&mut self, mut params: Json) { diff --git a/crates/ui-egui/tests/autosum_edit.rs b/crates/ui-egui/tests/autosum_edit.rs new file mode 100644 index 0000000000..eae1da4079 --- /dev/null +++ b/crates/ui-egui/tests/autosum_edit.rs @@ -0,0 +1,149 @@ +//! AutoSum from the ribbon or keyboard on one cell proposes its formula in the editor, with the +//! range ready to be replaced by pointing or typing, as in Excel (#1834). + +use egui::{Event, Key, Modifiers, PointerButton, Pos2}; +use gridcraft_engine::core::{CellRef, Value}; +use gridcraft_engine::{Mode, Session}; +use gridcraft_ui_egui::{SheetApp, grid::Geo}; +use serde_json::json; + +type Harness = egui_kittest::Harness<'static, SheetApp>; + +/// 1, 2, 3 in A1:A3 and `selected` selected. +fn harness(selected: &str) -> Harness { + harness_at("A1", selected) +} + +/// 1, 2, 3 down from `first` and `selected` selected. +fn harness_at(first: &str, selected: &str) -> Harness { + let mut session = Session::new(); + session.new_workbook(); + session.execute("range.setValues", json!({"range": first, "values": [[1], [2], [3]]})).unwrap(); + session.execute("selection.set", json!({"range": selected})).unwrap(); + let mut h = egui_kittest::Harness::builder().with_size(egui::vec2(1200.0, 800.0)).build_ui_state( + |ui, app: &mut SheetApp| { + app.logic(ui.ctx()); + app.ui(ui); + }, + SheetApp::new(session, Default::default()), + ); + h.run_steps(4); + h +} + +/// The AutoSum button: a menu-style run. +fn auto_sum(h: &mut Harness) { + h.state_mut().run_or_alert("formulas.autoSum", json!({})); + h.run_steps(2); +} + +fn editing(h: &Harness) -> Option { + h.state().editor.as_ref().map(|e| e.text.clone()) +} + +fn input(h: &Harness, cell: &str) -> String { + h.state().session.active().unwrap().wb.active().unwrap().input_text(CellRef::parse(cell).unwrap()) +} + +fn cell_center(h: &Harness, cell: &str) -> Pos2 { + let app = h.state(); + let sheet = app.session.active().unwrap().wb.active().unwrap(); + let geo = Geo::new(sheet, app.grid.rect.unwrap(), app.view().scroll); + geo.cell_rect(sheet, CellRef::parse(cell).unwrap()).center() +} + +fn pointer(h: &mut Harness, cell: &str, pressed: bool) { + let pos = cell_center(h, cell); + h.input_mut() + .events + .extend([Event::PointerMoved(pos), Event::PointerButton { pos, button: PointerButton::Primary, pressed, modifiers: Modifiers::NONE }]); + h.run_steps(2); +} + +fn enter(h: &mut Harness) { + for pressed in [true, false] { + h.input_mut().events.push(Event::Key { key: Key::Enter, physical_key: None, pressed, repeat: false, modifiers: Modifiers::NONE }); + } + h.run_steps(2); +} + +#[test] +fn autosum_on_one_cell_proposes_its_range_in_the_editor() { + let mut h = harness("A4"); + auto_sum(&mut h); + assert_eq!(editing(&h).as_deref(), Some("=SUM(A1:A3)")); + assert_eq!(h.state().session.mode, Mode::Point); + assert_eq!(input(&h, "A4"), "", "nothing is entered before Enter"); + enter(&mut h); + assert_eq!(input(&h, "A4"), "=SUM(A1:A3)"); + assert_eq!(h.state().session.active().unwrap().wb.active().unwrap().value(CellRef::parse("A4").unwrap()), Value::Number(6.0)); +} + +#[test] +fn a_click_or_drag_replaces_the_proposed_range() { + let mut h = harness("A4"); + auto_sum(&mut h); + pointer(&mut h, "A2", true); + pointer(&mut h, "A2", false); + assert_eq!(editing(&h).as_deref(), Some("=SUM(A2)")); + + let mut h = harness("A4"); + auto_sum(&mut h); + pointer(&mut h, "A1", true); + let to = cell_center(&h, "A2"); + for pos in [to, to + egui::vec2(1.0, 0.0)] { + h.input_mut().events.push(Event::PointerMoved(pos)); + h.step(); + } + pointer(&mut h, "A2", false); + assert_eq!(editing(&h).as_deref(), Some("=SUM(A1:A2)")); + enter(&mut h); + assert_eq!(input(&h, "A4"), "=SUM(A1:A2)"); +} + +#[test] +fn an_arrow_key_points_from_the_proposed_range() { + // Observed in Excel for the web: ↑ after AutoSum moves from the range's first cell. + let mut h = harness_at("A2", "A5"); + auto_sum(&mut h); + assert_eq!(editing(&h).as_deref(), Some("=SUM(A2:A4)")); + for pressed in [true, false] { + h.input_mut().events.push(Event::Key { key: Key::ArrowUp, physical_key: None, pressed, repeat: false, modifiers: Modifiers::NONE }); + } + h.run_steps(2); + assert_eq!(editing(&h).as_deref(), Some("=SUM(A1)")); +} + +#[test] +fn typing_replaces_the_proposed_range() { + let mut h = harness("A4"); + auto_sum(&mut h); + h.input_mut().events.push(Event::Text("A2:A3".into())); + h.run_steps(2); + assert_eq!(editing(&h).as_deref(), Some("=SUM(A2:A3)")); +} + +#[test] +fn with_nothing_to_sum_the_caret_waits_between_the_parentheses() { + let mut h = harness("C10"); + auto_sum(&mut h); + assert_eq!(editing(&h).as_deref(), Some("=SUM()")); + pointer(&mut h, "A1", true); + pointer(&mut h, "A1", false); + assert_eq!(editing(&h).as_deref(), Some("=SUM(A1)")); +} + +#[test] +fn a_block_and_programmatic_calls_enter_the_totals_at_once() { + let mut h = harness("A1:A4"); + auto_sum(&mut h); + assert!(h.state().editor.is_none()); + assert_eq!(input(&h, "A4"), "=SUM(A1:A3)"); + + // The control channel, CLI and MCP run commands with `run`: no editor. + let mut h = harness("A4"); + h.state_mut().run("formulas.autoSum", json!({})).unwrap(); + h.run_steps(2); + assert!(h.state().editor.is_none()); + assert_eq!(input(&h, "A4"), "=SUM(A1:A3)"); +} diff --git a/crates/ui-egui/tests/keyboard_shortcuts.rs b/crates/ui-egui/tests/keyboard_shortcuts.rs index 78bc966f51..5fc62f1e0f 100644 --- a/crates/ui-egui/tests/keyboard_shortcuts.rs +++ b/crates/ui-egui/tests/keyboard_shortcuts.rs @@ -235,9 +235,10 @@ fn alt_equals_autosum_does_not_also_type_the_equals_sign() { for (selected, cell, formula) in [("A4", "A4", "=SUM(A1:A3)"), ("C3", "C3", "=SUM(A3:B3)"), ("A1:B3", "B4", "=SUM(B1:B3)")] { let mut h = harness(book(selected)); alt_equals(&mut h); - assert_eq!(input(&h, cell), formula, "Alt+= on {selected}"); - assert!(h.state().editor.is_none(), "Alt+= on {selected} started an edit"); - // Enter moves on: there is no stray `=` edit to commit. + // One cell: the formula waits in the editor for Enter, as in Excel (#1834); a block gets + // its totals at once. Either way without a stray `=`. + let editing = h.state().editor.as_ref().map(|e| e.text.clone()); + assert_eq!(editing.as_deref(), (!selected.contains(':')).then_some(formula), "Alt+= on {selected}"); key(&mut h, Key::Enter, Modifiers::NONE); assert!(h.state().message.is_none(), "Alt+= on {selected}: {:?}", h.state().message); assert_eq!(input(&h, cell), formula); diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 34cb502f54..2de457262c 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-19 · **Change:** minor (Ctrl+Enter fill gives each cell the automatic number format typing gives it; keytip letters typed with Alt held, #1846) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-20 · **Change:** minor (AutoSum on one cell proposes its range in the editor, #1834) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4 Interaction, controls and feel, against Excel. Part of [target-app-parity.md](target-app-parity.md). **UI/UX fidelity: ~55% ready, 50–80 h** (estimated). Ribbon command coverage is measured @@ -48,7 +48,7 @@ this logic, with one undo step. | Fill handle: drag to fill series, double-click to fill down, right-drag menu | fill done (Ctrl+drag swaps copy and series); right-drag menu missing | | Drag-move and drag-copy cells (border drag, Ctrl/Option, Shift to insert) | done (M3) | | In-cell editing, Enter/Tab movement, Alt/Option+Enter line breaks | done | -| Point mode (click/drag/arrow references), reference colouring, F4 | done | +| Point mode (click/drag/arrow references), reference colouring, F4 | done; AutoSum on one cell leaves its proposed range pointed and selected (#1834) | | AutoComplete in columns, function autocomplete and argument tips | done; cell helpers clip to the worksheet and hide when the editor scrolls out (#200) | | Header resize and double-click AutoFit | done (#42, #88 for header dividers) | | Outline symbols for grouped rows / columns (band beside the headers, brackets, − / +, level buttons 1…n+1) | done (#373): clicks run `data.hideDetail` / `data.showDetail` / `data.showLevels`, frozen panes and right-to-left sheets included; summary rows/columns are always below/right (the "Summary rows below detail" setting isn't modelled), no "Show outline symbols" option yet, and a block of cells still groups rows without the Rows / Columns dialog | @@ -161,6 +161,7 @@ scrollbar bugs 2–4 · pixel/feel pass against observed Excel 7–12. | Date | Change | Summary | |---|---|---| +| 2026-10-20 | minor | AutoSum from the ribbon or keyboard on one cell proposes `=SUM(range)` in the editor instead of entering it, with the range pointed and selected: a click, drag, arrow key or typing replaces it and Enter enters it, as in Excel. With nothing to sum the caret waits inside `=SUM()`. A block still gets its totals at once, and programmatic `formulas.autoSum` is unchanged (#1834) | | 2026-10-19 | minor | Ctrl+Enter (`range.fill`) gives each cell what typing the input there gives: a General cell gets the automatic number format (`5%`, `$5`, `3/4/2026`, `=TODAY()`) even when it already held a value, and a cell with its own format, a formatted row or column, or Text keeps it. Cells that held a value used to keep General (`5%` showed 0.05), and empty cells took the active cell's format | | 2026-10-18 | minor | Keytip letters typed with left Alt held continue the sequence (Alt+H, O, A / Alt+H, O, I ran nothing before: Alt+letter cancelled keytips); other Alt combinations, AltGr and macOS Option are unchanged (#1846) | | 2026-10-12 | minor | The File view's recent list tells when each workbook was last changed, read off the UI thread | From 132bd4e9a8fa99befcae74ef8b7af1910dd6c98f Mon Sep 17 00:00:00 2001 From: kezmdor <15539254+kezmdor@users.noreply.github.com> Date: Tue, 20 Oct 2026 08:59:30 +0200 Subject: [PATCH 11/94] AutoSum: test the menu functions; keep the new editor method clear of #1056 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Home › AutoSum ▾ Average proposes `=AVERAGE(range)` the same way (and so will Formulas › AutoSum once it has the menu, #658). `point_last_argument` moves to the end of `impl EditState`, so this PR no longer touches the lines #1056 and #1838 change after `insert_ref`. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/editor.rs | 34 ++++++++++++++-------------- crates/ui-egui/tests/autosum_edit.rs | 12 ++++++++++ 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/crates/ui-egui/src/editor.rs b/crates/ui-egui/src/editor.rs index 64fa3627d5..2061a0dbda 100644 --- a/crates/ui-egui/src/editor.rs +++ b/crates/ui-egui/src/editor.rs @@ -110,23 +110,6 @@ impl EditState { self.sync_caret = true; } - /// Points and selects the argument of the call that ends the text, as AutoSum proposes it - /// (`=SUM(B1:B3)`): a click, drag, arrow key or typing replaces `B1:B3`. An arrow key moves - /// from the range's first cell, as in Excel: ↑ on `=SUM(A2:A4)` gives `=SUM(A1)`. With no - /// argument (`=SUM()`) the caret goes between the parentheses. - pub fn point_last_argument(&mut self) { - let Some(open) = self.text.rfind('(') else { return }; - let Some(close) = self.text.len().checked_sub(1).filter(|&c| c > open && self.text.ends_with(')')) else { return }; - let chars = |byte: usize| self.text.get(..byte).map_or(0, |t| t.chars().count()); - let (start, end) = (open + 1, close); - self.caret = chars(end); - self.point = (start < end).then_some((start, end)); - self.select_from = (start < end).then(|| chars(start)); - self.point_cell = self.text.get(start..end).and_then(RangeRef::parse).map(|r| r.start); - self.caret_to_end = false; - self.sync_caret = true; - } - /// Updates function autocomplete for the word before the caret. pub fn update_autocomplete(&mut self, names: &[String]) { self.autocomplete.clear(); @@ -211,6 +194,23 @@ impl EditState { } None } + + /// Points and selects the argument of the call that ends the text, as AutoSum proposes it + /// (`=SUM(B1:B3)`): a click, drag, arrow key or typing replaces `B1:B3`. An arrow key moves + /// from the range's first cell, as in Excel: ↑ on `=SUM(A2:A4)` gives `=SUM(A1)`. With no + /// argument (`=SUM()`) the caret goes between the parentheses. + pub fn point_last_argument(&mut self) { + let Some(open) = self.text.rfind('(') else { return }; + let Some(close) = self.text.len().checked_sub(1).filter(|&c| c > open && self.text.ends_with(')')) else { return }; + let chars = |byte: usize| self.text.get(..byte).map_or(0, |t| t.chars().count()); + let (start, end) = (open + 1, close); + self.caret = chars(end); + self.point = (start < end).then_some((start, end)); + self.select_from = (start < end).then(|| chars(start)); + self.point_cell = self.text.get(start..end).and_then(RangeRef::parse).map(|r| r.start); + self.caret_to_end = false; + self.sync_caret = true; + } } /// References in formula text with their byte spans and colour index (same reference text ⇒ diff --git a/crates/ui-egui/tests/autosum_edit.rs b/crates/ui-egui/tests/autosum_edit.rs index eae1da4079..a1bc0342bf 100644 --- a/crates/ui-egui/tests/autosum_edit.rs +++ b/crates/ui-egui/tests/autosum_edit.rs @@ -79,6 +79,18 @@ fn autosum_on_one_cell_proposes_its_range_in_the_editor() { assert_eq!(h.state().session.active().unwrap().wb.active().unwrap().value(CellRef::parse("A4").unwrap()), Value::Number(6.0)); } +#[test] +fn the_autosum_menu_functions_propose_theirs_the_same_way() { + // Home › AutoSum ▾ Average (and Formulas › AutoSum ▾ once it has the menu, #658). + let mut h = harness("A4"); + h.state_mut().run_or_alert("formulas.autoSum", json!({"function": "AVERAGE"})); + h.run_steps(2); + assert_eq!(editing(&h).as_deref(), Some("=AVERAGE(A1:A3)")); + pointer(&mut h, "A2", true); + pointer(&mut h, "A2", false); + assert_eq!(editing(&h).as_deref(), Some("=AVERAGE(A2)")); +} + #[test] fn a_click_or_drag_replaces_the_proposed_range() { let mut h = harness("A4"); From 601cc60cfcaf15e8f3db0526cbdf26083b4fa4ac Mon Sep 17 00:00:00 2001 From: kezmdor <15539254+kezmdor@users.noreply.github.com> Date: Tue, 20 Oct 2026 09:17:48 +0200 Subject: [PATCH 12/94] AutoSum: a `range` that isn't text counts as no range, as in the engine `formulas.autoSum` reads `range` with `str_param`, so `{"range": null}` means the selection; the UI's check for the editor proposal now reads it the same way (CodeRabbit review). Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/lib.rs | 7 ++++++- crates/ui-egui/tests/autosum_edit.rs | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 4704ef20d2..1606a85473 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -531,7 +531,10 @@ impl SheetApp { // Menu-style AutoSum on one cell proposes its formula in the editor with the range // pointed and selected, so a click, drag, arrow key or typing replaces it, as in Excel. // Programmatic callers use `run` and get the total entered. - if id == "formulas.autoSum" && params.get("range").is_none() && self.session.active().is_some_and(|d| d.selection.current().is_single()) { + if id == "formulas.autoSum" + && params.get("range").and_then(Json::as_str).is_none() + && self.session.active().is_some_and(|d| d.selection.current().is_single()) + { return self.auto_sum_in_editor(params); } if let Err(e) = self.run(id, params) { @@ -539,6 +542,8 @@ impl SheetApp { } } + /// Runs AutoSum on the active cell without entering it (`enter: false`) and points the + /// proposed range in the editor that opens. fn auto_sum_in_editor(&mut self, params: Json) { let mut params = if params.is_object() { params } else { json!({}) }; if let Some(map) = params.as_object_mut() { diff --git a/crates/ui-egui/tests/autosum_edit.rs b/crates/ui-egui/tests/autosum_edit.rs index a1bc0342bf..9f76bf8a8d 100644 --- a/crates/ui-egui/tests/autosum_edit.rs +++ b/crates/ui-egui/tests/autosum_edit.rs @@ -77,6 +77,12 @@ fn autosum_on_one_cell_proposes_its_range_in_the_editor() { enter(&mut h); assert_eq!(input(&h, "A4"), "=SUM(A1:A3)"); assert_eq!(h.state().session.active().unwrap().wb.active().unwrap().value(CellRef::parse("A4").unwrap()), Value::Number(6.0)); + + // A `range` that isn't text is no range, for the engine and here alike. + let mut h = harness("A4"); + h.state_mut().run_or_alert("formulas.autoSum", json!({"range": null})); + h.run_steps(2); + assert_eq!(editing(&h).as_deref(), Some("=SUM(A1:A3)")); } #[test] From db2ff1722990e6708999024d96337276cfefee35 Mon Sep 17 00:00:00 2001 From: MarekSpodBiedry <73122968+MarekSpodBiedry@users.noreply.github.com> Date: Thu, 22 Oct 2026 21:05:11 +0200 Subject: [PATCH 13/94] Wayland: wheel without Ctrl scrolls again after a Ctrl+wheel zoom (#2213) --- crates/ui-egui/src/grid.rs | 58 ++++++++++++++++++++++++++++++++++++++ crates/ui-egui/src/lib.rs | 7 +++++ 2 files changed, 65 insertions(+) diff --git a/crates/ui-egui/src/grid.rs b/crates/ui-egui/src/grid.rs index a0efbfae7a..b0ca2b65d5 100644 --- a/crates/ui-egui/src/grid.rs +++ b/crates/ui-egui/src/grid.rs @@ -28,6 +28,33 @@ pub const WHEEL_ZOOM_LADDER: [u16; 22] = [10, 12, 15, 18, 21, 25, 30, 35, 42, 50 /// Seconds without Ctrl+wheel input after which part of a notch turned so far is forgotten. const WHEEL_ZOOM_IDLE: f64 = 0.75; +/// Ends a wheel "touch" that still carries Ctrl/Cmd when a wheel event without it comes in, so +/// the wheel scrolls again once Ctrl is released (#2213). +/// +/// On Wayland winit starts a touch for a high-resolution wheel and never ends it; while in a +/// touch egui keeps every modifier it has seen, so one Ctrl+wheel turn made each later turn zoom. +/// `ctrl_wheel` remembers between frames whether the current touch has seen Ctrl/Cmd. +pub(crate) fn end_stuck_ctrl_wheel(events: &mut Vec, ctrl_wheel: &mut bool) { + let mut out = Vec::with_capacity(events.len()); + for e in events.drain(..) { + if let egui::Event::MouseWheel { unit, phase, modifiers, .. } = &e { + let ctrl = modifiers.ctrl || modifiers.command; + match phase { + egui::TouchPhase::Start => *ctrl_wheel = ctrl, + egui::TouchPhase::Move if ctrl => *ctrl_wheel = true, + egui::TouchPhase::Move if *ctrl_wheel => { + out.push(egui::Event::MouseWheel { unit: *unit, delta: egui::Vec2::ZERO, phase: egui::TouchPhase::End, modifiers: *modifiers }); + *ctrl_wheel = false; + } + egui::TouchPhase::Move => {} + egui::TouchPhase::End | egui::TouchPhase::Cancel => *ctrl_wheel = false, + } + } + out.push(e); + } + *events = out; +} + /// The zoom one Ctrl+wheel notch goes to from `zoom`: the next step on [`WHEEL_ZOOM_LADDER`] in /// that direction, skipping a step less than 5% away (121% out goes to 100%, not 120%), but never /// 100% or the 10% / 400% limits (99% or 101% towards 100% goes to 100%). @@ -3886,6 +3913,37 @@ pub(crate) fn heading_font_size(zoom: f32) -> f32 { #[cfg(test)] mod tests { + #[test] + fn a_wheel_turn_without_ctrl_ends_a_ctrl_wheel_touch() { + use super::end_stuck_ctrl_wheel; + use egui::{Event, Modifiers, MouseWheelUnit, TouchPhase, vec2}; + let wheel = |phase, modifiers| Event::MouseWheel { unit: MouseWheelUnit::Point, delta: vec2(0.0, 3.0), phase, modifiers }; + let end = Event::MouseWheel { unit: MouseWheelUnit::Point, delta: egui::Vec2::ZERO, phase: TouchPhase::End, modifiers: Modifiers::NONE }; + let mut ctrl_wheel = false; + // Wayland: a plain turn starts a touch that never ends; nothing to change yet. + let mut events = vec![wheel(TouchPhase::Start, Modifiers::NONE), wheel(TouchPhase::Move, Modifiers::NONE)]; + end_stuck_ctrl_wheel(&mut events, &mut ctrl_wheel); + assert_eq!(events.len(), 2); + // Ctrl+wheel in the same touch zooms, as it should. + let mut events = vec![wheel(TouchPhase::Move, Modifiers::CTRL)]; + end_stuck_ctrl_wheel(&mut events, &mut ctrl_wheel); + assert_eq!(events, vec![wheel(TouchPhase::Move, Modifiers::CTRL)]); + // Ctrl released, in a later frame: the touch ends first, so egui scrolls this turn. + let mut events = vec![wheel(TouchPhase::Move, Modifiers::NONE)]; + end_stuck_ctrl_wheel(&mut events, &mut ctrl_wheel); + assert_eq!(events, vec![end, wheel(TouchPhase::Move, Modifiers::NONE)]); + // Later plain turns pass through untouched. + let mut events = vec![wheel(TouchPhase::Move, Modifiers::NONE)]; + end_stuck_ctrl_wheel(&mut events, &mut ctrl_wheel); + assert_eq!(events, vec![wheel(TouchPhase::Move, Modifiers::NONE)]); + // Cmd (macOS command flag) counts as Ctrl; a touch that ends by itself needs nothing extra. + let cmd = wheel(TouchPhase::Start, Modifiers::COMMAND); + let mut events = vec![cmd, wheel(TouchPhase::End, Modifiers::NONE), wheel(TouchPhase::Move, Modifiers::NONE)]; + end_stuck_ctrl_wheel(&mut events, &mut ctrl_wheel); + assert_eq!(events.len(), 3); + assert!(!ctrl_wheel); + } + #[test] fn explicit_left_and_right_keep_their_side_on_a_right_to_left_sheet() { use super::{HAlign, painted_halign}; diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index faae9bfae8..d37a73e4d8 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -254,6 +254,8 @@ pub struct SheetApp { print_feedback_seen: Option, /// Synthetic input from agents, one batch per frame (drags need several frames). pub synthetic: std::collections::VecDeque>, + /// The current wheel touch has seen Ctrl/Cmd (see `grid::end_stuck_ctrl_wheel`). + ctrl_wheel: bool, pub control_rx: Option>, pub grid: grid::GridState, pub perf: Perf, @@ -316,6 +318,7 @@ impl SheetApp { printing: Default::default(), print_feedback_seen: None, synthetic: Default::default(), + ctrl_wheel: false, control_rx: None, grid: grid::GridState { last_border: "bottom".into(), @@ -1255,6 +1258,10 @@ impl SheetApp { } pub fn raw_input_hook(&mut self, raw: &mut egui::RawInput) { + // Wayland never ends a wheel touch, so egui would keep an earlier Ctrl+wheel's Ctrl (#2213). + if cfg!(all(unix, not(target_vendor = "apple"))) { + grid::end_stuck_ctrl_wheel(&mut raw.events, &mut self.ctrl_wheel); + } if let Some(mut batch) = self.synthetic.pop_front() { raw.events.append(&mut batch); } From edd64e9afc0965320868f113afa6404f5739c63d Mon Sep 17 00:00:00 2001 From: Marco Arnulfo Date: Fri, 23 Oct 2026 00:47:02 +0200 Subject: [PATCH 14/94] View: zooming is not an undo step (fixes #2313) --- crates/engine/src/cmd/edit.rs | 2 + crates/engine/src/cmd/view.rs | 71 +++++++++++++++++++- crates/engine/tests/command_sequence_fuzz.rs | 5 +- 3 files changed, 73 insertions(+), 5 deletions(-) diff --git a/crates/engine/src/cmd/edit.rs b/crates/engine/src/cmd/edit.rs index e537407127..21421902f0 100644 --- a/crates/engine/src/cmd/edit.rs +++ b/crates/engine/src/cmd/edit.rs @@ -660,6 +660,7 @@ fn undo(s: &mut Session, p: &Json) -> Result { crate::push_history(&mut d.redo, label.clone(), cur_wb, &d.wb, cur_selection); } super::extra::keep_watch_list(&now, &mut d.wb); + super::view::keep_zoom(d, &now); d.calc.rebuild(&d.wb); d.revision += 1; Ok(json!({"undone": label})) @@ -680,6 +681,7 @@ fn redo(s: &mut Session, p: &Json) -> Result { crate::push_history(&mut d.undo, label.clone(), cur_wb, &d.wb, cur_selection); } super::extra::keep_watch_list(&now, &mut d.wb); + super::view::keep_zoom(d, &now); d.calc.rebuild(&d.wb); d.revision += 1; Ok(json!({"redone": label})) diff --git a/crates/engine/src/cmd/view.rs b/crates/engine/src/cmd/view.rs index f0b2f77d39..9af8941852 100644 --- a/crates/engine/src/cmd/view.rs +++ b/crates/engine/src/cmd/view.rs @@ -37,13 +37,13 @@ pub fn specs() -> Vec { cmd!("view.showZeros", "Show Zeros", [], None, "{on?}", has_doc, |s, p| sheet_flag(s, p, "zeros")), cmd!("view.showObjects", "Show Objects", [], Some("Ctrl+6"), "{on?}", has_doc, show_objects), cmd!("view.rightToLeft", "Sheet Right-to-Left", ["Page Layout", "Sheet Options"], None, "{on?}", has_doc, |s, p| sheet_flag(s, p, "rtl")), - cmd!("view.zoom", "Zoom", ["View", "Zoom"], None, "{percent: 10..400}", has_doc, zoom), - cmd!("view.zoom100", "100%", ["View", "Zoom"], None, "{}", has_doc, |s, _| zoom(s, &json!({"percent": 100}))), + cmd!(noundo "view.zoom", "Zoom", ["View", "Zoom"], None, "{percent: 10..400}", has_doc, zoom), + cmd!(noundo "view.zoom100", "100%", ["View", "Zoom"], None, "{}", has_doc, |s, _| zoom(s, &json!({"percent": 100}))), cmd!(query "view.formulaBar", "Formula Bar", ["View", "Show"], None, "{on?: bool}", always, |s, p| { s.prefs.formula_bar = bool_param(p, "on").unwrap_or(!s.prefs.formula_bar); Ok(json!({"on": s.prefs.formula_bar})) }), - cmd!("view.zoomToSelection", "Zoom to Selection", ["View", "Zoom"], None, "{viewWidth?, viewHeight?}", has_doc, zoom_selection), + cmd!(noundo "view.zoomToSelection", "Zoom to Selection", ["View", "Zoom"], None, "{viewWidth?, viewHeight?}", has_doc, zoom_selection), cmd!("pageLayout.orientation", "Orientation", ["Page Layout", "Page Setup"], None, "{orientation: portrait|landscape}", has_doc, orientation), cmd!( "pageLayout.size", @@ -200,6 +200,28 @@ fn zoom(s: &mut Session, p: &Json) -> Result { Ok(json!({"zoom": z})) } +/// Zoom belongs to the window, not to the edits (Excel doesn't undo it, #2313): undo and redo keep +/// each sheet's current zoom when they swap in another snapshot of the workbook. Back at the saved +/// state, the zoom alone doesn't make the workbook dirty, as with `view.zoom`. +pub(crate) fn keep_zoom(d: &mut crate::DocState, now: &Workbook) { + let current = |name: &str| now.sheets.iter().find(|sh| sh.name == name).map(|sh| sh.zoom); + let changed: Vec<(usize, u16)> = + d.wb.sheets.iter().enumerate().filter_map(|(i, sh)| current(&sh.name).filter(|z| *z != sh.zoom).map(|z| (i, z))).collect(); + if changed.is_empty() { + return; + } + let saved = std::sync::Arc::ptr_eq(&d.wb, &d.saved); + let wb = std::sync::Arc::make_mut(&mut d.wb); + for (i, z) in changed { + if let Some(sh) = wb.sheet_mut(i) { + sh.zoom = z; + } + } + if saved { + d.saved = d.wb.clone(); + } +} + fn zoom_selection(s: &mut Session, p: &Json) -> Result { let d = s.doc()?; let sh = d.wb.active().ok_or(EngineError::NoDocument)?; @@ -466,6 +488,49 @@ mod tests { assert_eq!(s.doc().unwrap().wb.active().unwrap().zoom, 100); } + #[test] + fn zooming_is_not_an_undo_step() { + // Excel keeps zoom on the window, not in the edit history (#2313): wheel, slider, dialog, + // 100% and Zoom to Selection leave Undo and Redo alone. + let mut s = Session::new(); + s.new_workbook(); + s.execute("cell.set", json!({"cell": "A1", "input": "x"})).unwrap(); + s.execute("cell.set", json!({"cell": "A2", "input": "y"})).unwrap(); + s.execute("edit.undo", json!({})).unwrap(); + let (undo, redo) = s.doc().map(|d| (d.undo.len(), d.redo.len())).unwrap(); + for (id, params, zoom) in [ + ("view.zoom", json!({"percent": 150}), 150), + ("view.zoomToSelection", json!({"viewWidth": 1200, "viewHeight": 700}), 400), + ("view.zoom100", json!({}), 100), + ] { + s.execute(id, params).unwrap(); + let d = s.doc().unwrap(); + assert_eq!(d.wb.active().unwrap().zoom, zoom, "{id}"); + assert_eq!((d.undo.len(), d.redo.len()), (undo, redo), "{id} touched the history"); + } + let a1 = CellRef::parse("A1").unwrap(); + s.execute("edit.undo", json!({})).unwrap(); + assert!(s.doc().unwrap().wb.active().unwrap().value(a1).is_empty(), "Ctrl+Z after zooming undoes the last edit"); + } + + #[test] + fn undo_and_redo_keep_the_current_zoom() { + let mut s = Session::new(); + s.new_workbook(); + let zoom = |s: &Session| s.doc().unwrap().wb.active().unwrap().zoom; + s.execute("cell.set", json!({"cell": "A1", "input": "x"})).unwrap(); + s.execute("view.zoom", json!({"percent": 200})).unwrap(); + s.execute("edit.undo", json!({})).unwrap(); + assert!(s.doc().unwrap().wb.active().unwrap().value(CellRef::parse("A1").unwrap()).is_empty()); + assert_eq!(zoom(&s), 200, "undo keeps the zoom"); + // Back at the state on disk: the zoom alone doesn't make the workbook dirty, as in `zoom`. + assert!(!s.doc().unwrap().is_dirty()); + s.execute("view.zoom", json!({"percent": 50})).unwrap(); + s.execute("edit.redo", json!({})).unwrap(); + assert!(!s.doc().unwrap().wb.active().unwrap().value(CellRef::parse("A1").unwrap()).is_empty()); + assert_eq!(zoom(&s), 50, "redo keeps the zoom"); + } + #[test] fn formula_bar_toggles_without_a_workbook_and_defaults_to_shown() { let mut s = Session::new(); diff --git a/crates/engine/tests/command_sequence_fuzz.rs b/crates/engine/tests/command_sequence_fuzz.rs index f8cb603cba..4ed7dc0428 100644 --- a/crates/engine/tests/command_sequence_fuzz.rs +++ b/crates/engine/tests/command_sequence_fuzz.rs @@ -485,8 +485,8 @@ fn watch_list(wb: &Workbook) -> Option<&str> { wb.names.iter().find(|n| n.name == WATCH_NAME).map(|n| n.formula.as_str()) } -/// The workbook with view state (active sheet, scroll, active cell) and the Watch Window list -/// reset: undo restores view state as it was, but switching sheets isn't an undoable edit. +/// The workbook with view state (active sheet, scroll, active cell, zoom) and the Watch Window list +/// reset: undo restores view state as it was, but switching sheets or zooming isn't an undoable edit. fn canonical(wb: &Workbook) -> Workbook { let mut wb = wb.clone(); wb.active_sheet = 0; @@ -495,6 +495,7 @@ fn canonical(wb: &Workbook) -> Workbook { let sh = Arc::make_mut(sh); sh.view_active = CellRef::default(); sh.view_top_left = CellRef::default(); + sh.zoom = 100; } wb } From b9324d91796fc91b53c7e4042de021dcc2cddafc Mon Sep 17 00:00:00 2001 From: kezmdor <15539254+kezmdor@users.noreply.github.com> Date: Fri, 23 Oct 2026 09:13:27 +0200 Subject: [PATCH 15/94] Formula entry: text that would read as a formula is edited with its apostrophe `text_needs_quote_prefix` still used the old rule (a sign followed by a letter or `(`), so text such as `+5+4` (typed as `'+5+4`, or read from a CSV or XLSX) was edited without its apostrophe and became a formula when confirmed unchanged. It now asks what `input_to_cell` asks: the entry starts a formula and parses as one. Text that stays text anyway (`--`) is still edited as it is. Found by @iluebbe in #2023. Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/display.rs | 10 +++++++--- crates/engine/src/tests.rs | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/display.rs b/crates/engine/src/display.rs index aa8bdb22dd..ad94c808c1 100644 --- a/crates/engine/src/display.rs +++ b/crates/engine/src/display.rs @@ -41,12 +41,16 @@ fn text_needs_quote_prefix(t: &str, sys: gridcraft_core::date::DateSystem) -> bo if t.is_empty() { return false; } - let mut chars = t.chars(); - let (first, second) = (chars.next(), chars.next()); + let first = t.chars().next(); if matches!(first, Some('=' | '\'')) { return true; } - if matches!(first, Some('+' | '-')) && second.is_some_and(|c| c.is_ascii_alphabetic() || c == '(') { + // A `+` or `-` entry that reads as a formula becomes one (`+5+4`, `-abc`); one that doesn't + // stays text (`--`, `+49 170 1234567`), as `input_to_cell` decides it. + if matches!(first, Some('+' | '-')) + && gridcraft_core::parse::starts_formula(t) + && crate::cmd::edit::parse_typed_formula(t).is_ok_and(|e| crate::cmd::edit::check_arg_counts(&e).is_ok()) + { return true; } !matches!(gridcraft_core::parse::parse_input(t, sys).value, Value::Text(ref x) if x.as_ref() == t) diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 285d64ce97..c10a39a9cd 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -267,6 +267,26 @@ fn a_leading_plus_or_minus_starts_a_formula() { assert_eq!(v(&s, "B1"), value, "{typed}"); assert!(!input(&s, "B1").is_some_and(|t| t.starts_with('=')), "{typed}"); } + // Text that would read as a formula is edited with its apostrophe, so confirming the editor + // unchanged keeps it text; text that wouldn't is edited as it is. + for (typed, shown) in [ + ("'+5+4", "'+5+4"), + ("'-5+4", "'-5+4"), + ("'+1-555-1234", "'+1-555-1234"), + ("'-abc", "'-abc"), + ("--", "--"), + ("+49 170 1234567", "+49 170 1234567"), + ] { + s.execute("cell.set", json!({"cell": "B2", "input": typed})).unwrap(); + let before = v(&s, "B2"); + let edit = { + let d = s.doc().unwrap(); + crate::display::edit_text(&d.wb, d.wb.active().unwrap(), CellRef::parse("B2").unwrap()) + }; + assert_eq!(edit, shown, "{typed}"); + s.execute("cell.set", json!({"cell": "B2", "input": edit})).unwrap(); + assert_eq!(v(&s, "B2"), before, "{typed} stays text after an unchanged edit"); + } // As observed in Excel for the web, an entry that doesn't read as a formula stays text, and // one that does but names nothing known is #NAME?. Only `=` entries are refused. for typed in ["--", "-----", "+5+", "+49 170 1234567"] { From b21dd9151f49a810e364ea1243c27fd928163a86 Mon Sep 17 00:00:00 2001 From: Marco Arnulfo Date: Fri, 23 Oct 2026 10:18:20 +0200 Subject: [PATCH 16/94] Keep the zoom when undoing or redoing a sheet rename keep_zoom matched sheets by name, so undoing a rename found no match and brought back the zoom from before the rename. A sheet missing by name now falls back to the one at the same index, when the sheet count is unchanged and that sheet's name isn't in the restored snapshot. --- crates/engine/src/cmd/view.rs | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/cmd/view.rs b/crates/engine/src/cmd/view.rs index 9af8941852..d403e425a8 100644 --- a/crates/engine/src/cmd/view.rs +++ b/crates/engine/src/cmd/view.rs @@ -204,9 +204,15 @@ fn zoom(s: &mut Session, p: &Json) -> Result { /// each sheet's current zoom when they swap in another snapshot of the workbook. Back at the saved /// state, the zoom alone doesn't make the workbook dirty, as with `view.zoom`. pub(crate) fn keep_zoom(d: &mut crate::DocState, now: &Workbook) { - let current = |name: &str| now.sheets.iter().find(|sh| sh.name == name).map(|sh| sh.zoom); + // Sheets have no stable id. A name missing from `now` is a rename being undone or redone, which + // keeps the sheet count and position: the sheet is the one at the same index, under a name the + // restored snapshot doesn't have. + let renamed = |i: usize| { + (now.sheets.len() == d.wb.sheets.len()).then(|| now.sheets.get(i)).flatten().filter(|sh| !d.wb.sheets.iter().any(|s| s.name == sh.name)) + }; + let current = |i: usize, name: &str| now.sheets.iter().find(|sh| sh.name == name).or_else(|| renamed(i)).map(|sh| sh.zoom); let changed: Vec<(usize, u16)> = - d.wb.sheets.iter().enumerate().filter_map(|(i, sh)| current(&sh.name).filter(|z| *z != sh.zoom).map(|z| (i, z))).collect(); + d.wb.sheets.iter().enumerate().filter_map(|(i, sh)| current(i, &sh.name).filter(|z| *z != sh.zoom).map(|z| (i, z))).collect(); if changed.is_empty() { return; } @@ -531,6 +537,24 @@ mod tests { assert_eq!(zoom(&s), 50, "redo keeps the zoom"); } + #[test] + fn undoing_a_rename_keeps_the_current_zoom() { + let mut s = Session::new(); + s.new_workbook(); + let active = |s: &Session| { + let sh = s.doc().unwrap().wb.active().unwrap(); + (sh.name.clone(), sh.zoom) + }; + let before = active(&s).0; + s.execute("sheet.rename", json!({"name": "Data"})).unwrap(); + s.execute("view.zoom", json!({"percent": 150})).unwrap(); + s.execute("edit.undo", json!({})).unwrap(); + assert_eq!(active(&s), (before, 150), "undoing the rename keeps the zoom"); + s.execute("view.zoom", json!({"percent": 75})).unwrap(); + s.execute("edit.redo", json!({})).unwrap(); + assert_eq!(active(&s), ("Data".to_string(), 75), "redoing the rename keeps the zoom"); + } + #[test] fn formula_bar_toggles_without_a_workbook_and_defaults_to_shown() { let mut s = Session::new(); From 42ad67ab13f8ae45da75dfa45b72b3b0ed5390f5 Mon Sep 17 00:00:00 2001 From: Marco Arnulfo Date: Fri, 23 Oct 2026 15:23:03 +0200 Subject: [PATCH 17/94] Keep the zoom per step when undoing or redoing several steps edit.undo and edit.redo with `steps` > 1 ran keep_zoom once, comparing the first and last snapshots. Adding C and deleting B leaves the same sheet count under other names, which keep_zoom took for a rename of B to C, so C's zoom landed on B. keep_zoom now runs after each restored snapshot, against the one it replaces. --- crates/engine/src/cmd/edit.rs | 4 ++-- crates/engine/src/cmd/view.rs | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/cmd/edit.rs b/crates/engine/src/cmd/edit.rs index 21421902f0..e9c5e1768d 100644 --- a/crates/engine/src/cmd/edit.rs +++ b/crates/engine/src/cmd/edit.rs @@ -657,10 +657,10 @@ fn undo(s: &mut Session, p: &Json) -> Result { label = e.label.clone(); d.wb = e.wb; d.selection = e.selection; + super::view::keep_zoom(d, &cur_wb); crate::push_history(&mut d.redo, label.clone(), cur_wb, &d.wb, cur_selection); } super::extra::keep_watch_list(&now, &mut d.wb); - super::view::keep_zoom(d, &now); d.calc.rebuild(&d.wb); d.revision += 1; Ok(json!({"undone": label})) @@ -678,10 +678,10 @@ fn redo(s: &mut Session, p: &Json) -> Result { label = e.label.clone(); d.wb = e.wb; d.selection = e.selection; + super::view::keep_zoom(d, &cur_wb); crate::push_history(&mut d.undo, label.clone(), cur_wb, &d.wb, cur_selection); } super::extra::keep_watch_list(&now, &mut d.wb); - super::view::keep_zoom(d, &now); d.calc.rebuild(&d.wb); d.revision += 1; Ok(json!({"redone": label})) diff --git a/crates/engine/src/cmd/view.rs b/crates/engine/src/cmd/view.rs index d403e425a8..30a843f911 100644 --- a/crates/engine/src/cmd/view.rs +++ b/crates/engine/src/cmd/view.rs @@ -555,6 +555,33 @@ mod tests { assert_eq!(active(&s), ("Data".to_string(), 75), "redoing the rename keeps the zoom"); } + #[test] + fn undoing_several_steps_keeps_each_sheet_its_own_zoom() { + // Adding C then deleting B leaves as many sheets as before under other names: across both + // steps at once, that looks like B renamed to C, and C's zoom used to land on B. + let mut s = Session::new(); + s.new_workbook(); + let zoom = |s: &Session, name: &str| { + let wb = &s.doc().unwrap().wb; + wb.sheet(wb.sheet_index(name).unwrap()).unwrap().zoom + }; + let names = |s: &Session| s.doc().unwrap().wb.sheets.iter().map(|sh| sh.name.clone()).collect::>(); + let first = names(&s)[0].clone(); + s.execute("home.insertSheet", json!({"name": "B", "before": 1})).unwrap(); + s.execute("home.insertSheet", json!({"name": "C", "before": 2})).unwrap(); + s.execute("home.deleteSheet", json!({"sheet": "B"})).unwrap(); + s.execute("sheet.activate", json!({"sheet": "C"})).unwrap(); + s.execute("view.zoom", json!({"percent": 150})).unwrap(); + s.execute("edit.undo", json!({"steps": 2})).unwrap(); + assert_eq!(names(&s), [first.clone(), "B".to_string()]); + assert_eq!(zoom(&s, "B"), 100, "B never had C's zoom"); + s.execute("sheet.activate", json!({"sheet": "B"})).unwrap(); + s.execute("view.zoom", json!({"percent": 80})).unwrap(); + s.execute("edit.redo", json!({"steps": 2})).unwrap(); + assert_eq!(names(&s), [first, "C".to_string()]); + assert_eq!(zoom(&s, "C"), 150, "C gets its own zoom back, not B's"); + } + #[test] fn formula_bar_toggles_without_a_workbook_and_defaults_to_shown() { let mut s = Session::new(); From 1da552fc9f77836dc501835f7c48d3889354796c Mon Sep 17 00:00:00 2001 From: MarekSpodBiedry <73122968+MarekSpodBiedry@users.noreply.github.com> Date: Fri, 23 Oct 2026 16:08:20 +0200 Subject: [PATCH 18/94] Wayland: track synthetic wheel events when ending a stuck Ctrl wheel touch (#2213) --- crates/ui-egui/src/control.rs | 16 ++++++++++++++++ crates/ui-egui/src/lib.rs | 9 +++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/crates/ui-egui/src/control.rs b/crates/ui-egui/src/control.rs index 11d535ac41..84d259cc90 100644 --- a/crates/ui-egui/src/control.rs +++ b/crates/ui-egui/src/control.rs @@ -576,6 +576,22 @@ mod tests { SheetApp::new(session, crate::Services::default()) } + #[cfg(all(unix, not(target_vendor = "apple")))] + #[test] + fn synthetic_wheel_events_end_a_stuck_ctrl_touch() { + use egui::{Event, Modifiers, MouseWheelUnit, TouchPhase, vec2}; + let mut app = test_app(); + let wheel = |modifiers| Event::MouseWheel { unit: MouseWheelUnit::Point, delta: vec2(0.0, 3.0), phase: TouchPhase::Move, modifiers }; + app.synthetic.push_back(vec![wheel(Modifiers::CTRL)]); + app.synthetic.push_back(vec![wheel(Modifiers::NONE)]); + let mut raw = egui::RawInput::default(); + app.raw_input_hook(&mut raw); + assert_eq!(raw.events.len(), 1); + let mut raw = egui::RawInput::default(); + app.raw_input_hook(&mut raw); + assert_eq!(raw.events.len(), 2); + } + #[test] fn oversized_pointer_requests_are_refused_and_leave_the_queue_alone() { let mut app = test_app(); diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index d37a73e4d8..f88c1d54de 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -1258,13 +1258,14 @@ impl SheetApp { } pub fn raw_input_hook(&mut self, raw: &mut egui::RawInput) { - // Wayland never ends a wheel touch, so egui would keep an earlier Ctrl+wheel's Ctrl (#2213). - if cfg!(all(unix, not(target_vendor = "apple"))) { - grid::end_stuck_ctrl_wheel(&mut raw.events, &mut self.ctrl_wheel); - } if let Some(mut batch) = self.synthetic.pop_front() { raw.events.append(&mut batch); } + // Wayland never ends a wheel touch, so egui would keep an earlier Ctrl+wheel's Ctrl (#2213). + // After the synthetic batch is added, so agent-sent wheel events are tracked too. + if cfg!(all(unix, not(target_vendor = "apple"))) { + grid::end_stuck_ctrl_wheel(&mut raw.events, &mut self.ctrl_wheel); + } } /// Flip AutoSave (title-bar switch / Options ▸ Save). Persisted with the other UI From aea9a02bce59fb0920d2570f2ab329db5afc9a64 Mon Sep 17 00:00:00 2001 From: Harrison Booth <73434116+Harrison-Booth@users.noreply.github.com> Date: Fri, 23 Oct 2026 17:10:23 -0500 Subject: [PATCH 19/94] Calc: a one-value dynamic-array result in a table is not #SPILL! --- crates/calc/src/recalc.rs | 8 ++++---- crates/calc/src/tests.rs | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/crates/calc/src/recalc.rs b/crates/calc/src/recalc.rs index 66374bed2c..a1e8c0e9ed 100644 --- a/crates/calc/src/recalc.rs +++ b/crates/calc/src/recalc.rs @@ -466,7 +466,7 @@ impl<'a> PassHost<'a> { } } -/// Whether an array result at `k` can't spill: it is in a table, or its area runs off the sheet, +/// Whether an array result at `k` can't spill: it is in a table (a one-value result is shown there, as in Excel), or its area runs off the sheet, /// overlaps merged cells, holds other cells, or another formula's spill (unless that formula is /// recalculated in this pass, and so may spill elsewhere now). fn spill_blocked(host: &PassHost<'_>, (sheet, anchor): Key, a: &Array) -> bool { @@ -482,7 +482,7 @@ fn spill_blocked(host: &PassHost<'_>, (sheet, anchor): Key, a: &Array) -> bool { end.row >= gridcraft_core::MAX_ROWS || end.col >= gridcraft_core::MAX_COLS || sh.merges.iter().any(|m| m.intersects(&range)) - || sh.tables.iter().any(|t| t.range.contains(anchor)) + || (a.data.len() > 1 && sh.tables.iter().any(|t| t.range.contains(anchor))) || sh.cells.iter_range(range).any(|(c, cell)| c != anchor && (!cell.value.is_empty() || cell.formula.is_some())) || sh.spill.range(range.start..=range.end).any(|(c, _)| range.contains(*c) && spilled_over(*c)) } @@ -494,7 +494,7 @@ fn spills_as_before(sheet: &gridcraft_model::Sheet, anchor: CellRef, range: Rang CellRef::new(anchor.row.saturating_add((arr.rows as u32).saturating_sub(1)), anchor.col.saturating_add((arr.cols as u32).saturating_sub(1))); RangeRef::new(anchor, end) == range && !sheet.merges.iter().any(|m| m.intersects(&range)) - && !sheet.tables.iter().any(|t| t.range.contains(anchor)) + && (arr.data.len() <= 1 || !sheet.tables.iter().any(|t| t.range.contains(anchor))) && range .iter() .enumerate() @@ -1144,7 +1144,7 @@ impl Calc { || end.col >= gridcraft_core::MAX_COLS || range.iter().any(|c| c != k.1 && (sheet.cells.has(c) || sheet.spill.contains_key(&c))) || sheet.merges.iter().any(|m| m.intersects(&range)) - || sheet.tables.iter().any(|t| t.range.contains(k.1)); + || (arr.data.len() > 1 && sheet.tables.iter().any(|t| t.range.contains(k.1))); if blocked { if let Some(cell) = sheet.cells.get_mut(k.1) { cell.value = Value::Error(CellError::Spill); diff --git a/crates/calc/src/tests.rs b/crates/calc/src/tests.rs index 622ed6cc9e..7b3d47beee 100644 --- a/crates/calc/src/tests.rs +++ b/crates/calc/src/tests.rs @@ -459,6 +459,40 @@ fn arrays_do_not_spill_in_tables() { assert_eq!(t.num("E4"), 4.0); } +#[test] +fn one_value_array_in_a_table_is_not_a_spill() { + // Excel shows a one-value dynamic-array result in a table column; two or more is #SPILL! (#2335). + let table = |range: &str| gridcraft_model::Table { + id: 1, + name: "Table1".into(), + range: gridcraft_core::RangeRef::parse(range).unwrap(), + header_row: true, + totals_row: false, + columns: vec![], + style: String::new(), + banded_rows: false, + banded_cols: false, + first_col: false, + last_col: false, + filter_button: false, + filter: vec![], + table_type: None, + connection_id: None, + }; + let mut t = T::new(); + t.wb.sheet_mut(0).unwrap().tables.push(table("B3:C6")); + t.set("A1", "7"); + t.set("A2", "8"); + t.set("C4", "=FILTER(A1:A2,A1:A2>7)"); + t.set("C5", "=FILTER(A1:A2,A1:A2>0)"); + t.set("H4", "=FILTER(A1:A2,A1:A2>7)"); + assert_eq!((t.num("C4"), t.num("H4")), (8.0, 8.0)); + assert_eq!(t.get("C5"), Value::Error(CellError::Spill)); + // Recalculating again keeps the one-value result. + t.calc.recalc_all(&mut t.wb); + assert_eq!(t.num("C4"), 8.0); +} + #[test] fn ifs_and_lazy() { let mut t = T::new(); From 2a59d7f15dc2179b217aca84dff36bbbe318c193 Mon Sep 17 00:00:00 2001 From: vangel76 Date: Sat, 24 Oct 2026 20:10:10 +0200 Subject: [PATCH 20/94] Quick Analysis: keep clear of the Auto Fill Options button, tests in the shared binary After a fill-handle drag both buttons sat at the selection's corner and the Quick Analysis one, painted on top, took the click. The Quick Analysis button now waits until the fill is no longer current; Ctrl+Q still opens the popup. Drops "Bar" from the Japanese EXTRA list, now a DIALOGS key, and moves the button tests into tests/it. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/i18n/ja.rs | 1 - crates/ui-egui/src/quick_analysis.rs | 5 ++++- crates/ui-egui/tests/it/main.rs | 1 + crates/ui-egui/tests/{ => it}/quick_analysis_button.rs | 0 4 files changed, 5 insertions(+), 2 deletions(-) rename crates/ui-egui/tests/{ => it}/quick_analysis_button.rs (100%) diff --git a/crates/ui-egui/src/i18n/ja.rs b/crates/ui-egui/src/i18n/ja.rs index efb2afcca1..7b4d9c89b6 100644 --- a/crates/ui-egui/src/i18n/ja.rs +++ b/crates/ui-egui/src/i18n/ja.rs @@ -1142,7 +1142,6 @@ pub(super) const EXTRA: &[(&str, &str)] = &[ ("Treemap", "ツリーマップ"), ("Sunburst", "サンバースト"), ("Stock", "株価"), - ("Bar", "横棒"), ( "Drag to fill cells. Drag from inside a cell to select a range.", "ドラッグしてセルをオートフィルします。セルの内側からドラッグすると範囲を選択します。", diff --git a/crates/ui-egui/src/quick_analysis.rs b/crates/ui-egui/src/quick_analysis.rs index 798f68c4f8..5fd3f8f6a0 100644 --- a/crates/ui-egui/src/quick_analysis.rs +++ b/crates/ui-egui/src/quick_analysis.rs @@ -203,7 +203,10 @@ pub fn show(app: &mut SheetApp, ui: &mut Ui, geo: &Geo, sh: &Sheet) { // While the mouse is down (selecting, filling) the button stays out of the way. let busy = app.grid.drag != Drag::None || ctx.input(|i| i.pointer.any_down()); let lang = crate::i18n::current(&ctx); - if corner_visible && (open || !busy) { + // Right after a fill-handle drag the Auto Fill Options button sits at the same corner; it wins + // until that fill is no longer current (Ctrl+Q still opens the popup). + let fill_tag = app.grid.fill_tag.is_some(); + if corner_visible && (open || (!busy && !fill_tag)) { let mut clicked = false; egui::Area::new(Id::new("quick_analysis_button")).fixed_pos(button.min).order(Order::Foreground).show(&ctx, |ui| { let (r, resp) = ui.allocate_exact_size(button.size(), Sense::click()); diff --git a/crates/ui-egui/tests/it/main.rs b/crates/ui-egui/tests/it/main.rs index 3a9769c1c5..4b3d9be2b3 100644 --- a/crates/ui-egui/tests/it/main.rs +++ b/crates/ui-egui/tests/it/main.rs @@ -64,6 +64,7 @@ mod pivot_pane; mod pivot_show_details; mod popup_dismissal; mod protect_password; +mod quick_analysis_button; mod right_to_left; mod scroll_position; mod scrollbar_column_fill; diff --git a/crates/ui-egui/tests/quick_analysis_button.rs b/crates/ui-egui/tests/it/quick_analysis_button.rs similarity index 100% rename from crates/ui-egui/tests/quick_analysis_button.rs rename to crates/ui-egui/tests/it/quick_analysis_button.rs From c5061789226fdfff41c8dfff14c9a4f19e64f1c5 Mon Sep 17 00:00:00 2001 From: Harrison Booth <73434116+Harrison-Booth@users.noreply.github.com> Date: Sat, 24 Oct 2026 16:37:43 -0500 Subject: [PATCH 21/94] Calc: check =ROWS(C4#) on a one-value table result --- crates/calc/src/tests.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/calc/src/tests.rs b/crates/calc/src/tests.rs index bed48d301e..3191d26e4d 100644 --- a/crates/calc/src/tests.rs +++ b/crates/calc/src/tests.rs @@ -737,11 +737,13 @@ fn one_value_array_in_a_table_is_not_a_spill() { t.set("C4", "=FILTER(A1:A2,A1:A2>7)"); t.set("C5", "=FILTER(A1:A2,A1:A2>0)"); t.set("H4", "=FILTER(A1:A2,A1:A2>7)"); - assert_eq!((t.num("C4"), t.num("H4")), (8.0, 8.0)); + t.set("D4", "=ROWS(C4#)"); + assert_eq!((t.num("C4"), t.num("H4"), t.num("D4")), (8.0, 8.0, 1.0)); assert_eq!(t.get("C5"), Value::Error(CellError::Spill)); // Recalculating again keeps the one-value result. t.calc.recalc_all(&mut t.wb); assert_eq!(t.num("C4"), 8.0); + assert_eq!(t.num("D4"), 1.0); } #[test] From a2caeedcd97bd84e71627afdc7f00918b2a56e14 Mon Sep 17 00:00:00 2001 From: vangel76 Date: Sun, 25 Oct 2026 10:26:14 +0100 Subject: [PATCH 22/94] Quick Analysis: use theme category colours after the theme change on main Co-Authored-By: Claude Sonnet 5.5 --- crates/ui-egui/src/icons.rs | 2 +- crates/ui-egui/src/quick_analysis.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/icons.rs b/crates/ui-egui/src/icons.rs index bdfcbbb52c..57ab9c0a79 100644 --- a/crates/ui-egui/src/icons.rs +++ b/crates/ui-egui/src/icons.rs @@ -754,7 +754,7 @@ fn paint_with(p: &Painter, rect: Rect, icon: Icon, c: Color32, pal: &Palette) { g.stroke(&[(2.0, 6.5), (14.0, 6.5)], light); g.stroke(&[(6.0, 3.0), (6.0, 13.0)], light); g.stroke(&[(10.0, 3.0), (10.0, 13.0)], light); - g.line(&[(10.0, 1.0), (6.5, 8.0), (9.5, 8.0), (6.5, 15.0)], BLUE, 1.7); + g.line(&[(10.0, 1.0), (6.5, 8.0), (9.5, 8.0), (6.5, 15.0)], blue, 1.7); } } } diff --git a/crates/ui-egui/src/quick_analysis.rs b/crates/ui-egui/src/quick_analysis.rs index 5fd3f8f6a0..1035ccbd16 100644 --- a/crates/ui-egui/src/quick_analysis.rs +++ b/crates/ui-egui/src/quick_analysis.rs @@ -12,7 +12,7 @@ use serde_json::{Value as Json, json}; use crate::SheetApp; use crate::grid::{Drag, Geo}; use crate::icons::{self, Icon}; -use crate::theme::{self, Tokens}; +use crate::theme::{self, Cat, Tokens}; /// Side of the corner button, and its gap to the selection's corner (clear of the fill handle). const BUTTON: f32 = 22.0; @@ -290,7 +290,7 @@ fn paint_tile(ui: &mut Ui, t: &Tokens, item: &Tile, label: &str) -> bool { fn paint_glyph(ui: &Ui, t: &Tokens, glyph: Glyph, r: Rect) { let p = ui.painter(); - let (green, blue, red, yellow) = (icons::GREEN, icons::BLUE, icons::RED, icons::YELLOW); + let (green, blue, red, yellow) = (t.cat(Cat::Green), t.cat(Cat::Blue), t.cat(Cat::Red), t.cat(Cat::Amber)); let cell = |i: f32, j: f32| Rect::from_min_size(r.min + vec2(i * r.width() / 3.0, j * r.height() / 3.0), vec2(r.width() / 3.0, r.height() / 3.0)); match glyph { Glyph::Icon(icon) => icons::paint(p, r, icon, t.text), From a98f290ec02dba3a06c0eb7cdaf5650e78d43557 Mon Sep 17 00:00:00 2001 From: vangel76 Date: Mon, 26 Oct 2026 00:06:42 +0100 Subject: [PATCH 23/94] Quick Analysis: use Id::unique for the area ids (Id::new is deprecated upstream) Co-Authored-By: Claude Sonnet 5.5 --- crates/ui-egui/src/quick_analysis.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/quick_analysis.rs b/crates/ui-egui/src/quick_analysis.rs index 1035ccbd16..3843ea6bfa 100644 --- a/crates/ui-egui/src/quick_analysis.rs +++ b/crates/ui-egui/src/quick_analysis.rs @@ -208,7 +208,7 @@ pub fn show(app: &mut SheetApp, ui: &mut Ui, geo: &Geo, sh: &Sheet) { let fill_tag = app.grid.fill_tag.is_some(); if corner_visible && (open || (!busy && !fill_tag)) { let mut clicked = false; - egui::Area::new(Id::new("quick_analysis_button")).fixed_pos(button.min).order(Order::Foreground).show(&ctx, |ui| { + egui::Area::new(Id::unique("quick_analysis_button")).fixed_pos(button.min).order(Order::Foreground).show(&ctx, |ui| { let (r, resp) = ui.allocate_exact_size(button.size(), Sense::click()); let fill = if resp.is_pointer_button_down_on() || open { t.pressed @@ -229,7 +229,7 @@ pub fn show(app: &mut SheetApp, ui: &mut Ui, geo: &Geo, sh: &Sheet) { let Some(opened_for) = app.grid.quick_analysis.open else { return }; let pos = pos2(button.left(), button.bottom() + 4.0); let mut picked: Option = None; - let resp = egui::Area::new(Id::new("quick_analysis_popup")).fixed_pos(pos).order(Order::Foreground).constrain(true).show(&ctx, |ui| { + let resp = egui::Area::new(Id::unique("quick_analysis_popup")).fixed_pos(pos).order(Order::Foreground).constrain(true).show(&ctx, |ui| { egui::Frame::popup(ui.style()).show(ui, |ui| { let state = &mut app.grid.quick_analysis; ui.horizontal(|ui| { From dd136062f557a77213147e69e5e911cf326b6037 Mon Sep 17 00:00:00 2001 From: zyzabruh Date: Mon, 26 Oct 2026 01:27:52 +0100 Subject: [PATCH 24/94] Paste Special: a transposed paste turns formula references as Excel does (fixes #2450) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Paste Special > Transpose moved the copied cells but adjusted every formula with `shift_relative`, the adjustment of an ordinary copy, so the formula kept the offset it had in the source: `=A3+1` copied from A3:A4 and pasted at C3 read the cell above instead of the cell to its left and showed 1/1/1900. Excel turns the references instead. Observed against Excel 16 on synthetic workbooks (relative, `$B$1`, `B$1`, `$B1`, ranges, another sheet, whole rows and columns, a reference off the grid, a source block not starting at A1, and a 2x2 block): the row offset of a reference becomes its column offset and the other way round around the pair of positions of the cell carrying the formula, `(r, c)` -> `dest + (c - src.col, r - src.row)`. A reference pinned with `$` is left exactly as written, a whole-row or whole-column reference comes back as a cell range whose open side runs from the transposed far edge of the sheet to its end (`1:2` -> `F$6:G$1048576`), and a result outside the grid is `#REF!`. `adjust::transpose_relative(e, src, dest)` implements that beside `shift_relative`, and `paste_special` uses it when `transpose` is set; the paste-link and cut-paste paths are untouched. Tests: `tests::copy_transpose` in gridcraft-formula covers the observed cases including the two shapes above and `#REF!`; `transposed_paste_turns_the_formula_with_the_cell_that_carries_it` replays the issue's steps and checks the value is the day after the cell to the left, `transposed_paste_turns_every_kind_of_reference_the_way_excel_does` covers a relative, a pinned, a ranged and a whole-column reference end to end. Docs: docs/ui-parity.md (header and revision history), ROADMAP.md (header and progress log). 🤖 Generated with Codebuff Co-Authored-By: Codebuff --- ROADMAP.md | 3 +- crates/engine/src/cmd/edit.rs | 41 +++++++++++++++++++++-- crates/formula/src/adjust.rs | 62 ++++++++++++++++++++++++++++++++++- crates/formula/src/tests.rs | 23 ++++++++++++- docs/ui-parity.md | 3 +- 5 files changed, 126 insertions(+), 6 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index c9e746bc5a..62c9e7217c 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -2,7 +2,7 @@ **Stage: alpha** · next: beta, ~25 points of "ready for real work" and ~160–240 h away -> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-25 · **Change:** minor (AutoSum over a selected row puts its total to the right, and fills a selection's empty last row and column) · **Target:** Microsoft Excel (Microsoft 365) +> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-26 · **Change:** minor (Paste Special ▸ Transpose turns a formula's references with the cell that carries it, as Excel does) · **Target:** Microsoft Excel (Microsoft 365) GridCraft aims at full Microsoft Excel parity, and at being better in places: faster, open (XLSX is the native format), fully scriptable by agents (MCP, control channel, CLI), and on the web. @@ -135,6 +135,7 @@ Ranked; estimates in Opus 5.5 agent-hours. Detail and the full beta-gate list in | Date | What landed | |---|---| +| 2026-10-26 | Paste Special ▸ Transpose turns a formula's references with the cell that carries it, as Excel does: the row offset becomes the column offset and the other way round, so `=A3+1` copied from A3:A4 and pasted at C3 reads the cell to its left (`=C3+1`) instead of keeping the offset it had in the column; a reference pinned with `$` is left standing, a whole row or column comes back as a cell range open to the sheet's edge, and one off the grid is `#REF!` (#2450) | | 2026-10-25 | AutoSum over a selection does what Excel does: a selected row gets one total to its right (in its last cell if that is empty), not a one-cell total under each cell; a block whose last column is empty gets each row's total there, one whose last row is empty each column's, and with both the corner gets the total of the block; otherwise totals go under each column as before | | 2026-10-24 | Go To lists the named ranges of every sheet (`Sheet2!Name` for a name scoped to another sheet; hidden names, constants and formulas left out) and the references entered before, a double-click goes to an entry, and the Reference box takes several names or references separated by commas (`Price, Type`, `B14:C22,F19:G30`) | | 2026-10-24 | Status bar: a right-click opens a menu that sets which selection statistics show (Average, Count and Sum by default; Numerical Count, Minimum and Maximum are new), kept with the preferences (`view.statusBar`) | diff --git a/crates/engine/src/cmd/edit.rs b/crates/engine/src/cmd/edit.rs index 102edc2d36..7009b1878d 100644 --- a/crates/engine/src/cmd/edit.rs +++ b/crates/engine/src/cmd/edit.rs @@ -1219,8 +1219,12 @@ fn paste_special(s: &mut Session, p: &Json) -> Result { moved.dynamic = f.dynamic; return Some(std::sync::Arc::new(moved)); } - let moved = - gridcraft_formula::adjust::shift_relative(e, dest.row as i64 - sc.row as i64, dest.col as i64 - sc.col as i64); + let moved = if transpose { + // A transposed paste turns the references instead of shifting them (#2450). + gridcraft_formula::adjust::transpose_relative(e, sc, dest) + } else { + gridcraft_formula::adjust::shift_relative(e, dest.row as i64 - sc.row as i64, dest.col as i64 - sc.col as i64) + }; Some(std::sync::Arc::new(Formula { dynamic: f.dynamic, ..Formula::from_expr(moved) })) }; if link { @@ -2203,6 +2207,39 @@ mod tests { assert_eq!(get(&mut s, "XFD2")["value"], json!(2.0)); } + #[test] + fn transposed_paste_turns_the_formula_with_the_cell_that_carries_it() { + // #2450: the values moved but the formula kept the offset it had in the source column, + // so it read the cell above instead of the cell to its left. + let mut s = Session::new(); + s.new_workbook(); + s.execute("cell.set", json!({"cell": "A3", "input": "2025-10-31"})).unwrap(); + s.execute("cell.set", json!({"cell": "A4", "input": "=A3+1"})).unwrap(); + s.execute("edit.copy", json!({"range": "A3:A4"})).unwrap(); + s.execute("edit.pasteSpecial", json!({"what": "all", "transpose": true, "at": "C3"})).unwrap(); + let get = |s: &mut Session, a: &str| s.execute("cell.get", json!({"cell": a})).unwrap(); + let date = get(&mut s, "C3")["value"].as_f64().expect("the date pastes as its serial"); + assert_eq!(date, get(&mut s, "A3")["value"].as_f64().unwrap()); + assert_eq!(get(&mut s, "D3")["formula"], "=C3+1", "the formula reads the cell to its left, as Excel's does"); + assert_eq!(get(&mut s, "D3")["value"].as_f64().unwrap(), date + 1.0, "and shows the day after it"); + } + + #[test] + fn transposed_paste_turns_every_kind_of_reference_the_way_excel_does() { + // Observed from Excel 16: relative parts turn a quarter turn, a reference pinned with $ + // is left standing, and a whole column comes back as a range open to the sheet's edge. + let mut s = Session::new(); + s.new_workbook(); + s.execute("range.setValues", json!({"range": "A1", "values": [["=B1+1"], ["=$B$1"], ["=SUM(B1:C3)"], ["=SUM(B:D)"]]})).unwrap(); + s.execute("edit.copy", json!({"range": "A1:A4"})).unwrap(); + s.execute("edit.pasteSpecial", json!({"what": "all", "transpose": true, "at": "C10"})).unwrap(); + let formula = |s: &mut Session, a: &str| s.execute("cell.get", json!({"cell": a})).unwrap()["formula"].clone(); + assert_eq!(formula(&mut s, "C10"), "=C11+1"); + assert_eq!(formula(&mut s, "D10"), "=$B$1"); + assert_eq!(formula(&mut s, "E10"), "=SUM(C11:E12)"); + assert_eq!(formula(&mut s, "F10"), "=SUM($C11:$XFD13)"); + } + #[test] fn replace_case_insensitive() { assert_eq!(replace_ci("Apple apple APPLE", "apple", "pear"), "pear pear pear"); diff --git a/crates/formula/src/adjust.rs b/crates/formula/src/adjust.rs index 319474b4ef..04e1fd1cbf 100644 --- a/crates/formula/src/adjust.rs +++ b/crates/formula/src/adjust.rs @@ -1,7 +1,7 @@ //! Reference adjustment: copying formulas, inserting/deleting rows and columns, moving cells, //! renaming and deleting sheets. -use gridcraft_core::{CellError, MAX_COLS, MAX_ROWS, RangeRef}; +use gridcraft_core::{CellError, CellRef, MAX_COLS, MAX_ROWS, RangeRef}; use crate::ast::{Anchor, Expr, RefKind, Reference, SheetSel, clamp_anchor}; @@ -36,6 +36,66 @@ pub fn shift_relative_wrapping(e: Expr, dr: i64, dc: i64) -> Expr { }) } +/// Paste Special ▸ Transpose: the cell holding the formula moves from `src` to `dest`, so every +/// reference turns a quarter turn with it — its row offset becomes its column offset and the other +/// way round, `(r, c)` → `dest + (c − src.col, r − src.row)`. +/// +/// As Excel writes it out: a reference that pins a row or a column with `$` is left exactly as it +/// stands, a whole-row or whole-column reference comes back as a cell range whose open side runs +/// from the transposed far edge of the sheet, and a result that falls off the grid becomes `#REF!`. +pub fn transpose_relative(e: Expr, src: CellRef, dest: CellRef) -> Expr { + e.map(&mut |x| match x { + Expr::Ref(r) if !has_absolute(&r) => match transpose_ref(&r, src, dest) { + Some(r) => Expr::Ref(r), + None => Expr::Error(CellError::Ref), + }, + other => other, + }) +} + +/// Whether any end of the reference pins a row or a column with `$`. +fn has_absolute(r: &Reference) -> bool { + let abs = |a: &Anchor| a.row_abs || a.col_abs; + match &r.kind { + RefKind::Cell(a) => abs(a), + RefKind::Range(a, b) => abs(a) || abs(b), + RefKind::Rows(_, a0, _, a1) | RefKind::Cols(_, a0, _, a1) => *a0 || *a1, + } +} + +/// Where an end lands after the turn: its column drives the new row, its row the new column. +fn transpose_anchor(a: &Anchor, src: CellRef, dest: CellRef) -> Option<(u32, u32)> { + clamp_anchor(dest.row as i64 + a.col as i64 - src.col as i64, dest.col as i64 + a.row as i64 - src.row as i64) +} + +fn transpose_ref(r: &Reference, src: CellRef, dest: CellRef) -> Option { + let kind = match &r.kind { + RefKind::Cell(a) => { + let (row, col) = transpose_anchor(a, src, dest)?; + RefKind::Cell(Anchor { row, col, ..*a }) + } + RefKind::Range(a, b) => { + let (row, col) = transpose_anchor(a, src, dest)?; + let (row2, col2) = transpose_anchor(b, src, dest)?; + RefKind::Range(Anchor { row, col, ..*a }, Anchor { row: row2, col: col2, ..*b }) + } + // A whole row turns into a cell range: its rows become columns, while its open columns + // become rows pinned with `$` — from the transposed first column down to the last row. + RefKind::Rows(r0, _, r1, _) => { + let (row, col) = clamp_anchor(dest.row as i64 - src.col as i64, dest.col as i64 + *r0 as i64 - src.row as i64)?; + let (row2, col2) = clamp_anchor(MAX_ROWS as i64 - 1, dest.col as i64 + *r1 as i64 - src.row as i64)?; + RefKind::Range(Anchor { row, col, row_abs: true, col_abs: false }, Anchor { row: row2, col: col2, row_abs: true, col_abs: false }) + } + // A whole column likewise: its columns become rows, its open rows become columns up to XFD. + RefKind::Cols(c0, _, c1, _) => { + let (row, col) = clamp_anchor(dest.row as i64 + *c0 as i64 - src.col as i64, dest.col as i64 - src.row as i64)?; + let (row2, col2) = clamp_anchor(dest.row as i64 + *c1 as i64 - src.col as i64, MAX_COLS as i64 - 1)?; + RefKind::Range(Anchor { row, col, row_abs: false, col_abs: true }, Anchor { row: row2, col: col2, row_abs: false, col_abs: true }) + } + }; + Some(Reference { sheet: r.sheet.clone(), kind }) +} + /// Whether the formula has a relative (no `$`) row or column anywhere. pub fn has_relative_refs(e: &Expr) -> bool { e.references().iter().any(|r| match r.kind { diff --git a/crates/formula/src/tests.rs b/crates/formula/src/tests.rs index a7506aa4bc..f1fa9d5060 100644 --- a/crates/formula/src/tests.rs +++ b/crates/formula/src/tests.rs @@ -1,5 +1,5 @@ use super::*; -use crate::adjust::{Axis, Edit, adjust, rename_sheet, shift_relative}; +use crate::adjust::{Axis, Edit, adjust, rename_sheet, shift_relative, transpose_relative}; fn rt(src: &str) -> String { print(&parse(src).unwrap_or_else(|e| panic!("{src}: {e}"))) @@ -165,6 +165,27 @@ fn copy_shift() { assert_eq!(print(&shift_relative(e, 5, 1)), "SUM(B:B)"); } +#[test] +fn copy_transpose() { + let at = gridcraft_core::CellRef::new; + // The row of each reference drives its new column and the other way round (Excel, observed: + // A1 → F6 carrying =B1+1 comes out as =F7+1). + let e = parse("B1+SUM(B1:C3)+Sheet2!A1").unwrap(); + assert_eq!(print(&transpose_relative(e, at(0, 0), at(5, 5))), "F7+SUM(F7:H8)+Sheet2!F6"); + // The turn is around the two positions of the formula's cell, not around A1. + let e = parse("G3+SUM(1:2)").unwrap(); + assert_eq!(print(&transpose_relative(e, at(1, 2), at(9, 5))), "G14+SUM(E$8:F$1048576)"); + // A reference pinned with `$` is left exactly as it stands. + let e = parse("$B$1+B$1+$B1+SUM($B$1:$C$3)").unwrap(); + assert_eq!(print(&transpose_relative(e, at(0, 0), at(5, 5))), "$B$1+B$1+$B1+SUM($B$1:$C$3)"); + // Whole rows and columns come back as a cell range open to the sheet's edge. + let e = parse("SUM(1:2)+SUM(B:D)").unwrap(); + assert_eq!(print(&transpose_relative(e, at(0, 0), at(5, 5))), "SUM(F$6:G$1048576)+SUM($F7:$XFD9)"); + // Off the grid is #REF!, like a copy that runs past the edge. + let e = parse("A16384+B1").unwrap(); + assert_eq!(print(&transpose_relative(e, at(0, 0), at(5, 5))), "#REF!+F7"); +} + #[test] fn insert_delete() { let ins = Edit::Insert { axis: Axis::Rows, at: 2, count: 2 }; diff --git a/docs/ui-parity.md b/docs/ui-parity.md index ed875cc8ef..9cd49ba65b 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-25 · **Change:** minor (AutoSum over a selected row puts its total to the right) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-26 · **Change:** minor (Paste Special ▸ Transpose turns a formula's references with the cell that carries it, as Excel does) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4 Interaction, controls and feel, against Excel. Part of [target-app-parity.md](target-app-parity.md). **UI/UX fidelity: ~55% ready, 50–80 h** (estimated). Ribbon command coverage is measured @@ -186,6 +186,7 @@ scrollbar bugs 2–4 · pixel/feel pass against observed Excel 7–12. | Date | Change | Summary | |---|---|---| +| 2026-10-26 | minor | Paste Special ▸ Transpose turns a formula's references with the cell that carries it, as Excel's does (#2450): the row offset becomes the column offset and the other way round, so `=A3+1` copied from A3:A4 and pasted at C3 lands as `=C3+1` and shows the day after the cell to its left, instead of keeping the offset it had in the column and reading the cell above. A reference pinned with `$` is left exactly as Excel leaves it, a whole row or column comes back as a cell range open to the sheet's edge, and one that lands off the grid is `#REF!` | | 2026-10-25 | minor | AutoSum (Alt+=, Home › AutoSum) over a selected row puts its total to the right of the row, or in its last cell when that is empty, as in Excel; it wrote a one-cell total under each cell. A selection's empty last column takes each row's total and its empty last row each column's, with the block's total in the corner when both are empty | | 2026-10-25 | minor | Paste Name lays out only the names in view, so a workbook with thousands of names opens it at once; the arrow keys still scroll the chosen name into view. Go To matches a `Sheet2!Name` reference and hides a workbook name behind the active sheet's own name in any case and script (`Größe` = `GRÖSSE`), as formulas do. The two Page Layout view rows are one; the 0.7 in side margin used when Align with Page Margins is off is marked unverified | | 2026-10-24 | minor | Go To lists the named ranges on every sheet, as Excel's does ("The Go to popup window shows named ranges on every worksheet in your workbook"): a name scoped to another sheet appears as `Sheet2!Name`, and hidden names, constants and formulas are left out. It keeps the references entered (newest first, ten at most), and a double-click on an entry goes there. The Reference box and `edit.goTo` take several names or references separated by commas (`Price, Type`, `B14:C22,F19:G30,H21:H29`) and select them all; `edit.goTo {list: true}` returns the list | From a53483874e94e62e4272b160909d58fe1dd01759 Mon Sep 17 00:00:00 2001 From: zyzabruh Date: Mon, 26 Oct 2026 01:40:53 +0100 Subject: [PATCH 25/94] Formula: document transpose_ref's turn and its #REF! contract (review #2606) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CodeRabbit's only finding on the pull request was docstring coverage on the touched functions; this is the one that carried an undocumented contract — `None` means an end left the sheet and the caller turns it into `#REF!`. 🤖 Generated with Codebuff Co-Authored-By: Codebuff --- crates/formula/src/adjust.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/formula/src/adjust.rs b/crates/formula/src/adjust.rs index 04e1fd1cbf..2b3739bb2f 100644 --- a/crates/formula/src/adjust.rs +++ b/crates/formula/src/adjust.rs @@ -68,6 +68,8 @@ fn transpose_anchor(a: &Anchor, src: CellRef, dest: CellRef) -> Option<(u32, u32 clamp_anchor(dest.row as i64 + a.col as i64 - src.col as i64, dest.col as i64 + a.row as i64 - src.row as i64) } +/// Turns one reference with `src` → `dest`: `None` when an end falls outside the sheet, which +/// the caller turns into `#REF!`. fn transpose_ref(r: &Reference, src: CellRef, dest: CellRef) -> Option { let kind = match &r.kind { RefKind::Cell(a) => { From de8f36ee33060a73798a1accccc6cd0a03510d4c Mon Sep 17 00:00:00 2001 From: Zaxaerith <189452125+Zaxaerith@users.noreply.github.com> Date: Mon, 26 Oct 2026 18:45:52 +0800 Subject: [PATCH 26/94] fix(ui): left-align font name in Home ribbon (#2454) Co-Authored-By: Codex --- crates/ui-egui/src/ribbon.rs | 3 ++- crates/ui-egui/tests/keytips.rs | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/ribbon.rs b/crates/ui-egui/src/ribbon.rs index 37cb2a844f..8980682d1e 100644 --- a/crates/ui-egui/src/ribbon.rs +++ b/crates/ui-egui/src/ribbon.rs @@ -1294,7 +1294,8 @@ fn autosum_menu(app: &mut SheetApp, ui: &mut Ui) { fn font_combo(app: &mut SheetApp, ui: &mut Ui, st: &Style) { let name = st.font.name.clone(); - let resp = ui.add_sized([150.0, 24.0], egui::Button::new(egui::RichText::new(&name).font(theme::ui_font(12.5)))); + // The trailing grow atom left-aligns the existing label inside the button. + let resp = ui.add_sized([150.0, 24.0], egui::Button::new(egui::RichText::new(&name).font(theme::ui_font(12.5))).right_text(())); control_keytip(app, ui, &resp, "home.fontName"); let forced = invoke(app, "home.fontName"); let items: Vec<(&str, String)> = FONTS.iter().map(|f| (*f, f.to_string())).collect(); diff --git a/crates/ui-egui/tests/keytips.rs b/crates/ui-egui/tests/keytips.rs index b4418018af..d3b0907991 100644 --- a/crates/ui-egui/tests/keytips.rs +++ b/crates/ui-egui/tests/keytips.rs @@ -522,6 +522,30 @@ fn pending_sequences_go_live_when_the_command_lands() { assert_eq!(h.state().keytips.prefix(), None); } +#[test] +fn font_name_box_left_aligns_short_and_long_names() -> Result<(), String> { + for name in ["Arial", "Calibri", "Times New Roman"] { + let mut session = blank(); + session.execute("home.fontName", json!({"name": name})).map_err(|e| e.to_string())?; + let h = harness(session); + // Querying the original name also checks that the button keeps its accessible label. + let rect = h.get_by_role_and_label(egui::accesskit::Role::Button, name).rect(); + assert!((rect.width() - 150.0).abs() < 0.1 && (rect.height() - 24.0).abs() < 0.1, "{name}: {rect:?}"); + let text_x = h + .output() + .shapes + .iter() + .find_map(|shape| match &shape.shape { + egui::Shape::Text(text) if text.galley.text() == name && rect.contains(text.pos) => Some(text.pos.x), + _ => None, + }) + .ok_or("font name was not painted inside its button")?; + let inset = text_x - rect.left(); + assert!((0.0..=10.0).contains(&inset), "{name}: expected a small left inset, got {inset}"); + } + Ok(()) +} + #[test] fn control_keytips_open_dropdowns_and_run_handlers() { // HFF routes to the font control: its dropdown opens (popup items queryable). From c708afad34b91d08e51dc415e34f8a4e68d8e6b5 Mon Sep 17 00:00:00 2001 From: Harrison Booth <73434116+Harrison-Booth@users.noreply.github.com> Date: Mon, 26 Oct 2026 10:10:19 -0500 Subject: [PATCH 27/94] Array entry of a constant fills every cell and forms no array Ctrl+Shift+Enter over a multi-cell selection with a plain value puts that value in every cell, as Excel does; formulas still become arrays. --- crates/engine/src/cmd/edit.rs | 60 +++++++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 10 deletions(-) diff --git a/crates/engine/src/cmd/edit.rs b/crates/engine/src/cmd/edit.rs index 4da5cf2f75..99c8f41ecf 100644 --- a/crates/engine/src/cmd/edit.rs +++ b/crates/engine/src/cmd/edit.rs @@ -244,11 +244,29 @@ fn cell_set(s: &mut Session, p: &Json) -> Result { // the cell; a cell elsewhere (or on another sheet) gets a one-cell array. let selected = cx.sel.current(); let range = if sheet == active_sheet && selected.contains(at) { selected } else { RangeRef::cell(at) }; + let mut cell = input_to_cell(&input, sheet, range.start, &mut cx.wb)?.unwrap_or_default(); + // Excel forms no array from a constant: every cell of the selection takes the value. + if cell.formula.is_none() && !range.is_single() { + if range.count() > crate::fill::MAX_FILL_CELLS { + return Err(EngineError::Other("That selection is too large to fill.".into())); + } + for c in range.iter() { + let filled = input_to_cell(&input, sheet, c, &mut cx.wb)?; + let sh = cx.sheet_mut(sheet)?; + match filled { + Some(f) => sh.set_cell(c, f), + None => { + sh.remove_cell(c); + } + } + cx.touch(sheet, c); + } + return Ok(Json::Null); + } // A table header can't hold an array's value, and a table resizes under it. if !range.is_single() && cx.wb.sheet(sheet).is_some_and(|sh| sh.tables.iter().any(|t| t.range.intersects(&range))) { return Err(EngineError::Other("Multi-cell array formulas aren't allowed in tables.".into())); } - let mut cell = input_to_cell(&input, sheet, range.start, &mut cx.wb)?.unwrap_or_default(); if let Some(f) = cell.formula.as_mut() { std::sync::Arc::make_mut(f).array = Some(range); } @@ -2153,7 +2171,7 @@ mod tests { } #[test] - fn array_entering_a_constant_recalculates_readers_of_the_cleared_cells() { + fn array_entering_a_constant_recalculates_readers_of_the_cells_it_fills() { // Found by the command-sequence fuzzer (seeds 4, 1213): only the array's first cell was // marked changed, so formulas reading the cells it cleared kept their old values. let mut s = Session::new(); @@ -2162,8 +2180,13 @@ mod tests { s.execute("selection.set", json!({"active": "A1", "range": "A1:B1"})).unwrap(); s.execute("cell.set", json!({"cell": "A1", "input": "7", "array": true})).unwrap(); let sh = s.doc().unwrap().wb.active().unwrap(); - assert_eq!(sh.value(CellRef::parse("B1").unwrap()), Value::Empty); - assert_eq!(sh.value(CellRef::parse("C1").unwrap()), Value::number(1.0)); + // Excel fills both cells with the constant and forms no array. + for a in ["A1", "B1"] { + let c = sh.cell(CellRef::parse(a).unwrap()).unwrap(); + assert_eq!(c.value, Value::number(7.0)); + assert!(c.formula.is_none()); + } + assert_eq!(sh.value(CellRef::parse("C1").unwrap()), Value::number(8.0)); // The fuzzer's minimal repro on the budget sample. let mut s = Session::new(); @@ -2175,9 +2198,26 @@ mod tests { } #[test] - fn a_whole_column_array_clears_its_whole_area() { - // The clearing loop stopped after a million addresses, so content further down the - // column survived inside the array (and its readers weren't recalculated). + fn array_entering_a_formula_fills_every_cell_as_an_array() { + let mut s = Session::new(); + s.new_workbook(); + s.execute("cell.set", json!({"cell": "A2", "input": "5"})).unwrap(); + for (input, want) in [("=1", 1.0), ("=A2", 5.0)] { + s.execute("selection.set", json!({"active": "A1", "range": "A1:B1"})).unwrap(); + s.execute("cell.set", json!({"cell": "A1", "input": input, "array": true})).unwrap(); + let sh = s.doc().unwrap().wb.active().unwrap(); + for a in ["A1", "B1"] { + assert_eq!(sh.value(CellRef::parse(a).unwrap()), Value::number(want), "{input} {a}"); + } + let f = sh.cell(CellRef::parse("A1").unwrap()).and_then(|c| c.formula.clone()).unwrap(); + assert_eq!(f.array, Some(RangeRef::parse("A1:B1").unwrap())); + } + } + + #[test] + fn a_whole_column_constant_fills_its_whole_area() { + // The loop stopped after a million addresses, so cells further down the column kept + // their old content (and their readers weren't recalculated). let mut s = Session::new(); s.new_workbook(); s.execute("cell.set", json!({"cell": "D1048000", "input": "41"})).unwrap(); @@ -2185,9 +2225,9 @@ mod tests { s.execute("selection.set", json!({"active": "D1", "range": "D:D"})).unwrap(); s.execute("cell.set", json!({"cell": "D1", "input": "1", "array": true})).unwrap(); let sh = s.doc().unwrap().wb.active().unwrap(); - assert_eq!(sh.value(CellRef::parse("D1048000").unwrap()), Value::Empty); - assert_eq!(sh.value(CellRef::parse("F1").unwrap()), Value::number(1.0)); - assert_eq!(fully_recalculated(&s, "F1"), Value::number(1.0)); + assert_eq!(sh.value(CellRef::parse("D1048000").unwrap()), Value::number(1.0)); + assert_eq!(sh.value(CellRef::parse("F1").unwrap()), Value::number(2.0)); + assert_eq!(fully_recalculated(&s, "F1"), Value::number(2.0)); } #[test] From 7a8b2261f8cbdaf7d23872b823f7b6f3c1faa308 Mon Sep 17 00:00:00 2001 From: Harrison Booth <73434116+Harrison-Booth@users.noreply.github.com> Date: Mon, 26 Oct 2026 10:20:01 -0500 Subject: [PATCH 28/94] Array entry of a formula marks every result cell changed, stored or not --- crates/engine/src/cmd/edit.rs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/cmd/edit.rs b/crates/engine/src/cmd/edit.rs index 99c8f41ecf..ac5ba49e28 100644 --- a/crates/engine/src/cmd/edit.rs +++ b/crates/engine/src/cmd/edit.rs @@ -285,8 +285,16 @@ fn cell_set(s: &mut Session, p: &Json) -> Result { } sh.set_cell(range.start, cell); cx.touch(sheet, range.start); - for (c, _) in cleared { - cx.touch(sheet, c); + // The array's results land in every cell of the range, stored or not, so readers of + // an empty result cell need the touch too. A huge range marks only the cells it held. + if range.count() <= 1_000_000 { + for c in range.iter() { + cx.touch(sheet, c); + } + } else { + for (c, _) in cleared { + cx.touch(sheet, c); + } } return Ok(Json::Null); } @@ -2214,6 +2222,17 @@ mod tests { } } + #[test] + fn readers_of_an_empty_array_result_cell_see_its_result() { + let mut s = Session::new(); + s.new_workbook(); + s.execute("cell.set", json!({"cell": "D1", "input": "=B1+1"})).unwrap(); + s.execute("selection.set", json!({"active": "A1", "range": "A1:B1"})).unwrap(); + s.execute("cell.set", json!({"cell": "A1", "input": "=5", "array": true})).unwrap(); + assert_eq!(s.doc().unwrap().wb.active().unwrap().value(CellRef::parse("D1").unwrap()), Value::number(6.0)); + assert_eq!(fully_recalculated(&s, "D1"), Value::number(6.0)); + } + #[test] fn a_whole_column_constant_fills_its_whole_area() { // The loop stopped after a million addresses, so cells further down the column kept From fb19a4fb874fa45b4a9a71e8c354aaaa8b146200 Mon Sep 17 00:00:00 2001 From: Harrison Booth <73434116+Harrison-Booth@users.noreply.github.com> Date: Tue, 27 Oct 2026 16:19:51 -0500 Subject: [PATCH 29/94] Table results: keep one-value spills out of the range-aggregate spill check --- crates/calc/src/recalc/pass_host.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/calc/src/recalc/pass_host.rs b/crates/calc/src/recalc/pass_host.rs index 483500f819..c492e70bf2 100644 --- a/crates/calc/src/recalc/pass_host.rs +++ b/crates/calc/src/recalc/pass_host.rs @@ -523,8 +523,11 @@ impl Host for PassHost<'_> { } } // Spilled values sit between the stored cells (and the formulas just calculated may have - // produced some): leave such blocks to `range_values`. - if self.spills.keys().any(|a| a.0 == sheet) || sh.spill.range(range.start..=range.end).any(|(c, _)| range.contains(*c)) { + // produced some): leave such blocks to `range_values`. A one-value result (kept for `C4#`) + // fills only its anchor, a formula cell read above, so it doesn't count. + if self.spills.iter().any(|(a, arr)| a.0 == sheet && arr.data.len() > 1) + || sh.spill.range(range.start..=range.end).any(|(c, _)| range.contains(*c)) + { return false; } for (c, cell) in sh.cells.iter_range(range) { From 921cdc974f12b22bc5001e4fd2d2f1ee08051e7d Mon Sep 17 00:00:00 2001 From: kezmdor <15539254+kezmdor@users.noreply.github.com> Date: Sat, 31 Oct 2026 11:59:24 +0100 Subject: [PATCH 30/94] AutoSum tests join the `it` test binary, as main's UI tests do The module uses the shared harness (`common::builder`, `common::app`), so it runs with the pinned font set like the other UI tests. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/tests/{ => it}/autosum_edit.rs | 14 +++----------- crates/ui-egui/tests/it/main.rs | 1 + 2 files changed, 4 insertions(+), 11 deletions(-) rename crates/ui-egui/tests/{ => it}/autosum_edit.rs (93%) diff --git a/crates/ui-egui/tests/autosum_edit.rs b/crates/ui-egui/tests/it/autosum_edit.rs similarity index 93% rename from crates/ui-egui/tests/autosum_edit.rs rename to crates/ui-egui/tests/it/autosum_edit.rs index 9f76bf8a8d..5440fffe02 100644 --- a/crates/ui-egui/tests/autosum_edit.rs +++ b/crates/ui-egui/tests/it/autosum_edit.rs @@ -4,10 +4,10 @@ use egui::{Event, Key, Modifiers, PointerButton, Pos2}; use gridcraft_engine::core::{CellRef, Value}; use gridcraft_engine::{Mode, Session}; -use gridcraft_ui_egui::{SheetApp, grid::Geo}; +use gridcraft_ui_egui::grid::Geo; use serde_json::json; -type Harness = egui_kittest::Harness<'static, SheetApp>; +use crate::common::Harness; /// 1, 2, 3 in A1:A3 and `selected` selected. fn harness(selected: &str) -> Harness { @@ -20,15 +20,7 @@ fn harness_at(first: &str, selected: &str) -> Harness { session.new_workbook(); session.execute("range.setValues", json!({"range": first, "values": [[1], [2], [3]]})).unwrap(); session.execute("selection.set", json!({"range": selected})).unwrap(); - let mut h = egui_kittest::Harness::builder().with_size(egui::vec2(1200.0, 800.0)).build_ui_state( - |ui, app: &mut SheetApp| { - app.logic(ui.ctx()); - app.ui(ui); - }, - SheetApp::new(session, Default::default()), - ); - h.run_steps(4); - h + crate::common::harness_with(crate::common::builder().with_size(egui::vec2(1200.0, 800.0)), crate::common::app(session), 4) } /// The AutoSum button: a menu-style run. diff --git a/crates/ui-egui/tests/it/main.rs b/crates/ui-egui/tests/it/main.rs index 302bc9c49c..d37c238250 100644 --- a/crates/ui-egui/tests/it/main.rs +++ b/crates/ui-egui/tests/it/main.rs @@ -10,6 +10,7 @@ mod accounting_fill; mod advanced_filter; mod argument_names; mod autosave_persist; +mod autosum_edit; mod borders; mod cell_editor_caret; mod cell_pictures; From af4f17184c0f5e0891d5dd51e1716f3d0447a498 Mon Sep 17 00:00:00 2001 From: kezmdor <15539254+kezmdor@users.noreply.github.com> Date: Sat, 31 Oct 2026 12:20:56 +0100 Subject: [PATCH 31/94] Formula entry: `+` before a time stays text, as in Excel Checked by hand in Excel for the web (English (United States) regional format): `+1:30` stays text, while `-1:30` is the formula `=-1:30` (rows 1 to 30), `+1/30` and `-1/30` are formulas and `1:30` is a time. `starts_formula` now leaves a `+` followed by a time to the usual value parsing, which keeps it as text. Raised by @iluebbe in #2023. Co-Authored-By: Claude Opus 5.5 --- crates/core/src/parse.rs | 15 ++++++++++----- crates/engine/src/tests.rs | 21 ++++++++++++++++----- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/crates/core/src/parse.rs b/crates/core/src/parse.rs index 504a92d01f..ffad72c849 100644 --- a/crates/core/src/parse.rs +++ b/crates/core/src/parse.rs @@ -52,9 +52,14 @@ pub fn parse_number_text_in(s: &str, sys: DateSystem) -> Option { /// Whether typed cell input is meant as a formula: it starts with `=`, or, as Lotus 1-2-3 users /// type it, with `+` or `-` and isn't a number on its own (`+5+4` is `=+5+4`, `-5` the number -5, /// a lone `+` or `-` text). A leading space or apostrophe makes the input text. Callers parse -/// the formula; a `+` or `-` entry that doesn't parse (`--`) stays text, as in Excel. +/// the formula; a `+` or `-` entry that doesn't parse (`--`) stays text, as in Excel. So does `+` +/// before a time (`+1:30`), while `-1:30` is a formula (rows 1 to 30), as Excel for the web does. pub fn starts_formula(input: &str) -> bool { - input.starts_with('=') || (input.len() > 1 && input.starts_with(['+', '-']) && parse_number_text(input).is_none()) + input.starts_with('=') + || (input.len() > 1 + && input.starts_with(['+', '-']) + && parse_number_text(input).is_none() + && !input.strip_prefix('+').is_some_and(|time| time.contains(':') && parse_number_text(time).is_some())) } /// Text that Excel's "Number Stored as Text" check flags: it would be a number if typed (signs, @@ -588,12 +593,12 @@ mod tests { #[test] fn a_leading_sign_starts_a_formula_unless_the_entry_is_a_number() { // #2023: Excel reads `+5+4` as `=+5+4`, as Lotus 1-2-3 did. - for s in ["=1", "=", "+5+4", "-5+4", "--5", "+-5", "-.5*2", "-3/4", "+A1", "-SUM(1,2)", "+(5+4)", "-abc", "--"] { + for s in ["=1", "=", "+5+4", "-5+4", "--5", "+-5", "-.5*2", "-3/4", "+A1", "-SUM(1,2)", "+(5+4)", "-abc", "--", "-1:30", "+1/30", "-1/30"] { assert!(starts_formula(s), "{s}"); } // Signed numbers, percentages and currency stay numbers; a lone sign, a leading space or - // apostrophe and other text stay text. - for s in ["+5", "-5", "+5%", "-$5", "-1e3", "+.5", "-1,234.5", "+", "-", " +5+4", "'+5+4", "5+4", "", "a-b"] { + // apostrophe, `+` before a time and other text stay text. + for s in ["+5", "-5", "+5%", "-$5", "-1e3", "+.5", "-1,234.5", "+", "-", " +5+4", "'+5+4", "5+4", "", "a-b", "+1:30", "+0:30:15"] { assert!(!starts_formula(s), "{s}"); } } diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 20c434d920..5239762d88 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -251,9 +251,16 @@ fn a_leading_plus_or_minus_starts_a_formula() { // #2023: like Excel (and Lotus 1-2-3 before it), typing `+5+4` enters the formula `=+5+4`. let mut s = s(); let input = |s: &Session, a: &str| s.doc().unwrap().wb.active().unwrap().cell(CellRef::parse(a).unwrap()).map(|c| c.input_text()); - for (cell, typed, value) in - [("A1", "+5+4", 9.0), ("A2", "-5+4", -1.0), ("A3", "--5", 5.0), ("A4", "-3/4", -0.75), ("A5", "+A1*2", 18.0), ("A6", "-(A1)", -9.0)] - { + for (cell, typed, value) in [ + ("A1", "+5+4", 9.0), + ("A2", "-5+4", -1.0), + ("A3", "--5", 5.0), + ("A4", "-3/4", -0.75), + ("A5", "+A1*2", 18.0), + ("A6", "-(A1)", -9.0), + ("A7", "+1/30", 1.0 / 30.0), + ("A8", "-1/30", -1.0 / 30.0), + ] { s.execute("cell.set", json!({"cell": cell, "input": typed})).unwrap_or_else(|e| panic!("{typed}: {e}")); assert_eq!(input(&s, cell), Some(format!("={typed}")), "{typed}"); assert_eq!(v(&s, cell), Value::Number(value), "{typed}"); @@ -281,6 +288,7 @@ fn a_leading_plus_or_minus_starts_a_formula() { ("'-abc", "'-abc"), ("--", "--"), ("+49 170 1234567", "+49 170 1234567"), + ("+1:30", "+1:30"), ] { s.execute("cell.set", json!({"cell": "B2", "input": typed})).unwrap(); let before = v(&s, "B2"); @@ -294,16 +302,19 @@ fn a_leading_plus_or_minus_starts_a_formula() { } // As observed in Excel for the web, an entry that doesn't read as a formula stays text, and // one that does but names nothing known is #NAME?. Only `=` entries are refused. - for typed in ["--", "-----", "+5+", "+49 170 1234567"] { + for typed in ["--", "-----", "+5+", "+49 170 1234567", "+1:30"] { s.execute("cell.set", json!({"cell": "C1", "input": typed})).unwrap_or_else(|e| panic!("{typed}: {e}")); assert_eq!(v(&s, "C1"), Value::text(typed), "{typed}"); assert_eq!(input(&s, "C1").as_deref(), Some(typed), "{typed}"); } s.execute("cell.set", json!({"cell": "C2", "input": "- item"})).unwrap(); assert_eq!(v(&s, "C2"), Value::Error(gridcraft_core::CellError::Name)); + // Excel for the web keeps `+1:30` as text (above) but reads `-1:30` as a formula (rows 1 to 30). + s.execute("cell.set", json!({"cell": "C40", "input": "-1:30"})).unwrap(); + assert_eq!(input(&s, "C40").as_deref(), Some("=-1:30")); let e = s.execute("cell.set", json!({"cell": "C1", "input": "=--"})).unwrap_err().to_string(); assert!(e.contains("problem with this formula"), "{e}"); - assert_eq!(v(&s, "C1"), Value::text("+49 170 1234567"), "a refused entry keeps the cell"); + assert_eq!(v(&s, "C1"), Value::text("+1:30"), "a refused entry keeps the cell"); // Pasted or split by Text to Columns, the same rule applies. s.execute("edit.paste", json!({"at": "D1", "text": "--\t-5+4\n"})).unwrap(); assert_eq!(v(&s, "D1"), Value::text("--")); From 6fb9b5cc3d6011fdb4392a25bcaf3a77a62ca5a5 Mon Sep 17 00:00:00 2001 From: MarekSpodBiedry <73122968+MarekSpodBiedry@users.noreply.github.com> Date: Wed, 4 Nov 2026 08:07:13 +0100 Subject: [PATCH 32/94] Wayland: test that the synthetic End is inserted before the plain wheel move (#2213) --- crates/ui-egui/src/app.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index 702bf2be4a..0b27d4f18c 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -351,6 +351,29 @@ mod lifecycle_tests { assert_eq!(app.synthetic.len(), 2, "press and release stay distinct batches"); } + #[cfg(all(unix, not(target_vendor = "apple")))] + #[test] + /// A synthetic Ctrl+wheel touch followed by a plain wheel move gets a zero-delta End inserted before the move. + fn synthetic_wheel_events_end_a_stuck_ctrl_touch() { + use egui::{Event, Modifiers, MouseWheelUnit, TouchPhase, vec2}; + let ctx = egui::Context::default(); + let mut app = app(); + let wheel = |modifiers| Event::MouseWheel { unit: MouseWheelUnit::Point, delta: vec2(0.0, 3.0), phase: TouchPhase::Move, modifiers }; + app.synthetic.push_back(vec![wheel(Modifiers::CTRL)]); + app.synthetic.push_back(vec![wheel(Modifiers::NONE)]); + let mut raw = egui::RawInput::default(); + app.raw_input_hook(&ctx, &mut raw); + assert_eq!(raw.events, vec![wheel(Modifiers::CTRL)]); + // A UI pass applied the first batch. + app.synthetic.pop_front(); + app.synthetic_pending = false; + app.synthetic_injected_at_pass = None; + let mut raw = egui::RawInput::default(); + app.raw_input_hook(&ctx, &mut raw); + let end = Event::MouseWheel { unit: MouseWheelUnit::Point, delta: egui::Vec2::ZERO, phase: TouchPhase::End, modifiers: Modifiers::NONE }; + assert_eq!(raw.events, vec![end, wheel(Modifiers::NONE)]); + } + /// Returns raw input with a screen rect at the given size. fn raw_with_size(size: egui::Vec2) -> egui::RawInput { egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, size)), ..Default::default() } From 4b65b85b23d81c1e1c6f3ea9d9102a8e6ee699c4 Mon Sep 17 00:00:00 2001 From: vangel76 Date: Thu, 5 Nov 2026 02:13:51 +0100 Subject: [PATCH 33/94] Quick Analysis: keep results outside the selection, refuse multi-area, plain Ctrl+Q only - analysis.addTotal / addSparklines place results beyond the selection's own far edge, so a selection reaching past the data no longer gets its totals inside it. - Both commands refuse a multi-area selection when no range is given. - Ctrl+Shift+Q and Ctrl+Alt+Q no longer toggle the popup. Co-Authored-By: Claude Sonnet 5.5 --- crates/engine/src/cmd/quick_analysis.rs | 26 ++++++++--- crates/engine/src/tests.rs | 45 +++++++++++++++++++ crates/ui-egui/src/ribbon/shortcuts.rs | 3 +- crates/ui-egui/tests/it/keyboard_shortcuts.rs | 12 +++++ 4 files changed, 79 insertions(+), 7 deletions(-) diff --git a/crates/engine/src/cmd/quick_analysis.rs b/crates/engine/src/cmd/quick_analysis.rs index ecfa77a056..6d0ade655c 100644 --- a/crates/engine/src/cmd/quick_analysis.rs +++ b/crates/engine/src/cmd/quick_analysis.rs @@ -74,6 +74,10 @@ struct Block { /// The columns (or, `by_rows`, the rows) of `data` that hold numbers. lines: BTreeSet, by_rows: bool, + /// Last row / column the results must stay clear of: the selection's own far edge, so a + /// selection reaching past the data still gets its results outside it. Whole rows or columns + /// (reaching the sheet limit) fall back to the clipped range. + edge: CellRef, } impl Block { @@ -93,7 +97,13 @@ fn block(s: &Session, p: &Json, by_rows: bool, cmd: &str) -> Result { let sheet = target_sheet(s, p)?; let sel = match str_param(p, "range") { Some(_) => target_range(s, p)?, - None => s.doc()?.selection.current(), + None => { + // Never guess from the current area of a multi-area selection. + if s.doc()?.selection.ranges.len() > 1 { + return Err(bad(cmd, "select a single contiguous range")); + } + s.doc()?.selection.current() + } }; if sel.is_single() { return Err(bad(cmd, "select at least two cells")); @@ -130,7 +140,11 @@ fn block(s: &Session, p: &Json, by_rows: bool, cmd: &str) -> Result { if lines.is_empty() { return Err(EngineError::Other("The selection holds no numbers.".into())); } - Ok(Block { sheet, range: r, data, lines, by_rows }) + let edge = CellRef::new( + if sel.end.row >= MAX_ROWS - 1 { r.end.row } else { sel.end.row.max(r.end.row) }, + if sel.end.col >= MAX_COLS - 1 { r.end.col } else { sel.end.col.max(r.end.col) }, + ); + Ok(Block { sheet, range: r, data, lines, by_rows, edge }) } fn add_total(s: &mut Session, p: &Json) -> Result { @@ -160,11 +174,12 @@ fn add_total(s: &mut Session, p: &Json) -> Result { }; // (target, formula) pairs. let mut writes: Vec<(CellRef, String)> = Vec::with_capacity(out_cells as usize); - let (height, width) = (r.height(), r.width()); + let (height, width) = (b.edge.row - r.start.row + 1, b.edge.col - r.start.col + 1); for &line in &b.lines { match func { Func::Aggregate(name) => { - let target = if by_rows { CellRef::new(line, r.end.col.saturating_add(1)) } else { CellRef::new(r.end.row.saturating_add(1), line) }; + let target = + if by_rows { CellRef::new(line, b.edge.col.saturating_add(1)) } else { CellRef::new(b.edge.row.saturating_add(1), line) }; writes.push((target, format!("={name}({})", b.line_range(line, lo, hi).a1()))); } Func::Percent | Func::Running => { @@ -238,12 +253,11 @@ fn add_sparklines(s: &mut Session, p: &Json) -> Result { return Err(bad(SPARK, "selection too large for this result")); } let (lo, hi) = b.span_of_line(); - let r = b.range; let sparks: Vec<(CellRef, String)> = b .lines .iter() .map(|&line| { - let at = if by_rows { CellRef::new(line, r.end.col.saturating_add(1)) } else { CellRef::new(r.end.row.saturating_add(1), line) }; + let at = if by_rows { CellRef::new(line, b.edge.col.saturating_add(1)) } else { CellRef::new(b.edge.row.saturating_add(1), line) }; (at, b.line_range(line, lo, hi).a1()) }) .collect(); diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 2a931b09a9..a573697095 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -4725,6 +4725,51 @@ fn analysis_add_total_refuses_bad_and_huge_input() { assert!(s.execute("analysis.addTotal", json!({"range": "B1:C1048576", "function": "runningTotal"})).is_err(), "per-cell block over the cap"); } +#[test] +fn analysis_results_stay_outside_a_selection_that_extends_past_the_data() { + let mut s = s(); + quick_analysis_block(&mut s); + // Data ends in row 4; the selection runs to row 10, so the sum goes in row 11. + let r = s.execute("analysis.addTotal", json!({"range": "A1:C10"})).unwrap(); + assert_eq!(r["output"], "B11:C11"); + assert_eq!(v(&s, "B11"), Value::Number(6.0)); + assert_eq!(v(&s, "B5"), Value::Empty); + // Per-row blocks and sparklines move out by the selection's size too. + let r = s.execute("analysis.addTotal", json!({"range": "B1:C10", "function": "runningTotal", "direction": "rows"})).unwrap(); + assert_eq!(r["output"], "B12:C14", "per-row block lands below the selection, not inside it"); + let r = s.execute("analysis.addSparklines", json!({"range": "A1:F4"})).unwrap(); + assert_eq!(r["output"], "G2:G4"); + let r = s.execute("analysis.addSparklines", json!({"range": "A1:C8", "direction": "columns"})).unwrap(); + assert_eq!(r["output"], "B9:C9"); +} + +#[test] +fn analysis_overwrite_keeps_the_target_cell_style() { + let mut s = s(); + quick_analysis_block(&mut s); + s.execute("cell.set", json!({"cell": "B5", "input": "1"})).unwrap(); + s.execute("selection.set", json!({"cell": "B5"})).unwrap(); + s.execute("home.bold", json!({})).unwrap(); + s.execute("analysis.addTotal", json!({"range": "A1:C4", "overwrite": true})).unwrap(); + assert_eq!(v(&s, "B5"), Value::Number(6.0)); + let d = s.doc().unwrap(); + let sh = d.wb.active().unwrap(); + assert!(d.wb.styles.get(sh.style_id(CellRef::parse("B5").unwrap())).font.bold, "bold survives the overwrite"); +} + +#[test] +fn analysis_commands_refuse_a_multi_area_selection_without_a_range() { + let mut s = s(); + quick_analysis_block(&mut s); + s.execute("selection.set", json!({"range": "A1:C4,E1:F4"})).unwrap(); + assert!(s.execute("analysis.addTotal", json!({})).is_err()); + assert!(s.execute("analysis.addSparklines", json!({})).is_err()); + assert_eq!(v(&s, "B5"), Value::Empty); + // An explicit range still works. + s.execute("analysis.addTotal", json!({"range": "A1:C4"})).unwrap(); + assert_eq!(v(&s, "B5"), Value::Number(6.0)); +} + #[test] fn analysis_add_sparklines_one_per_row_in_one_undo_step() { let mut s = s(); diff --git a/crates/ui-egui/src/ribbon/shortcuts.rs b/crates/ui-egui/src/ribbon/shortcuts.rs index 1af3dcc820..2eb118cd1f 100644 --- a/crates/ui-egui/src/ribbon/shortcuts.rs +++ b/crates/ui-egui/src/ribbon/shortcuts.rs @@ -42,7 +42,8 @@ pub fn shortcut(app: &mut SheetApp, key: Key, m: Modifiers) { Key::T if shift => Some(("formulas.autoSum", json!({}))), Key::T => Some(("insert.table", json!({}))), Key::E => Some(("edit.flashFill", json!({}))), - Key::Q => { + // Plain Ctrl+Q only: Ctrl+Shift+Q and Ctrl+Alt+Q (AltGr+Q) are not Quick Analysis. + Key::Q if !shift && !m.alt => { // Quick Analysis; a single cell has nothing to analyse, which is not worth an alert, // but several areas deserve to be told why nothing opened. if let Err(e) = crate::quick_analysis::toggle(app, None) diff --git a/crates/ui-egui/tests/it/keyboard_shortcuts.rs b/crates/ui-egui/tests/it/keyboard_shortcuts.rs index f59504dee4..56dadde3ae 100644 --- a/crates/ui-egui/tests/it/keyboard_shortcuts.rs +++ b/crates/ui-egui/tests/it/keyboard_shortcuts.rs @@ -303,3 +303,15 @@ fn ctrl_alt_letter_that_typed_text_is_not_select_all() { assert_eq!(h.state().session.active().unwrap().selection.current().a1(), "B2"); assert_eq!(h.state().editor.as_ref().unwrap().text, "\u{e4}"); } + +/// Only plain Ctrl+Q toggles Quick Analysis; Ctrl+Shift+Q and Ctrl+Alt+Q (AltGr+Q) do not. +#[test] +fn only_plain_ctrl_q_toggles_quick_analysis() { + let mut h = harness(book("A1:B3")); + key(&mut h, Key::Q, CTRL_SHIFT); + assert!(h.state().grid.quick_analysis.open.is_none(), "Ctrl+Shift+Q"); + key(&mut h, Key::Q, Modifiers { alt: true, ..CTRL }); + assert!(h.state().grid.quick_analysis.open.is_none(), "Ctrl+Alt+Q"); + key(&mut h, Key::Q, CTRL); + assert!(h.state().grid.quick_analysis.open.is_some(), "Ctrl+Q"); +} From 335109beb5ba780f3b1c90cd7b949dbfb9baabd9 Mon Sep 17 00:00:00 2001 From: vangel76 Date: Thu, 5 Nov 2026 02:16:37 +0100 Subject: [PATCH 34/94] Quick Analysis: assert the multi-area error text Co-Authored-By: Claude Sonnet 5.5 --- crates/engine/src/tests.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index a573697095..4461bc7994 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -4762,8 +4762,10 @@ fn analysis_commands_refuse_a_multi_area_selection_without_a_range() { let mut s = s(); quick_analysis_block(&mut s); s.execute("selection.set", json!({"range": "A1:C4,E1:F4"})).unwrap(); - assert!(s.execute("analysis.addTotal", json!({})).is_err()); - assert!(s.execute("analysis.addSparklines", json!({})).is_err()); + for c in ["analysis.addTotal", "analysis.addSparklines"] { + let e = s.execute(c, json!({})).unwrap_err().to_string(); + assert!(e.contains("single contiguous range"), "{c}: {e}"); + } assert_eq!(v(&s, "B5"), Value::Empty); // An explicit range still works. s.execute("analysis.addTotal", json!({"range": "A1:C4"})).unwrap(); From def4067247e25191363eca7d2c325c8c39c5f9b6 Mon Sep 17 00:00:00 2001 From: kezmdor <15539254+kezmdor@users.noreply.github.com> Date: Sat, 7 Nov 2026 14:22:50 +0100 Subject: [PATCH 35/94] AutoSum: main's Function Library test expects the proposal in the editor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Formulas › AutoSum and its Count Numbers item on one cell now leave `=SUM(A1:A3)` / `=COUNT(B1:B3)` in the editor until Enter, as in Excel (#1834); the test checks the proposal, presses Enter, then the cell. --- crates/ui-egui/tests/it/function_library.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/ui-egui/tests/it/function_library.rs b/crates/ui-egui/tests/it/function_library.rs index a1a7a1a37e..3cb132adc3 100644 --- a/crates/ui-egui/tests/it/function_library.rs +++ b/crates/ui-egui/tests/it/function_library.rs @@ -136,6 +136,10 @@ fn autosum_runs_sum_and_its_arrow_opens_the_shared_menu() { } h.run_steps(2); click(&mut h, "AutoSum"); + // One cell: the proposed formula waits in the editor for Enter, as in Excel (#1834). + assert_eq!(editor_text(&h).as_deref(), Some("=SUM(A1:A3)")); + h.key_press(Key::Enter); + h.run_steps(2); assert_eq!(input(&h, "A4"), "=SUM(A1:A3)"); h.state_mut().session.execute("selection.set", json!({"cell": "B4"})).unwrap(); click(&mut h, "AutoSum options"); @@ -143,6 +147,9 @@ fn autosum_runs_sum_and_its_arrow_opens_the_shared_menu() { h.get_by_label(item); } click(&mut h, "Count Numbers"); + assert_eq!(editor_text(&h).as_deref(), Some("=COUNT(B1:B3)")); + h.key_press(Key::Enter); + h.run_steps(2); assert_eq!(input(&h, "B4"), "=COUNT(B1:B3)"); click(&mut h, "AutoSum options"); click(&mut h, "More Functions…"); From 2829120d4dd7ef54db7aa5afa6c44d5e1b464b32 Mon Sep 17 00:00:00 2001 From: kezmdor <15539254+kezmdor@users.noreply.github.com> Date: Sat, 7 Nov 2026 14:24:10 +0100 Subject: [PATCH 36/94] Recently Used: a sign before a space starts a formula too main's `functions_in_formula` test expected `- SUM(1)` not to be a formula. With #2023's rule, which `is_formula_input` now uses, it is one, as Excel for the web enters `- remember this` as `=- remember this`. --- crates/engine/src/recent.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/recent.rs b/crates/engine/src/recent.rs index 0a1bba2dc2..2bd8a375cb 100644 --- a/crates/engine/src/recent.rs +++ b/crates/engine/src/recent.rs @@ -154,7 +154,9 @@ mod tests { assert_eq!(functions_in_formula("+SUM(1)"), ["SUM"]); assert_eq!(functions_in_formula("-ABS(A1)"), ["ABS"]); assert!(functions_in_formula("-5").is_empty() && functions_in_formula("+1e3").is_empty(), "numbers"); - assert!(functions_in_formula("+").is_empty() && functions_in_formula("- SUM(1)").is_empty(), "not formulas"); + assert!(functions_in_formula("+").is_empty() && functions_in_formula("--").is_empty(), "not formulas"); + // A sign before a space still starts a formula, as Excel takes `- SUM(1)` (#2023). + assert_eq!(functions_in_formula("- SUM(1)"), ["SUM"]); } #[test] From a7a319c5c7d077f6681d6257c43b675683bcc8fb Mon Sep 17 00:00:00 2001 From: vangel76 Date: Sat, 7 Nov 2026 17:26:11 +0100 Subject: [PATCH 37/94] Quick Analysis: close the popup when the active sheet changes The popup remembered only the range, so another sheet with the same selection kept it open and the tiles ran against that sheet. It now remembers the sheet too. Co-Authored-By: Claude Sonnet 5.5 --- crates/ui-egui/src/quick_analysis.rs | 14 ++++++----- .../ui-egui/tests/it/quick_analysis_button.rs | 23 +++++++++++++++++++ 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/crates/ui-egui/src/quick_analysis.rs b/crates/ui-egui/src/quick_analysis.rs index 3843ea6bfa..ea257ccd8b 100644 --- a/crates/ui-egui/src/quick_analysis.rs +++ b/crates/ui-egui/src/quick_analysis.rs @@ -44,8 +44,8 @@ impl Tab { #[derive(Default)] pub struct State { - /// The selection the popup was opened for; it closes when the selection changes. - pub open: Option, + /// The sheet (by index) and selection the popup was opened for; it closes when either changes. + pub open: Option<(usize, RangeRef)>, pub tab: Tab, /// Totals by row (results to the right) instead of by column (results below). pub by_rows: bool, @@ -145,13 +145,14 @@ pub fn toggle(app: &mut SheetApp, on: Option) -> Result { return Err("Quick Analysis works on one block of cells; select a single contiguous range.".into()); } let sel = d.selection.current(); + let sheet = d.wb.active_sheet(); let want = on.unwrap_or(app.grid.quick_analysis.open.is_none()); if !want { app.grid.quick_analysis.open = None; } else if sel.is_single() { return Err("Select at least two cells to use Quick Analysis.".into()); } else { - app.grid.quick_analysis.open = Some(sel); + app.grid.quick_analysis.open = Some((sheet, sel)); } Ok(json!({"open": app.grid.quick_analysis.open.is_some()})) } @@ -187,9 +188,10 @@ pub fn button_rect(geo: &Geo, sh: &Sheet, sel: RangeRef) -> (Rect, bool) { pub fn show(app: &mut SheetApp, ui: &mut Ui, geo: &Geo, sh: &Sheet) { let Some(d) = app.session.active() else { return }; let sel = d.selection.current(); + let sheet = d.wb.active_sheet(); let hidden = is_hidden(app, geo, sh); - // The popup belongs to one selection; a new one (or editing) closes it. - if hidden || app.grid.quick_analysis.open.is_some_and(|r| r != sel) { + // The popup belongs to one selection on one sheet; a new one (or editing) closes it. + if hidden || app.grid.quick_analysis.open.is_some_and(|(opened_on, r)| opened_on != sheet || r != sel) { app.grid.quick_analysis.open = None; } if hidden { @@ -226,7 +228,7 @@ pub fn show(app: &mut SheetApp, ui: &mut Ui, geo: &Geo, sh: &Sheet) { let _ = toggle(app, None); } } - let Some(opened_for) = app.grid.quick_analysis.open else { return }; + let Some((_, opened_for)) = app.grid.quick_analysis.open else { return }; let pos = pos2(button.left(), button.bottom() + 4.0); let mut picked: Option = None; let resp = egui::Area::new(Id::unique("quick_analysis_popup")).fixed_pos(pos).order(Order::Foreground).constrain(true).show(&ctx, |ui| { diff --git a/crates/ui-egui/tests/it/quick_analysis_button.rs b/crates/ui-egui/tests/it/quick_analysis_button.rs index 65fa142d91..3213c8cec9 100644 --- a/crates/ui-egui/tests/it/quick_analysis_button.rs +++ b/crates/ui-egui/tests/it/quick_analysis_button.rs @@ -82,3 +82,26 @@ fn hidden_for_areas(app: &SheetApp) -> bool { let g = geo(app); is_hidden(app, &g, app.session.active().unwrap().wb.active().unwrap()) } + +/// The popup is tied to the sheet it was opened on: a sheet that remembers the same selection +/// must not inherit it, or the tiles would act on the wrong sheet. +#[test] +fn switching_sheets_closes_the_popup_even_for_the_same_selection() { + let mut app = app(); + app.run("home.insertSheet", json!({})).unwrap(); + app.run("sheet.activate", json!({"sheet": 0})).unwrap(); + app.run("selection.set", json!({"range": "B2:D5"})).unwrap(); + toggle(&mut app, Some(true)).unwrap(); + let frame = |app: &mut SheetApp| { + let sh = app.session.active().unwrap().wb.active().unwrap().clone(); + let g = Geo::new(&sh, Rect::from_min_max(pos2(0.0, 0.0), pos2(1200.0, 800.0)), Vec2::ZERO); + let ctx = egui::Context::default(); + ctx.run_ui(egui::RawInput::default(), |ui| gridcraft_ui_egui::quick_analysis::show(app, ui, &g, &sh)).drop_without_applying_deltas(); + }; + frame(&mut app); + assert!(app.grid.quick_analysis.open.is_some(), "the popup stays open on its own sheet"); + app.run("sheet.activate", json!({"sheet": 1})).unwrap(); + app.run("selection.set", json!({"range": "B2:D5"})).unwrap(); + frame(&mut app); + assert!(app.grid.quick_analysis.open.is_none(), "another sheet with the same selection closes it"); +} From 2240950eb650ad5016e5abebb10ce226dded5e7f Mon Sep 17 00:00:00 2001 From: vangel76 Date: Sat, 7 Nov 2026 17:39:33 +0100 Subject: [PATCH 38/94] Quick Analysis: Esc closes the popup only; bind it to the sheet's identity Esc used to clear the pending copy and Format Painter before the popup saw it. The popup also remembers the sheet by its identity rather than its position, so moving sheets cannot hand it to another sheet. Co-Authored-By: Claude Sonnet 5.5 --- crates/ui-egui/src/grid/keyboard.rs | 14 ++++++--- crates/ui-egui/src/quick_analysis.rs | 10 +++---- .../ui-egui/tests/it/quick_analysis_button.rs | 29 +++++++++++++++++++ 3 files changed, 44 insertions(+), 9 deletions(-) diff --git a/crates/ui-egui/src/grid/keyboard.rs b/crates/ui-egui/src/grid/keyboard.rs index a852d04c33..3fce6bedb8 100644 --- a/crates/ui-egui/src/grid/keyboard.rs +++ b/crates/ui-egui/src/grid/keyboard.rs @@ -133,10 +133,7 @@ pub(super) fn keyboard(app: &mut SheetApp, ctx: &egui::Context, resp: &egui::Res } } Key::Escape if app.selected_object.is_some() => app.selected_object = None, - Key::Escape => { - app.session.clipboard = None; - app.session.format_painter = None; - } + Key::Escape => cancel_pending(app), Key::Space if !cmd && !shift && is_checkbox(sh, app) => app.run_or_alert("cell.toggleCheckbox", json!({})), Key::F8 if m.alt => { app.open_dialog("macros", json!({})); @@ -187,3 +184,12 @@ fn form_control_event(app: &mut SheetApp, sh: &Sheet, ev: &egui::Event) -> bool _ => false, } } + +/// Esc with nothing else to dismiss drops the pending copy and the Format Painter. An open Quick +/// Analysis popup owns the key: it closes and the pending copy stays. +fn cancel_pending(app: &mut SheetApp) { + if app.grid.quick_analysis.open.take().is_none() { + app.session.clipboard = None; + app.session.format_painter = None; + } +} diff --git a/crates/ui-egui/src/quick_analysis.rs b/crates/ui-egui/src/quick_analysis.rs index ea257ccd8b..f7db7b5697 100644 --- a/crates/ui-egui/src/quick_analysis.rs +++ b/crates/ui-egui/src/quick_analysis.rs @@ -44,8 +44,8 @@ impl Tab { #[derive(Default)] pub struct State { - /// The sheet (by index) and selection the popup was opened for; it closes when either changes. - pub open: Option<(usize, RangeRef)>, + /// The sheet (by its identity, not its position) and selection the popup was opened for; it closes when either changes. + pub open: Option<(u64, RangeRef)>, pub tab: Tab, /// Totals by row (results to the right) instead of by column (results below). pub by_rows: bool, @@ -145,7 +145,7 @@ pub fn toggle(app: &mut SheetApp, on: Option) -> Result { return Err("Quick Analysis works on one block of cells; select a single contiguous range.".into()); } let sel = d.selection.current(); - let sheet = d.wb.active_sheet(); + let sheet = d.wb.active().map_or(0, |s| s.uid.get()); let want = on.unwrap_or(app.grid.quick_analysis.open.is_none()); if !want { app.grid.quick_analysis.open = None; @@ -188,7 +188,7 @@ pub fn button_rect(geo: &Geo, sh: &Sheet, sel: RangeRef) -> (Rect, bool) { pub fn show(app: &mut SheetApp, ui: &mut Ui, geo: &Geo, sh: &Sheet) { let Some(d) = app.session.active() else { return }; let sel = d.selection.current(); - let sheet = d.wb.active_sheet(); + let sheet = d.wb.active().map_or(0, |s| s.uid.get()); let hidden = is_hidden(app, geo, sh); // The popup belongs to one selection on one sheet; a new one (or editing) closes it. if hidden || app.grid.quick_analysis.open.is_some_and(|(opened_on, r)| opened_on != sheet || r != sel) { @@ -269,7 +269,7 @@ pub fn show(app: &mut SheetApp, ui: &mut Ui, geo: &Geo, sh: &Sheet) { Action::Run(id, params) => app.run_or_alert(id, params), Action::Dialog(name, params) => app.open_dialog(name, params), } - } else if outside_click || ctx.input(|i| i.key_pressed(egui::Key::Escape)) { + } else if outside_click || ctx.input_mut(|i| i.consume_key(egui::Modifiers::NONE, egui::Key::Escape)) { app.grid.quick_analysis.open = None; } } diff --git a/crates/ui-egui/tests/it/quick_analysis_button.rs b/crates/ui-egui/tests/it/quick_analysis_button.rs index 3213c8cec9..9a5e1f2b14 100644 --- a/crates/ui-egui/tests/it/quick_analysis_button.rs +++ b/crates/ui-egui/tests/it/quick_analysis_button.rs @@ -105,3 +105,32 @@ fn switching_sheets_closes_the_popup_even_for_the_same_selection() { frame(&mut app); assert!(app.grid.quick_analysis.open.is_none(), "another sheet with the same selection closes it"); } + +/// Esc dismisses the popup and nothing else: the pending copy (and an armed Format Painter) stay. +#[test] +fn escape_closes_the_popup_without_cancelling_the_pending_copy() { + let mut session = crate::support::blank_session(); + session.execute("range.setValues", json!({"range": "A1", "values": [[1, 2, 3], [4, 5, 6]]})).unwrap(); + session.execute("selection.set", json!({"range": "A1:C2"})).unwrap(); + session.execute("edit.copy", json!({})).unwrap(); + let mut h = crate::support::harness(session, 4); + assert!(h.state().session.clipboard.is_some()); + toggle(h.state_mut(), Some(true)).unwrap(); + h.run_steps(2); + assert!(h.state().grid.quick_analysis.open.is_some()); + let esc = |h: &mut crate::common::Harness| { + h.input_mut().events.push(egui::Event::Key { + key: egui::Key::Escape, + physical_key: None, + pressed: true, + repeat: false, + modifiers: egui::Modifiers::NONE, + }); + h.run_steps(2); + }; + esc(&mut h); + assert!(h.state().grid.quick_analysis.open.is_none(), "Esc closes the popup"); + assert!(h.state().session.clipboard.is_some(), "the copy stays pending"); + esc(&mut h); + assert!(h.state().session.clipboard.is_none(), "a second Esc, with no popup, cancels the copy as before"); +} From d098a7dfc3c846f4b03387aa430de80e3c3ee8a2 Mon Sep 17 00:00:00 2001 From: vangel76 Date: Sun, 8 Nov 2026 12:39:04 +0100 Subject: [PATCH 39/94] UI: Excel for Mac Control+Q opens Quick Analysis; Command+Q stays Quit ribbon::shortcut is only reached with the command modifier, so on a Mac Control+Q did nothing and Command+Q toggled Quick Analysis next to the native Quit item. The keymap now maps Mac Control+Q (without Command, Option or Shift) to Shortcut::QuickAnalysis, which shares the ribbon handler and its single-cell alert suppression, and the ribbon Q branch ignores Command on a Mac. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/keymap.rs | 5 ++++ crates/ui-egui/src/ribbon.rs | 1 + crates/ui-egui/src/ribbon/shortcuts.rs | 21 ++++++++++------ crates/ui-egui/tests/it/keyboard_shortcuts.rs | 25 +++++++++++++++++++ docs/ui-parity.md | 4 +-- 5 files changed, 46 insertions(+), 10 deletions(-) diff --git a/crates/ui-egui/src/keymap.rs b/crates/ui-egui/src/keymap.rs index 5acce9b4d7..7e04fe72d9 100644 --- a/crates/ui-egui/src/keymap.rs +++ b/crates/ui-egui/src/keymap.rs @@ -41,6 +41,8 @@ pub enum Shortcut { Zoom(i32), /// Ctrl+Alt+Shift+P: edit the active cell as Python code (Python mode). PythonMode, + /// Excel for Mac Control+Q: Quick Analysis (Windows Ctrl+Q is in `ribbon::shortcut`). + QuickAnalysis, } fn run(id: &'static str) -> Shortcut { @@ -139,6 +141,8 @@ fn lookup_control_shortcuts(ctx: LookupContext) -> Option { // Windows Ctrl+; is in `ribbon::shortcut`; Excel for Mac uses Control+; and Command+;. Semicolon if mac && ctrl => Shortcut::Date, Semicolon if mac && cmd && !s => Shortcut::Time, + // Control+Q only: Command+Q is the native Quit item. + Q if mac && ctrl && !m.command && !s => Shortcut::QuickAnalysis, _ => return None, }) } @@ -349,6 +353,7 @@ pub(crate) fn dispatch(app: &mut SheetApp, ctx: &egui::Context, key: Key, physic } Shortcut::Edit => app.begin_edit(None, false), Shortcut::PythonMode => app.toggle_python_mode(), + Shortcut::QuickAnalysis => crate::ribbon::quick_analysis(app), Shortcut::ContextMenu => app.grid.context_menu = Some(geo.cell_rect(sh, active).center()), Shortcut::DropDown => { if sh.validations.iter().any(|d| d.in_cell_dropdown && d.ranges.iter().any(|r| r.contains(active))) { diff --git a/crates/ui-egui/src/ribbon.rs b/crates/ui-egui/src/ribbon.rs index 47f1eabd73..4e8ba9dd28 100644 --- a/crates/ui-egui/src/ribbon.rs +++ b/crates/ui-egui/src/ribbon.rs @@ -37,6 +37,7 @@ use home::home; use insert::{draw, insert}; use page_layout::page_layout; use review::review; +pub(crate) use shortcuts::quick_analysis; pub use shortcuts::shortcut; pub use title_bar::{MAC_CONTENT_LEFT, MAC_TITLE_BAR, TITLE_LEFT_PAD, title_bar}; use title_bar::{TITLE_BAR_H, TITLE_CONTROL_H}; diff --git a/crates/ui-egui/src/ribbon/shortcuts.rs b/crates/ui-egui/src/ribbon/shortcuts.rs index 2eb118cd1f..53d99318b7 100644 --- a/crates/ui-egui/src/ribbon/shortcuts.rs +++ b/crates/ui-egui/src/ribbon/shortcuts.rs @@ -1,5 +1,15 @@ use super::{Key, Modifiers, SheetApp, json}; +/// Ctrl+Q (Control+Q in Excel for Mac): Quick Analysis. A single cell has nothing to analyse, +/// which is not worth an alert, but several areas deserve to be told why nothing opened. +pub(crate) fn quick_analysis(app: &mut SheetApp) { + if let Err(e) = crate::quick_analysis::toggle(app, None) + && app.session.active().is_some_and(|d| d.selection.ranges.len() > 1) + { + app.alert(e); + } +} + /// Command-key shortcuts when the grid has focus. pub fn shortcut(app: &mut SheetApp, key: Key, m: Modifiers) { let shift = m.shift; @@ -43,14 +53,9 @@ pub fn shortcut(app: &mut SheetApp, key: Key, m: Modifiers) { Key::T => Some(("insert.table", json!({}))), Key::E => Some(("edit.flashFill", json!({}))), // Plain Ctrl+Q only: Ctrl+Shift+Q and Ctrl+Alt+Q (AltGr+Q) are not Quick Analysis. - Key::Q if !shift && !m.alt => { - // Quick Analysis; a single cell has nothing to analyse, which is not worth an alert, - // but several areas deserve to be told why nothing opened. - if let Err(e) = crate::quick_analysis::toggle(app, None) - && app.session.active().is_some_and(|d| d.selection.ranges.len() > 1) - { - app.alert(e); - } + // Command+Q on a Mac is the native Quit item; Control+Q there goes through the keymap. + Key::Q if !shift && !m.alt && !m.mac_cmd => { + quick_analysis(app); None } Key::Num1 => { diff --git a/crates/ui-egui/tests/it/keyboard_shortcuts.rs b/crates/ui-egui/tests/it/keyboard_shortcuts.rs index 56dadde3ae..ff0510fb23 100644 --- a/crates/ui-egui/tests/it/keyboard_shortcuts.rs +++ b/crates/ui-egui/tests/it/keyboard_shortcuts.rs @@ -315,3 +315,28 @@ fn only_plain_ctrl_q_toggles_quick_analysis() { key(&mut h, Key::Q, CTRL); assert!(h.state().grid.quick_analysis.open.is_some(), "Ctrl+Q"); } + +/// Excel for Mac: Control+Q (ctrl without command) opens Quick Analysis, Command+Q is left to the +/// native Quit item, and a single cell still opens nothing without an alert. +#[test] +fn mac_control_q_toggles_quick_analysis_and_command_q_does_not() { + const MAC_CONTROL: Modifiers = Modifiers { alt: false, ctrl: true, shift: false, mac_cmd: false, command: false }; + const MAC_COMMAND: Modifiers = Modifiers { alt: false, ctrl: false, shift: false, mac_cmd: true, command: true }; + assert_eq!(lookup(Key::Q, Some(Key::Q), MAC_CONTROL, true), Some(Shortcut::QuickAnalysis)); + assert_eq!(lookup(Key::Q, Some(Key::Q), MAC_COMMAND, true), None); + assert_eq!(lookup(Key::Q, Some(Key::Q), MAC_CONTROL, false), None, "Windows Ctrl+Q goes through ribbon::shortcut"); + let mac = |sel: &str| crate::common::os_harness(book(sel), egui::os::OperatingSystem::Mac); + let mut h = mac("A1:B3"); + key(&mut h, Key::Q, MAC_COMMAND); + assert!(h.state().grid.quick_analysis.open.is_none(), "Command+Q is Quit"); + key(&mut h, Key::Q, Modifiers { shift: true, ..MAC_CONTROL }); + assert!(h.state().grid.quick_analysis.open.is_none(), "Control+Shift+Q"); + key(&mut h, Key::Q, MAC_CONTROL); + assert!(h.state().grid.quick_analysis.open.is_some(), "Control+Q opens"); + key(&mut h, Key::Q, MAC_CONTROL); + assert!(h.state().grid.quick_analysis.open.is_none(), "Control+Q again closes"); + let mut h = mac("B2"); + key(&mut h, Key::Q, MAC_CONTROL); + assert!(h.state().grid.quick_analysis.open.is_none()); + assert!(h.state().message.is_none() && h.state().toast.is_none(), "no alert for a single cell"); +} diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 121c45d5a4..8c747c1528 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -145,10 +145,10 @@ otherwise. Number-format and border keys match the physical key (Ctrl+Shift+4, w | Ctrl+Alt+Shift+P | Cmd+Option+Shift+P | Python mode on or off | **added** | | F3 | not checked | Paste Name dialog, only when the workbook has names: OK puts the name at the caret of the formula being edited (or starts `=Name`), Paste List writes each name and what it refers to from the active cell (`formulas.pasteName`) | **added** | | F1, F4 (repeat), F6 / Shift+F6, F8 / Shift+F8, F11, End mode | same | help, Repeat, pane cycling, extend/add mode, chart sheet | missing (no such feature yet) | -| Ctrl+Q | Ctrl+Q | Quick Analysis | **added** (#791) | +| Ctrl+Q | Control+Q (Cmd+Q stays Quit) | Quick Analysis | **added** (#791) | | Ctrl+A after a function name, Ctrl+Shift+U, Ctrl+Alt+P | same | Function Arguments, formula bar height, tooltips | missing | | F1, F3, F4 (repeat), F6 / Shift+F6, F8 / Shift+F8, F11, End mode | same | help, Paste Name, Repeat, pane cycling, extend/add mode, chart sheet | missing (no such feature yet) | -| Ctrl+Q | Ctrl+Q | Quick Analysis | **added** (#791) | +| Ctrl+Q | Control+Q (Cmd+Q stays Quit) | Quick Analysis | **added** (#791) | | Ctrl+A after a function name, Ctrl+Alt+P | same | Function Arguments, tooltips | missing | | Ctrl+Shift+A after a function name | Control+Shift+A | argument names: `=SUMIF(` becomes `=SUMIF(range,criteria,sum_range)`, the `(` added when missing; one Undo takes them back | **added** | | Ctrl+Shift+U | Control+Shift+U | expand or collapse the formula bar (`view.expandFormulaBar`), on the grid and while editing; on Windows and Linux it no longer underlines | **added** | From 09d52cc7cd76a434431fc85d4e09ec4383e24ecf Mon Sep 17 00:00:00 2001 From: alehel Date: Wed, 11 Nov 2026 09:02:08 +0000 Subject: [PATCH 40/94] Style model: cell padding kept in Alignment `Alignment::padding: [Option; 4]` (left, right, top, bottom, in hundredths of a point; `None` where a file states none) holds an OpenDocument cell's padding, which LibreOffice lays rows out with. It is part of style equality and hashing, so styles that differ only by padding intern apart; serde default, skipped when all `None`, so older JSON reads. Excel has no cell padding: the XLSX and XLS readers set none, and the XLSX writer leaves it out (a style that differs from the default only by padding writes no ``). GridCraft does not draw padding yet. --- crates/model/src/style.rs | 33 ++++++++++++++++++++++++++ crates/xlsx/src/styles.rs | 5 +++- crates/xlsx/src/tests/roundtrip.rs | 38 +++++++++++++++++++++++++++++- crates/xlsx/src/xls/styles.rs | 1 + docs/file-format-parity.md | 3 ++- 5 files changed, 77 insertions(+), 3 deletions(-) diff --git a/crates/model/src/style.rs b/crates/model/src/style.rs index d2f10780e0..6318c557ab 100644 --- a/crates/model/src/style.rs +++ b/crates/model/src/style.rs @@ -359,6 +359,17 @@ pub struct Alignment { pub indent: u8, /// Degrees -90..=90, or 255 for vertical stacked text. pub rotation: i16, + /// Space between the cell's edges and its text, left, right, top, bottom, in hundredths + /// of a point; `None` where the file stated none (the application's own). An OpenDocument + /// cell's padding; Excel has none. Not drawn yet. + #[serde(default, skip_serializing_if = "Alignment::no_padding")] + pub padding: [Option; 4], +} + +impl Alignment { + fn no_padding(p: &[Option; 4]) -> bool { + p.iter().all(Option::is_none) + } } #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] @@ -499,6 +510,28 @@ mod tests { assert!(!t.get(StyleId(999)).font.bold); } + #[test] + fn padding_keeps_styles_apart_and_survives_json() -> Result<(), Box> { + let mut t = StyleTable::default(); + let padded = t.derive(StyleId::DEFAULT, |s| s.align.padding = [Some(10), None, Some(0), Some(65535)]); + let other = t.derive(StyleId::DEFAULT, |s| s.align.padding = [Some(10), None, Some(0), Some(1)]); + assert_ne!(padded, StyleId::DEFAULT); + assert_ne!(padded, other); + assert_eq!(t.derive(StyleId::DEFAULT, |s| s.align.padding = [Some(10), None, Some(0), Some(65535)]), padded); + assert_eq!(t.derive(padded, |s| s.align.padding = [None; 4]), StyleId::DEFAULT); + + let style = t.get(padded).clone(); + let json = serde_json::to_string(&style)?; + assert!(json.contains("padding"), "{json}"); + assert_eq!(serde_json::from_str::" + + svg_text[:start] + tag + svg_text[end:] + + "" + ) + with tempfile.TemporaryDirectory() as work: + document = Path(work) / "icon.html" + document.write_text(page) + subprocess.run( + [chrome, "--headless", "--disable-gpu", "--hide-scrollbars", "--no-first-run", + "--default-background-color=00000000", "--force-device-scale-factor=1", + f"--window-size={size},{size}", f"--screenshot={out}", document.as_uri()], + check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, + ) + + +def png_size(data): + if data[:8] != b"\x89PNG\r\n\x1a\n" or data[12:16] != b"IHDR": + die("renderer wrote something that is not a PNG") + return struct.unpack(">II", data[16:24]) + + +def has_alpha(data): + # IHDR colour type 6 is RGBA; a renderer that dropped alpha would flatten the padding. + return data[25] == 6 + + +def pack_ico(pngs): + body = bytearray(struct.pack(" 256: + die(f"ico frames must be square and at most 256 px, got {width}x{height}") + body += struct.pack("I", len(data) + 8) + data + return b"icns" + struct.pack(">I", len(body) + 8) + bytes(body) + + +def mac_svg(svg_text): + if 'viewBox="0 0 512 512"' not in svg_text: + die("gridcraft-nightly.svg must keep the full-bleed 0 0 512 512 viewBox") + return svg_text.replace('viewBox="0 0 512 512"', MAC_VIEWBOX) + + +def digest(path): + return hashlib.sha256(path.read_bytes()).hexdigest() + + +def render_all(kind): + renderer, program = renderer_argv(kind) + svg_text = SVG.read_text() + padded = mac_svg(svg_text) + with tempfile.TemporaryDirectory() as work: + work = Path(work) + + def draw(source, size, name): + if not source.strip(): + die(f"empty SVG for {name}") + out = work / "tile.svg" + out.write_text(source) + (render_resvg if renderer == "resvg" else render_chrome)(program, source, size, work / name) + data = (work / name).read_bytes() + if png_size(data) != (size, size): + die(f"{name}: expected {size}x{size}, got {png_size(data)}") + if not has_alpha(data): + die(f"{name}: the render has no alpha channel") + return data + + # Full-bleed tile: the Linux tar icon (256) and the Windows ICO frames. + tile = {size: draw(svg_text, size, f"tile-{size}.png") for size in sorted({256} | set(ICO_SIZES))} + (ICONS / "gridcraft-nightly.png").write_bytes(tile[256]) + (ICONS / "gridcraft-nightly.ico").write_bytes(pack_ico([tile[size] for size in ICO_SIZES])) + # Padded macOS tile: the 1024 master, the ICNS slots and the runtime Dock render. + mac = {size: draw(padded, size, f"mac-{size}.png") for size in MAC_PNG_SIZES} + (ICONS / "gridcraft-nightly-1024.png").write_bytes(mac[1024]) + (ICONS / "gridcraft-nightly.icns").write_bytes(pack_icns([(kind, mac[size]) for kind, size in ICNS_SLOTS])) + write_provenance(renderer) + + +def write_provenance(renderer): + outputs = ("gridcraft-nightly.png", "gridcraft-nightly-1024.png", "gridcraft-nightly.ico", "gridcraft-nightly.icns") + provenance = { + "title": "GridCraft nightly deep-background icons", + "author": "@skylartaylor", + "license": "MIT OR Apache-2.0", + "inputs": [ + {"path": "assets/app-icon/gridcraft-nightly.svg", "sha256": digest(SVG), "purpose": "vector master for every frame"}, + {"path": "assets/app-icon/gridcraft.svg", "sha256": digest(ICONS / "gridcraft.svg"), "purpose": "stable artwork this is derived from"}, + ], + "method": { + "kind": "vector render of the project-owned artwork with only its field colour deepened", + "stable_field": "#1f9d55", + "nightly_field": "#14532d", + "unchanged": "ink #0b0b0c, paper #efe9dc, every path, stroke width and the 824/1024 Mac padding", + "sizes": "each frame rendered at its own size, never upscaled", + "renderer": renderer, + "generator": "packaging/nightly-icons.py", + }, + "outputs": {name: digest(ICONS / name) for name in outputs}, + "ico_frame_sizes": list(ICO_SIZES), + "icns_png_slots": {kind: size for kind, size in ICNS_SLOTS}, + } + (ICONS / "nightly-provenance.json").write_text(json.dumps(provenance, indent=2) + "\n") + + +def check(): + provenance = json.loads((ICONS / "nightly-provenance.json").read_text()) + ok = True + for name, expected in provenance["outputs"].items(): + actual = digest(ICONS / name) + if actual != expected: + print(f"mismatch: assets/app-icon/{name} is {actual}, provenance says {expected}", file=sys.stderr) + ok = False + ico = (ICONS / "gridcraft-nightly.ico").read_bytes() + count = struct.unpack("I", icns[4:8])[0] != len(icns): + print("mismatch: the ICNS header does not cover the file", file=sys.stderr) + ok = False + return 0 if ok else 1 + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--renderer", choices=("auto", "resvg", "chrome"), default="auto") + parser.add_argument("--check", action="store_true") + args = parser.parse_args() + if args.check: + return check() + render_all(args.renderer) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/packaging/nightly-release-tests.py b/packaging/nightly-release-tests.py new file mode 100755 index 0000000000..ca9301cbfd --- /dev/null +++ b/packaging/nightly-release-tests.py @@ -0,0 +1,464 @@ +#!/usr/bin/env python3 +"""Nightly source-contract regression tests for GridCraft; local checks, not live API/crypto evidence.""" +import base64 +import copy +import hashlib +import json +from pathlib import Path +import re +import unittest + +ROOT = Path(__file__).resolve().parents[1] +INSTALLED_POLICY = ROOT / ".github/nightly-signing-policy.json" + +NIGHTLY_PLATFORMS = ("windows-x86_64", "linux-x86_64", "macos-aarch64") +# Each platform's one trust field in policy v3, and the public stable identity it must name. +NIGHTLY_TRUST = { + "windows-x86_64": ("publisher_subject", + "CN=Learning Machines Inc, O=Learning Machines Inc, L=Atlanta, S=Georgia, C=US"), + "linux-x86_64": ("fingerprint", "2B76741B414AAD6CD33E631213A005C0B9D7C3ED"), + "macos-aarch64": ("apple_team_id", "DJ6XS33FX8"), +} + +# Mirrors the storytold release-managers team (id 19837241) minus echelon-robot. +# Update by PR, in the caller and the policy, when the team changes. +RELEASE_MANAGERS = ["bflatastic", "dylanmtaylor", "echelon", "FredApps", "skylartaylor"] + +# The Linux leg's public release key, as the protected release checkout must carry it. +LINUX_KEY = ROOT / ".github/nightly-linux-signing-key.asc" + + +def openpgp_primary_fingerprints(armored): + """Return the v4 fingerprint of every primary public-key packet in one armored block. + + A narrow reader for the committed public key, not a general OpenPGP parser: anything other + than one well-formed public-key block, or any secret material, refuses. + """ + lines = armored.strip().splitlines() + if lines[:1] != ["-----BEGIN PGP PUBLIC KEY BLOCK-----"] or lines[-1:] != ["-----END PGP PUBLIC KEY BLOCK-----"]: + raise ValueError("exactly one armored public key block is required") + body = lines[1:-1] + if "" not in body: + raise ValueError("armor header separator missing") + body = body[body.index("") + 1:] + if not body or not body[-1].startswith("="): + raise ValueError("armor checksum missing") + data = base64.b64decode("".join(body[:-1]), validate=True) + fingerprints, offset = [], 0 + while offset < len(data): + header = data[offset] + if not header & 0x80: + raise ValueError("invalid packet header") + if header & 0x40: + tag, offset = header & 0x3F, offset + 1 + first = data[offset] + if first < 192: + length, offset = first, offset + 1 + elif first < 224: + length, offset = ((first - 192) << 8) + data[offset + 1] + 192, offset + 2 + elif first == 255: + length, offset = int.from_bytes(data[offset + 1:offset + 5], "big"), offset + 5 + else: + raise ValueError("partial packet lengths are not a public key") + else: + tag, kind, offset = (header >> 2) & 0x0F, header & 0x03, offset + 1 + if kind == 3: + raise ValueError("indeterminate packet length") + size = 1 << kind + length, offset = int.from_bytes(data[offset:offset + size], "big"), offset + size + packet = data[offset:offset + length] + if len(packet) != length: + raise ValueError("truncated packet") + if tag == 5 or tag == 7: + raise ValueError("secret key material must never be committed") + if tag == 6: + if packet[:1] != b"\x04": + raise ValueError("only v4 primary keys are expected") + fingerprints.append(hashlib.sha1(b"\x99" + length.to_bytes(2, "big") + packet).hexdigest().upper()) + offset += length + return fingerprints + + +def assert_nightly_serialization(source): + """Fail closed unless this app's plain root concurrency block retains its contract.""" + lines = source.splitlines() + roots = [index for index, line in enumerate(lines) if line.startswith("concurrency:")] + if len(roots) != 1 or lines[roots[0]] != "concurrency:": + raise ValueError("one plain root concurrency block is required") + values = {} + for line in lines[roots[0] + 1:]: + if not line.strip() or line.lstrip().startswith("#"): + continue + if not line[0].isspace(): + break + row = re.fullmatch(r" (group|cancel-in-progress): ([^#]+?)(?: +#.*)?", line) + if row is None or row[1] in values: + raise ValueError("malformed or duplicate nightly concurrency entry") + values[row[1]] = row[2].rstrip() + if values != {"group": "gridcraft-nightly-release", "cancel-in-progress": "false"}: + raise ValueError("nightly serialization must use its stable group and no cancellation") + + +def job_conditions(jobs): + """Each job-level `if:` as (block indicator or None, the whole expression YAML would read).""" + lines = jobs.splitlines() + found = [] + for index, line in enumerate(lines): + head = re.fullmatch(r" if:(?: (.*))?", line) + if head is None: + continue + value = (head[1] or "").strip() + continuation = [] + for follow in lines[index + 1:]: + if follow.strip() and len(follow) - len(follow.lstrip(" ")) <= 4: + break + continuation.append(follow.strip()) + indicator = value if re.fullmatch(r"[>|][+-]?", value) else None + parts = continuation if indicator else [value] + continuation + found.append((indicator, " ".join(part for part in parts if part))) + return found + + +def producer_platforms(source): + """Read the one producer job's literal platform list; a narrow source guard, not YAML.""" + rows = re.findall(r"(?m)^ platforms: (.*)$", source) + if len(rows) != 1: + raise ValueError("exactly one producer platform list is required") + literal = re.fullmatch(r"'(\[[^']*\])'", rows[0]) + if literal is None: + raise ValueError("the platform list must be one single-quoted literal") + platforms = json.loads(literal[1]) + if not isinstance(platforms, list) or json.dumps(platforms, separators=(",", ":")) != literal[1]: + raise ValueError("the platform list must be compact JSON") + if len(set(platforms)) != len(platforms) or not set(platforms) <= set(NIGHTLY_PLATFORMS): + raise ValueError("platforms must be distinct known nightly targets") + if "windows-x86_64" not in platforms: + raise ValueError("the Windows row stays in the producer") + return platforms + + +def reviewed_manual_actors(caller_source, policy): + """The one reviewed manual-actor list, identical in the producer caller and the policy.""" + rows = re.findall(r"(?m)^ manual-actors: '(\[[^']*\])'$", caller_source) + if len(rows) != 1: + raise ValueError("exactly one literal manual-actors list is required") + caller = json.loads(rows[0]) + if caller != policy["manual_actors"]: + raise ValueError("caller and policy must grant the same actors in the same order") + if caller != RELEASE_MANAGERS: + raise ValueError("manual actors must be exactly the reviewed release managers") + if caller != sorted(caller, key=str.lower) or len({login.lower() for login in caller}) != len(caller): + raise ValueError("manual actors must be distinct and sorted case-insensitively") + if set(caller) & {login for login in policy["automatic_signer_actors"]}: + raise ValueError("manual and automatic actors overlap") + return caller + + +def caller_pin(name): + return re.findall(r"(?m)^ tooling-revision: ([0-9a-f]{40})$", (ROOT / ".github/workflows" / name).read_text())[0] + + +class TrustedSourcePreparation(unittest.TestCase): + def test_one_producer_and_one_signer_job_carry_every_platform(self): + for name, job in (("nightly.yml", "unsigned"), ("nightly-sign.yml", "release")): + jobs = (ROOT / ".github/workflows" / name).read_text().split("\njobs:\n", 1)[1] + with self.subTest(workflow=name): + self.assertEqual(re.findall(r"(?m)^ ([^\s#][^:]*):", jobs), [job], + "a platform is a list entry, not a separately activatable job") + signer = (ROOT / ".github/workflows/nightly-sign.yml").read_text() + self.assertNotRegex(signer, r"(?m)^\s*platforms?:", "the release policy, not the caller, admits platforms") + + def test_malformed_or_narrowed_platform_lists_are_rejected(self): + source = (ROOT / ".github/workflows/nightly.yml").read_text() + current = "platforms: '[\"windows-x86_64\",\"linux-x86_64\",\"macos-aarch64\"]'" + self.assertIn(current, source) + for new in ("platforms: '[\"linux-x86_64\"]'", + "platforms: '[\"linux-x86_64\",\"macos-aarch64\"]'", + "platforms: '[\"windows-x86_64\",\"linux-x86_64\",\"linux-x86_64\"]'", + "platforms: '[\"windows-x86_64\",\"macos-x86_64\"]'", + "platforms: '[\"windows-x86_64\",\"linux-arm64\"]'", + "platforms: '[\"windows-x86_64\", \"linux-x86_64\"]'", + "platforms: [\"windows-x86_64\",\"linux-x86_64\"]", + "platforms: ${{ vars.NIGHTLY_PLATFORMS }}", + "platforms: '{\"windows-x86_64\":1}'", + current + "\n " + current): + with self.subTest(change=new), self.assertRaises(ValueError): + producer_platforms(source.replace(current, new)) + with self.assertRaises(ValueError): + producer_platforms(source.replace(" " + current + "\n", "")) + + def test_continuation_lines_of_any_scalar_form_reach_the_guard_checks(self): + for name, workflow in (("nightly.yml", "nightly.yml"), ("nightly-sign.yml", "nightly-sign.yml")): + source = (ROOT / ".github/workflows" / workflow).read_text() + expected = NightlyEnabledCallers.GUARDS[name] + guard = re.search(r"(?m)^ if: >-\n(?: [^\n]*\n)+", source)[0] + for replacement in (guard + " || true\n", " if: " + expected + "\n || true\n"): + jobs = source.replace(guard, replacement).split("\njobs:\n", 1)[1] + with self.subTest(workflow=name, replacement=replacement[-30:]): + (indicator, expression), = job_conditions(jobs) + self.assertFalse(indicator == ">-" and " ".join(expression.split()) == expected) + + def test_no_nightly_schedule_is_registered(self): + for name, event in (("nightly.yml", "workflow_dispatch"), + ("nightly-sign.yml", "workflow_dispatch")): + source = (ROOT / ".github/workflows" / name).read_text() + events = source.split("\non:\n", 1)[1].split("\npermissions:", 1)[0] + triggers = [line for line in events.splitlines() if line.startswith(" ") + and not line.startswith(" ") and line.strip() and not line.lstrip().startswith("#")] + with self.subTest(workflow=name): + self.assertEqual(triggers, [f" {event}:"], "schedule/activation needs explicit review") + + def test_signer_serialization_contract_is_enforced(self): + assert_nightly_serialization((ROOT / ".github/workflows/nightly-sign.yml").read_text()) + + def test_weakened_or_malformed_serialization_is_rejected(self): + source = (ROOT / ".github/workflows/nightly-sign.yml").read_text() + for old, new in ( + ("cancel-in-progress: false", "cancel-in-progress: false\n queue: max"), + ("cancel-in-progress: false", "cancel-in-progress: true"), + ("cancel-in-progress: false", "cancel-in-progress: ${{ github.event_name == 'push' }}"), + ("cancel-in-progress: false\n", ""), + ("group: gridcraft-nightly-release", "group: ${{ github.run_id }}"), + ("group: gridcraft-nightly-release", "group: release-${{ github.ref }}"), + ("concurrency:\n", "concurrency: ${{ github.run_id }}\n"), + ("concurrency:\n", " concurrency:\n"), + ): + with self.subTest(change=new), self.assertRaises(ValueError): + assert_nightly_serialization(source.replace(old, new)) + + def test_sonar_classifies_only_the_exact_packaging_fixture_runners(self): + source = (ROOT / "sonar-project.properties").read_text() + self.assertEqual(re.findall(r"(?m)^sonar.sources=(.*)$", source), ["."]) + self.assertEqual(re.findall(r"(?m)^sonar.tests=(.*)$", source), ["packaging"]) + inclusions = re.findall(r"(?m)^sonar.test.inclusions=(.*)$", source) + self.assertEqual(len(inclusions), 1) + entries = inclusions[0].split(",") + expected = {"packaging/nightly-tests.py", "packaging/nightly-archive-tests.py", + "packaging/linux/nightly-linux-launch-tests.py", + "packaging/macos/nightly_plist_tests.py", "packaging/macos/nightly_sign_tests.py", + "packaging/windows/nightly-package-tests.ps1", + "packaging/windows/nightly-signing-tests.ps1", "packaging/nightly-release-tests.py"} + self.assertEqual(set(entries), expected, "classify exact fixtures, never production helpers or wildcard scope") + self.assertEqual(len(entries), len(expected), "duplicate fixture classification") + + def test_no_cache_actions_or_cache_setup_options_in_app_trusted_closure(self): + for name in ("nightly.yml", "nightly-sign.yml"): + source = (ROOT / ".github/workflows" / name).read_text() + executable = "\n".join(line for line in source.splitlines() + if not line.lstrip().startswith("#")) + with self.subTest(workflow=name): + self.assertNotRegex(executable, r"(?im)^\s*(?:-\s*)?uses:\s*[^\n]*cache") + self.assertNotRegex(executable, r"(?im)^\s*[^\s:#]*cache[^\s:#]*:") + self.assertNotRegex(executable, r"(?im)^\s*(?:environment|secrets):") + self.assertNotIn("secrets.", executable) + + def test_both_callers_use_one_shared_pin_in_uses_and_tooling_revision(self): + pins = set() + for name, callee in (("nightly.yml", "nightly-unsigned.yml"), ("nightly-sign.yml", "nightly-release.yml")): + source = (ROOT / ".github/workflows" / name).read_text() + uses = re.findall(r"(?m)^ uses: storytold/craft-common-actions/\.github/workflows/" + + re.escape(callee) + r"@(\S+)$", source) + tooling = re.findall(r"(?m)^ tooling-revision: (\S+)$", source) + with self.subTest(workflow=name): + self.assertEqual(len(uses), 1) + self.assertEqual(tooling, uses, "the defining workflow SHA and tooling input must match") + pins.update(uses) + self.assertEqual(len(pins), 1, "producer and signer must pin the same shared commit") + self.assertRegex(pins.pop(), r"^[0-9a-f]{40}$", "pin a full immutable commit, never a branch or placeholder") + + +class NightlyEnabledCallers(unittest.TestCase): + """Producer and signer run only in their exact context, for the reviewed manual actor.""" + + GUARDS = { + "nightly.yml": "github.repository == 'storytold/gridcraft' && github.ref == 'refs/heads/main' && " + "github.ref_type == 'branch' && (github.event_name == 'schedule' || " + "github.event_name == 'workflow_dispatch')", + "nightly-sign.yml": "github.repository == 'storytold/gridcraft' && github.event_name == 'workflow_dispatch' && " + "github.ref == 'refs/heads/release' && github.ref_type == 'branch'", + } + + def test_enabled_jobs_keep_exact_context_guards(self): + for name, expected in self.GUARDS.items(): + jobs = (ROOT / ".github/workflows" / name).read_text().split("\njobs:\n", 1)[1] + guards = job_conditions(jobs) + with self.subTest(workflow=name): + self.assertEqual(len(guards), 1) + indicator, expression = guards[0] + self.assertEqual(indicator, ">-") + self.assertEqual(" ".join(expression.split()), expected, "guards may only change with review") + + def test_manual_actors_are_the_release_managers_in_caller_and_policy(self): + source = (ROOT / ".github/workflows/nightly.yml").read_text() + policy = json.loads(INSTALLED_POLICY.read_text()) + self.assertEqual(reviewed_manual_actors(source, policy), RELEASE_MANAGERS) + self.assertEqual(policy["automatic_signer_actors"], [], "no automatic signer without a schedule") + + def test_an_actor_outside_the_release_managers_is_refused(self): + source = (ROOT / ".github/workflows/nightly.yml").read_text() + policy = json.loads(INSTALLED_POLICY.read_text()) + caller = json.dumps(RELEASE_MANAGERS, separators=(",", ":")) + widened = sorted(RELEASE_MANAGERS + ["echelon-robot"], key=str.lower) + for change in ("caller", "policy", "both", "order", "case"): + mutated_source, mutated_policy = source, copy.deepcopy(policy) + if change in ("caller", "both"): + mutated_source = source.replace(caller, json.dumps(widened, separators=(",", ":"))) + if change in ("policy", "both"): + mutated_policy["manual_actors"] = widened + if change == "order": + mutated_policy["manual_actors"] = list(reversed(RELEASE_MANAGERS)) + if change == "case": + mutated_policy["manual_actors"] = [login.lower() for login in RELEASE_MANAGERS] + with self.subTest(change=change), self.assertRaises(ValueError): + reviewed_manual_actors(mutated_source, mutated_policy) + + +def push_block(source): + """The whole `push:` mapping, blank lines and nested keys included. + + A blank line does not end a YAML mapping, so the block is delimited by indentation rather than + by contiguous non-empty lines; a path filter after a blank line stays visible to the check. + """ + lines = source.splitlines() + for index, line in enumerate(lines): + if re.fullmatch(r" push:.*", line): + block = [] + for follow in lines[index + 1:]: + if follow.strip() and not follow.startswith(" "): + break + block.append(follow) + return "\n".join(block) + return None + + +class NightlyInstalledPolicy(unittest.TestCase): + """The installed v3 policy matches the callers, the repository and its documented sources.""" + + def setUp(self): + self.assertFalse(INSTALLED_POLICY.is_symlink()) + self.policy = json.loads(INSTALLED_POLICY.read_text()) + + def test_exact_v3_fields_and_repository_identity(self): + expected = {"schema", "repository", "repository_id", "producer_workflow_id", + "producer_workflow_path", "producer_tooling_revision", "producer_workflow_ref", + "signer_workflow_path", "signer_tooling_revision", "release_branch", "manual_actors", + "automatic_signer_actors", "max_age_seconds", "candidate_policy", + "max_artifact_bytes", "platforms"} + self.assertEqual(set(self.policy), expected) + self.assertEqual(self.policy["schema"], "craft-nightly-release-policy/v3") + self.assertEqual(self.policy["repository"], "storytold/gridcraft") + self.assertEqual(self.policy["release_branch"], "release") + self.assertIs(type(self.policy["repository_id"]), int) + self.assertGreater(self.policy["repository_id"], 0) + # producer_workflow_id is null until nightly.yml is registered on main; once set, must be a positive int. + if self.policy["producer_workflow_id"] is not None: + self.assertIs(type(self.policy["producer_workflow_id"]), int) + self.assertGreater(self.policy["producer_workflow_id"], 0) + self.assertNotEqual(self.policy["producer_workflow_id"], + self.policy["candidate_policy"]["required_workflows"][0]["workflow_id"], + "the producer is not its own quality workflow") + + def test_paths_and_tooling_match_the_callers(self): + pin = caller_pin("nightly.yml") + self.assertEqual(caller_pin("nightly-sign.yml"), pin) + self.assertEqual(self.policy["producer_workflow_path"], ".github/workflows/nightly.yml") + self.assertEqual(self.policy["signer_workflow_path"], ".github/workflows/nightly-sign.yml") + self.assertEqual(self.policy["producer_tooling_revision"], pin) + self.assertEqual(self.policy["signer_tooling_revision"], pin) + self.assertEqual(self.policy["producer_workflow_ref"], + "storytold/craft-common-actions/.github/workflows/nightly-unsigned.yml@" + pin) + + def test_platforms_and_trust_anchors_match_producer(self): + built = producer_platforms((ROOT / ".github/workflows/nightly.yml").read_text()) + self.assertEqual(built, list(NIGHTLY_PLATFORMS)) + self.assertEqual(set(self.policy["platforms"]), set(built)) + for platform, (field, value) in NIGHTLY_TRUST.items(): + row = self.policy["platforms"][platform] + with self.subTest(platform=platform): + self.assertEqual(set(row), {"unsigned_artifact_name", "trust"}) + self.assertEqual(row["unsigned_artifact_name"], f"nightly-unsigned-{platform}") + self.assertEqual(row["trust"], {field: value}) + + def test_committed_linux_key_is_exactly_the_one_the_policy_trusts(self): + self.assertFalse(LINUX_KEY.is_symlink(), "the key file must be a regular committed file") + armored = LINUX_KEY.read_text(encoding="ascii") + self.assertEqual(armored.count("-----BEGIN PGP"), 1, "exactly one armored block") + self.assertEqual(openpgp_primary_fingerprints(armored), + [self.policy["platforms"]["linux-x86_64"]["trust"]["fingerprint"]], + "exactly one primary key, and it is the release key the policy trusts") + + def test_key_reader_refuses_secret_or_extra_material(self): + armored = LINUX_KEY.read_text(encoding="ascii") + for change in (armored.replace("PUBLIC KEY BLOCK", "PRIVATE KEY BLOCK"), + armored.replace("-----END PGP PUBLIC KEY BLOCK-----\n", ""), + "Comment: extra\n" + armored): + with self.subTest(change=change[:40]), self.assertRaises(ValueError): + openpgp_primary_fingerprints(change) + + def test_bounds(self): + self.assertIs(type(self.policy["max_age_seconds"]), int) + self.assertTrue(0 < self.policy["max_age_seconds"] <= 604800) + self.assertIs(type(self.policy["max_artifact_bytes"]), int) + self.assertTrue(0 < self.policy["max_artifact_bytes"] <= 16 * 1024 ** 3) + + def test_candidate_workflows_run_on_every_main_push(self): + candidate = self.policy["candidate_policy"] + self.assertEqual(set(candidate), {"schema", "epoch", "repository", "branch", "required_workflows", "sonar"}) + self.assertEqual(candidate["schema"], "craft-nightly-candidate-policy/v3") + self.assertEqual((candidate["repository"], candidate["branch"]), ("storytold/gridcraft", "main")) + self.assertTrue(isinstance(candidate["epoch"], str) and 0 < len(candidate["epoch"]) <= 128) + rows = candidate["required_workflows"] + self.assertTrue(rows) + for row in rows: + with self.subTest(workflow=row["workflow_path"]): + self.assertEqual(set(row), {"workflow_id", "workflow_path", "jobs"}) + self.assertIs(type(row["workflow_id"]), int) + self.assertNotEqual(row["workflow_path"], self.policy["producer_workflow_path"]) + source = (ROOT / row["workflow_path"]).read_text() + push = push_block(source) + self.assertIsNotNone(push, "a required workflow must run on main pushes") + self.assertIn("branches: [main]", push) + self.assertNotRegex(push, r"(?m)^\s+paths(?:-ignore)?:", "a path filter would leave candidates without a run") + names = [job["name"] for job in row["jobs"]] + self.assertEqual(len(names), len(set(names))) + for job in row["jobs"]: + self.assertEqual(set(job), {"name", "app_id", "applicability"}) + self.assertEqual((job["app_id"], job["applicability"]), (15368, "required")) + + def test_a_path_filter_after_a_blank_line_is_still_rejected(self): + workflow = "on:\n push:\n branches: [main]\n\n paths: ['src/**']\n workflow_dispatch: {}\n" + block = push_block(workflow) + self.assertIsNotNone(block) + self.assertIn("branches: [main]", block) + self.assertRegex(block, r"(?m)^\s+paths(?:-ignore)?:") + for ignored in ("paths: ['src/**']", "paths-ignore: ['docs/**']"): + with self.subTest(ignored=ignored): + variant = workflow.replace(ignored.split(":")[0] + ": ['src/**']", ignored) + self.assertRegex(push_block(variant), r"(?m)^\s+paths(?:-ignore)?:", + "a quoted or unquoted filter must not hide behind a blank line") + + def test_sonar_identity_and_reviewed_scope(self): + sonar = self.policy["candidate_policy"]["sonar"] + properties = dict(line.split("=", 1) for line in (ROOT / "sonar-project.properties").read_text().splitlines() + if line and not line.startswith("#")) + self.assertEqual(sonar["organization"], properties["sonar.organization"]) + self.assertEqual(sonar["project"], properties["sonar.projectKey"]) + self.assertEqual((sonar["app_id"], sonar["check_name"]), (12526, "SonarCloud Code Analysis")) + self.assertEqual(sonar["details_url"], "https://sonarcloud.io/dashboard?id=" + sonar["project"] + "&branch=main") + accepted = {"bugs": "BUG", "vulnerabilities": "VULNERABILITY", "code_smells": "CODE_SMELL", + "security_rating": "VULNERABILITY", "new_security_rating": "VULNERABILITY"} + self.assertEqual({accepted[c["metric"]] for c in sonar["accepted_conditions"]}, set(sonar["issue_types"])) + metrics = [c["metric"] for c in sonar["accepted_conditions"] + sonar["required_conditions"]] + self.assertEqual(len(metrics), len(set(metrics))) + keys = [item["key"] for item in sonar["debt"]] + self.assertEqual(len(keys), len(set(keys))) + for item in sonar["debt"]: + with self.subTest(issue=item["key"]): + self.assertEqual(set(item), {"key", "rule", "component", "type", "severity", "hash"}) + self.assertTrue(item["component"].startswith(sonar["project"] + ":")) + self.assertIn(item["type"], sonar["issue_types"]) + self.assertRegex(item["hash"], r"^[0-9a-f]{32}$") + + +if __name__ == "__main__": + unittest.main(verbosity=2) diff --git a/packaging/nightly-tests.py b/packaging/nightly-tests.py new file mode 100755 index 0000000000..684239f495 --- /dev/null +++ b/packaging/nightly-tests.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 +"""Run the synthetic nightly packaging suites together; no app build, no signing, no network.""" +import importlib.util +from pathlib import Path +import unittest + + +def main() -> int: + here = Path(__file__).resolve().parent + suite = unittest.TestSuite() + for name, relative in ( + ("gridcraft_archive_suite", "nightly-archive-tests.py"), + ("gridcraft_plist_suite", "macos/nightly_plist_tests.py"), + ("gridcraft_release_dispatch_suite", "nightly-release-tests.py"), + ("gridcraft_mac_sign_suite", "macos/nightly_sign_tests.py"), + ("gridcraft_linux_launch_suite", "linux/nightly-linux-launch-tests.py"), + ): + spec = importlib.util.spec_from_file_location(name, here / relative) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + suite.addTests(unittest.defaultTestLoader.loadTestsFromModule(module)) + return 0 if unittest.TextTestRunner(verbosity=2).run(suite).wasSuccessful() else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/packaging/nightly_paths.py b/packaging/nightly_paths.py new file mode 100644 index 0000000000..792198589e --- /dev/null +++ b/packaging/nightly_paths.py @@ -0,0 +1,139 @@ +"""POSIX packaging I/O rooted at a caller-owned private working directory. + +The build launcher chooses cwd independently of file arguments (Linux uses its +mktemp directory). This is not a sandbox against root or a malicious same-UID +caller, and inode-check/unlink cleanup is not an atomic replacement-race primitive. +""" +import contextlib +import os +from pathlib import Path +import stat + + +def _component(name): + # A descriptor-relative open must name exactly one entry in its directory. + if not name or name in (".", "..") or os.path.basename(name) != name: + raise ValueError("build path components must be single names") + return os.path.basename(name) + + +class OwnedBuildRoot: + def __enter__(self): + self.directory = Path.cwd() + self.fd = os.open(".", os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW) + info = os.fstat(self.fd) + if info.st_uid != os.geteuid() or stat.S_IMODE(info.st_mode) & 0o077: + os.close(self.fd) + raise ValueError("packaging cwd must be an owned private build directory") + return self + + def __exit__(self, *_error): + os.close(self.fd) + + def _relative(self, path): + path = Path(path) + try: + relative = path.relative_to(self.directory) if path.is_absolute() else path + except ValueError as error: + raise ValueError("path is outside the owned build directory") from error + if not relative.parts or ".." in relative.parts: + raise ValueError("empty or parent-traversing build path") + # Check an independently selected root, never the supplied filename's parent. + try: + parent = (self.directory / relative).parent.resolve(strict=True) + except OSError as error: + raise ValueError("build path parent must exist") from error + if not parent.is_relative_to(self.directory): + raise ValueError("resolved path escapes the owned build directory") + return relative + + def _checked_parts(self, path): + relative = self._relative(path) + root = os.path.realpath(self.directory) + lexical = os.path.join(root, *relative.parts) + target = os.path.realpath(lexical) + if target == root or os.path.commonpath([root, target]) != root: + raise ValueError("resolved path escapes the owned build directory") + if target != lexical: + raise ValueError("build path must not pass through symlinks or aliases") + return [_component(part) for part in os.path.relpath(target, root).split(os.sep)] + + def _parent(self, path): + parts = self._checked_parts(path) + current = os.dup(self.fd) + try: + for part in parts[:-1]: + next_fd = os.open(_component(part), os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=current) + os.close(current) + current = next_fd + return current, parts[-1] + except OSError as error: + os.close(current) + raise ValueError("build path parents must be non-symlink directories") from error + + @contextlib.contextmanager + def reader(self, path, limit): + parent, name = self._parent(path) + try: + try: + descriptor = os.open(_component(name), os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=parent) + except OSError as error: + raise ValueError("build input must be a regular file without aliases") from error + finally: + os.close(parent) + info = os.fstat(descriptor) + if not stat.S_ISREG(info.st_mode) or info.st_size > limit: + os.close(descriptor) + raise ValueError("build input must be a regular file within its read bound") + with os.fdopen(descriptor, "rb") as stream: + yield stream + + def read_bytes(self, path, limit): + with self.reader(path, limit) as stream: + data = stream.read(limit + 1) + if len(data) > limit: + raise ValueError("build input grew beyond its read bound") + return data + + def children(self, path, limit): + relative = self._relative(path) + parent, name = self._parent(path) + try: + try: + descriptor = os.open(_component(name), os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=parent) + except OSError as error: + raise ValueError("build stage must be a non-symlink directory") from error + finally: + os.close(parent) + try: + entries = [] + with os.scandir(descriptor) as iterator: + for entry in iterator: + if len(entries) >= limit: + raise ValueError("too many build stage members") + entries.append(self.directory / relative / entry.name) + return entries + finally: + os.close(descriptor) + + @contextlib.contextmanager + def create(self, path): + parent, name = self._parent(path) + name = _component(name) + try: + descriptor = os.open(name, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o666, dir_fd=parent) + info = os.fstat(descriptor) + identity = (info.st_dev, info.st_ino) + try: + with os.fdopen(descriptor, "wb") as stream: + yield stream + except BaseException: + try: + current = os.stat(name, dir_fd=parent, follow_symlinks=False) + if (current.st_dev, current.st_ino) == identity: + os.unlink(_component(name), dir_fd=parent) + except FileNotFoundError: + pass + raise + finally: + os.close(parent) diff --git a/packaging/windows/nightly-package-tests.ps1 b/packaging/windows/nightly-package-tests.ps1 new file mode 100644 index 0000000000..15c6ac9964 --- /dev/null +++ b/packaging/windows/nightly-package-tests.ps1 @@ -0,0 +1,95 @@ +param([Parameter(Mandatory=$true)][string] $FixtureRoot) +. (Join-Path $PSScriptRoot 'nightly.ps1') -FunctionsOnly +function Assert([bool] $Value, [string] $Message) { if (-not $Value) { throw $Message } } +$spec = Get-NightlyArchiveSpec '0.23.1-nightly.20261120.17.1.gabcdef012345' 'x64' +Assert ($spec.Archive -eq 'gridcraft-0.23.1-nightly.20261120.17.1.gabcdef012345-windows-x86_64-nightly.zip') 'wrong nightly artifact name' +Assert ($spec.Executables.Count -eq 1 -and $spec.Executables[0] -eq 'gridcraft.exe') 'nightly must not ship the unqualified CLI' +Assert ($spec.AppId -eq 'ai.storyteller.gridcraft.nightly-v1') 'nightly identity is not distinct' +foreach ($arch in @('x86', 'arm64')) { + $refused = $false + try { Get-NightlyArchiveSpec '0.23.1' $arch | Out-Null } catch { $refused = $true } + Assert $refused 'unsupported target was accepted' +} +foreach ($bad in @('', '0.23.1', '../other', '0.23.1/elsewhere')) { + $refused = $false + try { Get-NightlyArchiveSpec $bad 'x64' | Out-Null } catch { $refused = $true } + Assert $refused 'unsafe artifact version was accepted' +} +Assert-NightlyFlavor 'GridCraft Nightly' 'GridCraft 0.23.1-nightly.20261120.17.1.gabcdef012345 (nightly-v1)' '0.23.1-nightly.20261120.17.1.gabcdef012345' +foreach ($pair in @(@('GridCraft', 'GridCraft 0.23.1 (nightly-v1)'), @('GridCraft Nightly', 'GridCraft 0.23.1'))) { + $refused = $false + try { Assert-NightlyFlavor $pair[0] $pair[1] '0.23.1-nightly.20261120.17.1.gabcdef012345' } catch { $refused = $true } + Assert $refused 'stable or mismatched build flavor was accepted' +} +$sha = 'abcdef0123456789abcdef0123456789abcdef01' +$good = '0.23.1-nightly.20261120.17.1.gabcdef012345' +Assert-NightlySource $good $sha '2026-11-20' $sha '' +$cases = @( + @('missing commit', $good, '', '2026-11-20', $sha, ''), + @('short commit', $good, 'abcdef012345', '2026-11-20', $sha, ''), + @('uppercase commit', $good, $sha.ToUpper(), '2026-11-20', $sha.ToUpper(), ''), + @('version names another commit', '0.23.1-nightly.20261120.17.1.g000000000000', $sha, '2026-11-20', $sha, ''), + @('missing date', $good, $sha, '', $sha, ''), + @('date differs from version', $good, $sha, '2026-11-21', $sha, ''), + @('other commit checked out', $good, $sha, '2026-11-20', ('0' * 40), ''), + @('dirty tree', $good, $sha, '2026-11-20', $sha, ' M apps/gridcraft/src/main.rs') +) +foreach ($case in $cases) { + $refused = $false + try { Assert-NightlySource $case[1] $case[2] $case[3] $case[4] $case[5] } catch { $refused = $true } + Assert $refused "source identity accepted: $($case[0])" +} +Write-Output 'nightly packaging spec, target/version refusal, source identity and flavor-binding tests passed' + +# Exercise the SAME production notice copier with the real repository layout, then inspect a ZIP. +if (-not $FixtureRoot -or -not [IO.Path]::IsPathRooted($FixtureRoot)) { throw 'supply an owned absolute -FixtureRoot for the notices/ZIP regression' } +$testRoot = Join-Path $FixtureRoot ("nightly-notices-" + [Guid]::NewGuid().ToString('N')) +try { + $repo = Join-Path $testRoot 'app' + $fontRepo = Join-Path $testRoot 'craft-fonts' + $family = Join-Path $fontRepo 'fonts\ExampleFamily' + $stage = Join-Path $testRoot 'stage' + New-Item -ItemType Directory -Force -Path $repo, $family, $stage | Out-Null + $rootNames = @('README.md', 'LICENSE', 'LICENSE-MIT', 'LICENSE-APACHE', 'NOTICE', 'ATTRIBUTION.md') + foreach ($name in $rootNames) { Set-Content -LiteralPath (Join-Path $repo $name) -Value "root-notice-$name" } + Set-Content -LiteralPath (Join-Path $family 'OFL.txt') -Value 'font-notice-example' + Copy-NightlyNotices $repo $fontRepo $stage + foreach ($name in @($rootNames) + @('OFL-ExampleFamily.txt')) { + Assert (Test-Path -LiteralPath (Join-Path $stage $name)) "missing staged notice $name" + } + $zip = Join-Path $testRoot 'notices.zip' + Compress-Archive -Path (Join-Path $stage '*') -DestinationPath $zip + $archive = [IO.Compression.ZipFile]::OpenRead($zip) + try { + $names = @($archive.Entries | ForEach-Object { $_.FullName }) + foreach ($name in @($rootNames) + @('OFL-ExampleFamily.txt')) { Assert ($name -in $names) "missing archived notice $name" } + foreach ($forbidden in @('portable.txt', 'gridcraft-cli.exe')) { Assert ($forbidden -notin $names) "unexpected payload $forbidden" } + $entry = $archive.GetEntry('OFL-ExampleFamily.txt') + $reader = [IO.StreamReader]::new($entry.Open()) + try { Assert ($reader.ReadToEnd().Contains('font-notice-example')) 'wrong font license bytes in ZIP' } finally { $reader.Dispose() } + } finally { $archive.Dispose() } +} finally { + if (Test-Path -LiteralPath $testRoot) { Remove-Item -LiteralPath $testRoot -Recurse -Force } +} +Write-Output 'nightly mock-repository root and font notices are present in stage and ZIP' + +# The source state comes from git itself: the checked-out commit, then a dirty tree. +$gitRoot = Join-Path $FixtureRoot ("nightly-source-" + [Guid]::NewGuid().ToString('N')) +try { + New-Item -ItemType Directory -Force -Path $gitRoot | Out-Null + git -C $gitRoot init -q; git -C $gitRoot -c user.name=fixture -c user.email=fixture@invalid commit -q --allow-empty -m fixture + if ($LASTEXITCODE -ne 0) { throw 'cannot create the git fixture' } + $head = (git -C $gitRoot rev-parse HEAD).Trim() + $state = Get-NightlySourceState $gitRoot + Assert ($state.Head -ceq $head -and -not $state.Status) 'clean checkout not reported as clean at HEAD' + $version = '0.23.1-nightly.20261120.17.1.g' + $head.Substring(0, 12) + Assert-NightlySource $version $head '2026-11-20' $state.Head $state.Status + Set-Content -LiteralPath (Join-Path $gitRoot 'untracked.txt') -Value 'dirty' + $state = Get-NightlySourceState $gitRoot + $refused = $false + try { Assert-NightlySource $version $head '2026-11-20' $state.Head $state.Status } catch { $refused = $true } + Assert $refused 'a dirty checkout was accepted' +} finally { + if (Test-Path -LiteralPath $gitRoot) { Remove-Item -LiteralPath $gitRoot -Recurse -Force } +} +Write-Output 'nightly source state is read from git and a dirty checkout is refused' diff --git a/packaging/windows/nightly-signing-tests.ps1 b/packaging/windows/nightly-signing-tests.ps1 new file mode 100644 index 0000000000..d45a0f83d6 --- /dev/null +++ b/packaging/windows/nightly-signing-tests.ps1 @@ -0,0 +1,83 @@ +param( + [Parameter(Mandatory=$true)][string] $FixtureRoot, + [string] $PackagingRoot = $PSScriptRoot, + [switch] $PhaseGuardOnly +) +$ErrorActionPreference = 'Stop' +. (Join-Path $PackagingRoot 'nightly.ps1') -FunctionsOnly +$sign = Join-Path $PackagingRoot 'sign.ps1' +$names = @('WINDOWS_CERTIFICATE','WINDOWS_CERTIFICATE_PASSWORD','AZURE_TENANT_ID','AZURE_CLIENT_ID','AZURE_CLIENT_SECRET','AZURE_SIGNING_ENDPOINT','AZURE_SIGNING_ACCOUNT','AZURE_CERT_PROFILE') +function Clear-SigningFixtures { foreach ($name in $names) { [Environment]::SetEnvironmentVariable($name, $null) } } +function Assert-Policy([bool] $Value, [string] $Message) { if (-not $Value) { throw $Message } } +function Invoke-Refusal([scriptblock] $Operation, [string] $Message) { + $errorText = '' + try { & $Operation | Out-Null } catch { $errorText = $_.Exception.Message } + Assert-Policy ($errorText.Contains($Message)) "expected refusal: $Message; got: $errorText" +} +function global:cargo { $global:SigningFixtureCargoCalls++; throw 'FIXTURE_COMPILER_BOUNDARY' } +function global:Invoke-WebRequest { throw 'fixture must not perform signing downloads' } +$global:SigningFixtureCargoCalls = 0 +if (-not [IO.Path]::IsPathRooted($FixtureRoot)) { throw 'use an owned absolute FixtureRoot' } +$root = Join-Path $FixtureRoot ('signing-policy-' + [Guid]::NewGuid().ToString('N')) +New-Item -ItemType Directory -Path $root | Out-Null +$version = '0.23.1-nightly.20261121.12345.1.gaaaaaaaaaaaa' +$env:GRIDCRAFT_VERSION = $version +function Invoke-Build([switch] $BuildOnly) { + $arguments = @{Arch='x64';Version=$version;Target='x86_64-pc-windows-msvc';TargetDir=$root;Dist=(Join-Path $root 'dist')} + if ($BuildOnly) { $arguments.BuildOnly = $true } + & (Join-Path $PackagingRoot 'nightly.ps1') @arguments +} +try { + Clear-SigningFixtures + Invoke-Refusal { Invoke-Build } 'requires -BuildOnly' + Assert-Policy ($global:SigningFixtureCargoCalls -eq 0) 'default mode invoked Cargo' + Write-Output 'PASS: explicit-build-phase-required' + if ($PhaseGuardOnly) { return } + + foreach ($name in @('WINDOWS_CERTIFICATE','WINDOWS_CERTIFICATE_PASSWORD','AZURE_CLIENT_SECRET')) { + Clear-SigningFixtures + [Environment]::SetEnvironmentVariable($name, 'generated-fixture-not-a-secret') + Invoke-Refusal { Invoke-Build -BuildOnly } 'Compilation must not receive signing credentials' + Assert-Policy ($global:SigningFixtureCargoCalls -eq 0) 'key-bearing compilation reached Cargo' + } + Write-Output 'PASS: credentials-rejected-before-compilation' + + Clear-SigningFixtures + Invoke-Refusal { Invoke-Build -BuildOnly } 'FIXTURE_COMPILER_BOUNDARY' + Assert-Policy ($global:SigningFixtureCargoCalls -eq 1) 'clean compilation did not reach the mocked compiler boundary' + Assert-Policy (-not (Test-Path (Join-Path $root 'dist'))) 'mocked compilation produced an artifact' + Write-Output 'PASS: secret-free-build-reaches-only-mocked-boundary' + + Clear-SigningFixtures + Invoke-Refusal { & $sign -Required -CheckOnly } 'Nightly signing is required' + $env:AZURE_CLIENT_SECRET = 'generated-partial-fixture' + Invoke-Refusal { & $sign -Required -CheckOnly } 'Nightly signing is required' + Write-Output 'PASS: required-signer-refuses-missing-and-partial-configuration' + + Clear-SigningFixtures + $env:WINDOWS_CERTIFICATE = 'generated-presence-fixture-not-a-certificate' + & $sign -Required -CheckOnly + Clear-SigningFixtures + foreach ($name in $names | Where-Object { $_.StartsWith('AZURE_') }) { [Environment]::SetEnvironmentVariable($name, 'generated-presence-fixture') } + & $sign -Required -CheckOnly + Clear-SigningFixtures + Write-Output 'PASS: supported-configuration-presence-without-signing' + + # Load the policy function without signing. These objects are not crypto evidence. + . $sign -CheckOnly + foreach ($value in @($null, [pscustomobject]@{Status='NotSigned';SignerCertificate='fixture'}, [pscustomobject]@{Status='HashMismatch';SignerCertificate='fixture'}, [pscustomobject]@{Status='Valid';SignerCertificate=$null})) { + Invoke-Refusal { Assert-AuthenticodeSignature $value } 'valid Authenticode signature' + } + Assert-AuthenticodeSignature ([pscustomobject]@{Status='Valid';SignerCertificate='generated-public-certificate-placeholder'}) + Write-Output 'PASS: required-signature-policy-rejects-invalid-or-missing-signer' + + $file = Join-Path $root 'owned-sentinel.exe' + [IO.File]::WriteAllText($file, 'generated sentinel, not a real executable') + $before = (Get-FileHash -LiteralPath $file -Algorithm SHA256).Hash + & $sign -Files $file + Assert-Policy ((Get-FileHash -LiteralPath $file -Algorithm SHA256).Hash -ceq $before) 'optional stable policy changed unsigned bytes' + Write-Output 'PASS: stable-optional-policy-preserves-owned-bytes' +} finally { + Clear-SigningFixtures + Remove-Item -LiteralPath $root -Recurse -Force +} diff --git a/packaging/windows/nightly.ps1 b/packaging/windows/nightly.ps1 new file mode 100644 index 0000000000..1d2312d9c3 --- /dev/null +++ b/packaging/windows/nightly.ps1 @@ -0,0 +1,133 @@ +<# First nightly target only: Windows x86_64 GUI ZIP. No MSI, CLI, portable marker or association registration. #> +param( + [string] $Arch = 'x64', + [string] $Version, + [string] $Target, + [string] $TargetDir, + [string] $Dist, + [switch] $SkipBuild, + [switch] $BuildOnly, + [switch] $FunctionsOnly +) +$ErrorActionPreference = 'Stop' + +function Get-NightlyArchiveSpec([string] $Version, [string] $Arch) { + if ($Arch -ne 'x64') { throw 'nightly-v1 supports only Windows x86_64' } + if (-not $Version -or $Version -cnotmatch '^\d+\.\d+\.\d+-nightly\.\d{8}\.\d+\.\d+\.g[0-9a-f]{12}\z') { throw 'invalid nightly artifact version' } + return @{ + Archive = "gridcraft-$Version-windows-x86_64-nightly.zip" + UnsignedArchive = "gridcraft-$Version-windows-x86_64-nightly.unsigned.zip" + Executables = @('gridcraft.exe') + Channel = 'nightly-v1' + AppId = 'ai.storyteller.gridcraft.nightly-v1' + } +} + +# The same source identity the Linux helper enforces (nightly-common.sh): the version names the +# commit being built, the date is the original run's, and the tree is clean. +function Assert-NightlySource([string] $Version, [string] $Sha, [string] $BuildDate, [string] $Head, [string] $Status) { + if ($Sha -cnotmatch '^[0-9a-f]{40}\z') { throw 'an exact source commit is required (GRIDCRAFT_BUILD_SHA)' } + if ($Version -cnotmatch '^\d+\.\d+\.\d+-nightly\.\d{8}\.\d+\.\d+\.g[0-9a-f]{12}\z') { throw 'invalid nightly artifact version' } + if ($Version.Substring($Version.Length - 12) -cne $Sha.Substring(0, 12)) { throw 'version/source commit mismatch' } + if ($BuildDate -cnotmatch '^\d{4}-\d{2}-\d{2}\z') { throw 'the original run-created UTC date is required (GRIDCRAFT_BUILD_DATE)' } + $versionDate = ($Version -split '-nightly\.', 2)[1].Substring(0, 8) + if ($BuildDate.Replace('-', '') -cne $versionDate) { throw 'version/original-run date mismatch' } + if ($Head -cne $Sha) { throw 'prepared source is not the checked-out commit' } + if ($Status) { throw 'nightly packaging requires the frozen clean source' } +} + +function Get-NightlySourceState([string] $RepositoryRoot) { + $head = git -C $RepositoryRoot rev-parse HEAD + if ($LASTEXITCODE -ne 0) { throw 'cannot read the checked-out commit' } + $status = git -C $RepositoryRoot status --porcelain + if ($LASTEXITCODE -ne 0) { throw 'cannot read the source tree status' } + return @{ Head = "$head".Trim(); Status = ($status | Out-String).Trim() } +} + +function Assert-NightlyFlavor([string] $ProductName, [string] $VersionOutput, [string] $ExpectedVersion) { + if ($ProductName -ne 'GridCraft Nightly' -or $VersionOutput -cne "GridCraft $ExpectedVersion (nightly-v1)") { + throw 'the executable is not the compiled nightly-v1 flavor' + } +} + + +function Copy-NightlyNotices([string] $RepositoryRoot, [string] $FontRepository, [string] $Destination) { + foreach ($name in 'README.md', 'LICENSE', 'LICENSE-MIT', 'LICENSE-APACHE', 'NOTICE', 'ATTRIBUTION.md') { + $source = Join-Path $RepositoryRoot $name + if (Test-Path -LiteralPath $source) { Copy-Item -LiteralPath $source -Destination $Destination } + } + if ($FontRepository) { + $fonts = Join-Path $FontRepository 'fonts' + if (-not (Test-Path -LiteralPath $fonts -PathType Container)) { throw 'CRAFT_FONTS_DIR has no fonts directory for the bundled notices' } + foreach ($family in Get-ChildItem -LiteralPath $fonts -Directory) { + $license = Join-Path $family.FullName 'OFL.txt' + if (Test-Path -LiteralPath $license) { Copy-Item -LiteralPath $license -Destination (Join-Path $Destination "OFL-$($family.Name).txt") } + } + } +} + +if ($FunctionsOnly) { return } +if (-not $env:GRIDCRAFT_VERSION -or $Version -cne $env:GRIDCRAFT_VERSION) { throw 'nightly-v1 requires explicit GRIDCRAFT_VERSION, not the Cargo version fallback' } +$Spec = Get-NightlyArchiveSpec $Version $Arch +if ($SkipBuild) { throw 'nightly-v1 forbids -SkipBuild; the executable flavor must be built in this operation' } +if ($Target -ne 'x86_64-pc-windows-msvc') { throw 'nightly-v1 target must be x86_64-pc-windows-msvc' } +if (-not $BuildOnly) { throw 'Nightly compilation requires -BuildOnly; final archives are produced in the separate trusted signing job' } +# No key values may enter compilation. This produces an internal intermediate, not a feed artifact. +& (Join-Path $PSScriptRoot 'sign.ps1') -CheckBuildEnvironment +$Root = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path +$Source = Get-NightlySourceState $Root +Assert-NightlySource $Version $env:GRIDCRAFT_BUILD_SHA $env:GRIDCRAFT_BUILD_DATE $Source.Head $Source.Status +# build.rs reads GRIDCRAFT_BUILD_CHANNEL and GRIDCRAFT_VERSION from the environment: that pair is +# what makes this executable the nightly flavor with the prepared identity, and no other. +$oldChannel = $env:GRIDCRAFT_BUILD_CHANNEL +try { + $env:GRIDCRAFT_BUILD_CHANNEL = 'nightly-v1' + $env:GRIDCRAFT_REQUIRE_WINRES = '1' + $env:CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RUSTFLAGS = '-C target-feature=+crt-static' + # Into the directory the archive steps read (`$TargetDir`), not Cargo's default. + cargo build --release --locked -p gridcraft --target $Target --target-dir $TargetDir + if ($LASTEXITCODE -ne 0) { throw "nightly cargo build failed: $LASTEXITCODE" } +} finally { + $env:GRIDCRAFT_BUILD_CHANNEL = $oldChannel +} +$Source = Get-NightlySourceState $Root +try { Assert-NightlySource $Version $env:GRIDCRAFT_BUILD_SHA $env:GRIDCRAFT_BUILD_DATE $Source.Head $Source.Status } +catch { throw "source changed during the build: $_" } +$Exe = Join-Path $TargetDir "$Target\release\gridcraft.exe" +$pe = [System.IO.File]::ReadAllBytes($Exe) +if ($pe.Length -lt 64) { throw 'truncated nightly PE executable' } +$offset = [BitConverter]::ToInt32($pe, 0x3C) +if ($offset -lt 0 -or $offset -gt $pe.Length - 0x5E) { throw 'invalid nightly PE header offset' } +if ([BitConverter]::ToUInt16($pe, $offset + 4) -ne 0x8664 -or [BitConverter]::ToUInt16($pe, $offset + 0x5C) -ne 2) { + throw 'nightly executable must be x86_64 Windows GUI' +} +$VersionInfo = (Get-Item -LiteralPath $Exe).VersionInfo +$ProductName = $VersionInfo.ProductName +if ($VersionInfo.ProductVersion -cne $Version) { throw 'nightly PE ProductVersion differs from the feed identity' } +# Check the embedded build flavor before invoking even the side-effect-free version query. +if ($ProductName -ne 'GridCraft Nightly') { throw 'nightly executable is missing the embedded build flavor' } +$VersionOutput = (& $Exe --version | Out-String).Trim() +if ($LASTEXITCODE -ne 0) { throw 'nightly --version query failed' } +Assert-NightlyFlavor $ProductName $VersionOutput $Version +$Stage = Join-Path $TargetDir 'windows-package\nightly-v1-x86_64' +if (Test-Path -LiteralPath $Stage) { Remove-Item -LiteralPath $Stage -Recurse -Force } +New-Item -ItemType Directory -Force -Path $Stage | Out-Null +Copy-Item -LiteralPath $Exe -Destination (Join-Path $Stage 'gridcraft.exe') +# Signing happens only in the separate trusted step, using sign.ps1 -Required. +# The intermediate's filename cannot satisfy the feed-ready archive contract. +Copy-NightlyNotices $Root $env:CRAFT_FONTS_DIR $Stage +if ((Get-ChildItem -LiteralPath $Stage -Filter '*.exe').Count -ne 1 -or (Test-Path (Join-Path $Stage 'portable.txt'))) { + throw 'nightly stage contains an unexpected executable or portable fallback marker' +} +New-Item -ItemType Directory -Force -Path $Dist | Out-Null +$Zip = Join-Path $Dist $Spec.UnsignedArchive +if (Test-Path -LiteralPath $Zip) { throw 'Nightly output already exists; refusing to replace prepared artifact bytes' } +Compress-Archive -Path (Join-Path $Stage '*') -DestinationPath $Zip +$Archive = [System.IO.Compression.ZipFile]::OpenRead($Zip) +try { + $Names = @($Archive.Entries | ForEach-Object { $_.FullName }) + if ('gridcraft.exe' -notin $Names -or 'gridcraft-cli.exe' -in $Names -or 'portable.txt' -in $Names) { + throw 'nightly ZIP payload violates the GUI-only profile contract' + } +} finally { $Archive.Dispose() } +Write-Output "Nightly build intermediate (not publishable): $Zip ($VersionOutput)" diff --git a/packaging/windows/package.ps1 b/packaging/windows/package.ps1 index 9a1303064a..386dcfebc7 100644 --- a/packaging/windows/package.ps1 +++ b/packaging/windows/package.ps1 @@ -21,9 +21,12 @@ #> param( [ValidateSet('x64', 'x86', 'arm64')] [string] $Arch = 'x64', - [switch] $SkipBuild + [switch] $SkipBuild, + [switch] $Nightly, + [switch] $BuildOnly ) $ErrorActionPreference = 'Stop' +if ($BuildOnly -and -not $Nightly) { throw '-BuildOnly is only for secret-free nightly compilation' } $Root = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path function Invoke-Native([string] $What, [scriptblock] $Block) { @@ -50,11 +53,21 @@ $Dist = if ($env:DIST) { $env:DIST } else { Join-Path $Root 'dist\release' } $TargetDir = if ($env:CARGO_TARGET_DIR) { $env:CARGO_TARGET_DIR } else { Join-Path $Root 'target' } New-Item -ItemType Directory -Force -Path $Dist | Out-Null -if (-not $env:GRIDCRAFT_BUILD_SHA) { $env:GRIDCRAFT_BUILD_SHA = (git -C $Root rev-parse HEAD 2>$null) } -if (-not $env:GRIDCRAFT_BUILD_DATE) { $env:GRIDCRAFT_BUILD_DATE = (Get-Date).ToUniversalTime().ToString('yyyy-MM-dd') } +# A nightly requires the prepared commit and original run date explicitly; nightly.ps1 checks both. +if (-not $Nightly) { + if (-not $env:GRIDCRAFT_BUILD_SHA) { $env:GRIDCRAFT_BUILD_SHA = (git -C $Root rev-parse HEAD 2>$null) } + if (-not $env:GRIDCRAFT_BUILD_DATE) { $env:GRIDCRAFT_BUILD_DATE = (Get-Date).ToUniversalTime().ToString('yyyy-MM-dd') } +} Write-Output "GridCraft $Version for Windows $Arch ($Target)" +# The nightly channel is its own producer: a GUI-only intermediate for the trusted signing job, never +# this MSI/portable/CLI contract. +if ($Nightly) { + & (Join-Path $PSScriptRoot 'nightly.ps1') -Arch $Arch -Version $Version -Target $Target -TargetDir $TargetDir -Dist $Dist -SkipBuild:$SkipBuild -BuildOnly:$BuildOnly + return +} + if (-not $SkipBuild) { # Static CRT: no VC++ redistributable needed. Scoped to the target so host build scripts and # proc-macros are unaffected. @@ -83,6 +96,11 @@ foreach ($check in @(@('gridcraft.exe', 2), @('gridcraft-cli.exe', 3))) { if ($h.Subsystem -ne $check[1]) { throw "$($check[0]) has PE subsystem $($h.Subsystem), expected $($check[1])" } Write-Output "ok $($check[0]): $Arch, PE subsystem $($h.Subsystem)" } +# The nightly flavor has its own identity; shipping it as the stable app would hand a nightly window +# the stable taskbar identity, data folder and update channel (#16335). +if ((Get-Item -LiteralPath (Join-Path $Bin 'gridcraft.exe')).VersionInfo.ProductName -eq 'GridCraft Nightly') { + throw 'a nightly executable cannot be packaged as stable' +} $Stage = Join-Path $TargetDir "windows-package\$Arch" Remove-Item -Recurse -Force $Stage -ErrorAction SilentlyContinue New-Item -ItemType Directory -Force -Path $Stage | Out-Null diff --git a/packaging/windows/sign.ps1 b/packaging/windows/sign.ps1 index 222d5705b2..fe7d9e39c9 100644 --- a/packaging/windows/sign.ps1 +++ b/packaging/windows/sign.ps1 @@ -13,16 +13,28 @@ This is the one place to adapt when the signing setup changes (an HSM/cloud key, a different timestamp server, ...). Optional overrides: WINDOWS_TIMESTAMP_URL, SIGNTOOL (path to signtool.exe). + Nightly callers require signing with -Required and can check the signing configuration with + -Required -CheckOnly. Compilation uses the separate -CheckBuildEnvironment mode, which never + imports keys. .EXAMPLE pwsh packaging/windows/sign.ps1 dist/gridcraft.exe dist/gridcraft.msi #> param( - [Parameter(Mandatory = $true, ValueFromRemainingArguments = $true)] - [string[]] $Files + [Parameter(Position = 0, ValueFromRemainingArguments = $true)] + [string[]] $Files, + [switch] $Required, + [switch] $CheckOnly, + [switch] $CheckBuildEnvironment ) $ErrorActionPreference = 'Stop' +function Assert-AuthenticodeSignature($Signature) { + if (-not $Signature -or [string]$Signature.Status -cne 'Valid' -or -not $Signature.SignerCertificate) { + throw 'Required signing must produce a valid Authenticode signature and signer certificate' + } +} + function Write-Warn([string] $Message) { if ($env:GITHUB_ACTIONS) { Write-Output "::warning::$Message" } else { Write-Warning $Message } } @@ -44,11 +56,30 @@ function Invoke-SignTool([string[]] $Arguments) { if ($LASTEXITCODE -ne 0) { throw "signtool $($Arguments[0]) failed with exit code $LASTEXITCODE" } } -$Files = $Files | ForEach-Object { (Resolve-Path $_).Path } -$haveCert = [bool]$env:WINDOWS_CERTIFICATE $azureVars = 'AZURE_TENANT_ID', 'AZURE_CLIENT_ID', 'AZURE_CLIENT_SECRET', 'AZURE_SIGNING_ENDPOINT', 'AZURE_SIGNING_ACCOUNT', 'AZURE_CERT_PROFILE' +if ($CheckBuildEnvironment) { + # Compilation must never see a key: the nightly producer calls this before cargo, and the trusted + # signing job is a separate operation with its own environment. + if ($Required -or $CheckOnly -or $Files) { throw '-CheckBuildEnvironment is separate from signing' } + $names = @('WINDOWS_CERTIFICATE', 'WINDOWS_CERTIFICATE_PASSWORD') + $azureVars + if ($names | Where-Object { [Environment]::GetEnvironmentVariable($_) }) { + throw 'Compilation must not receive signing credentials; use a separate trusted signing step' + } + return +} +$haveCert = [bool]$env:WINDOWS_CERTIFICATE $haveAzure = -not ($azureVars | Where-Object { -not [Environment]::GetEnvironmentVariable($_) }) +if ($Required -and -not $haveCert -and -not $haveAzure) { + throw 'Nightly signing is required: configure WINDOWS_CERTIFICATE or the complete existing Azure signing configuration' +} +if ($CheckOnly) { + if ($Files) { throw '-CheckOnly does not sign files' } + return +} +if (-not $Files) { throw 'At least one file is required for signing' } +$Files = $Files | ForEach-Object { (Resolve-Path $_).Path } + if (-not $haveCert -and -not $haveAzure) { Write-Warn "Windows signing secrets not set (WINDOWS_CERTIFICATE or AZURE_*): leaving unsigned: $($Files -join ', ')" exit 0 @@ -96,6 +127,10 @@ try { Invoke-SignTool ($common + @('/tr', $ts, '/dlib', $dlib.FullName, '/dmdf', $metadata) + $Files) } Invoke-SignTool (@('verify', '/pa', '/v') + $Files) + if ($Required) { + # signtool verify alone can pass while the authenticode state is anything but Valid. + foreach ($file in $Files) { Assert-AuthenticodeSignature (Get-AuthenticodeSignature -LiteralPath $file) } + } } finally { Remove-Item -Recurse -Force $tmp -ErrorAction SilentlyContinue diff --git a/sonar-project.properties b/sonar-project.properties index 4eed7fd86c..5b67372365 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,9 +1,17 @@ sonar.projectKey=storytold_gridcraft sonar.organization=storytold +# `sonar.tests` turns off the CLI's default scope, so `sonar.sources=.` must name the production +# tree explicitly; without it Sonar indexes the packaging fixtures and nothing else (L5). +sonar.sources=. +sonar.tests=packaging +# Only these are test runners: the helpers they exercise stay production code. +sonar.test.inclusions=packaging/nightly-tests.py,packaging/nightly-archive-tests.py,packaging/linux/nightly-linux-launch-tests.py,packaging/macos/nightly_plist_tests.py,packaging/macos/nightly_sign_tests.py,packaging/windows/nightly-package-tests.ps1,packaging/windows/nightly-signing-tests.ps1,packaging/nightly-release-tests.py + # The region table is one record per locale with the same field names and many shared values # (month names, formats); that repetition is data, not copy-pasted logic. sonar.cpd.exclusions=crates/core/src/region.rs +sonar.coverage.exclusions=packaging/** # githubactions:S7637 asks for every action to be pinned to a commit SHA. A workflow covered by # .github/workflows/actions.lock runs the commit the lockfile records, so its tag refs are pinned From 73a2fd7148fb18640cb1b81f34b8aa557cee6b30 Mon Sep 17 00:00:00 2001 From: aiongg Date: Wed, 25 Nov 2026 06:31:18 +0000 Subject: [PATCH 78/94] Repin craft-libs to storytold next 16001e7210 and egui to storytold b15ffe9bfc --- Cargo.lock | 98 +++++++++++++++++------------------ Cargo.toml | 42 +++++++-------- apps/gridcraft-web/Cargo.toml | 4 +- crates/ui-egui/Cargo.toml | 2 +- 4 files changed, 73 insertions(+), 73 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0de666c072..a6f39a1f9f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1034,7 +1034,7 @@ dependencies = [ [[package]] name = "craft-appkit" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "block2 0.6.2", "objc2-app-kit 0.3.2", @@ -1044,7 +1044,7 @@ dependencies = [ [[package]] name = "craft-atomic" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "rustix 1.1.6", ] @@ -1052,7 +1052,7 @@ dependencies = [ [[package]] name = "craft-behavior" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "accesskit", "bitflags 2.13.2", @@ -1070,12 +1070,12 @@ dependencies = [ [[package]] name = "craft-cfb" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" [[package]] name = "craft-cloud-ui" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "egui", ] @@ -1083,12 +1083,12 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" [[package]] name = "craft-csv" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "thiserror 2.0.21", ] @@ -1096,7 +1096,7 @@ dependencies = [ [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "serde", ] @@ -1104,7 +1104,7 @@ dependencies = [ [[package]] name = "craft-drawingml" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "chrono", "craft-xml", @@ -1116,7 +1116,7 @@ dependencies = [ [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "harfrust 0.13.3", "kurbo", @@ -1130,12 +1130,12 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" [[package]] name = "craft-gridcraft-format" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "serde", "serde_json", @@ -1145,7 +1145,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "bitflags 2.13.2", "craft-i18n", @@ -1158,7 +1158,7 @@ dependencies = [ [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "chrono", "fixed_decimal", @@ -1186,7 +1186,7 @@ dependencies = [ [[package]] name = "craft-keymap" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "craft-host", "craft-i18n", @@ -1201,7 +1201,7 @@ dependencies = [ [[package]] name = "craft-math" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "craft-xml", "roxmltree", @@ -1211,7 +1211,7 @@ dependencies = [ [[package]] name = "craft-mcp-server" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "serde_json", ] @@ -1219,7 +1219,7 @@ dependencies = [ [[package]] name = "craft-odf" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "aes", "base64 0.23.1", @@ -1237,7 +1237,7 @@ dependencies = [ [[package]] name = "craft-ods" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "craft-odf", "craft-sheet", @@ -1248,7 +1248,7 @@ dependencies = [ [[package]] name = "craft-offcrypto" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "aes", "base64 0.23.1", @@ -1265,7 +1265,7 @@ dependencies = [ [[package]] name = "craft-opc" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "craft-xml", "craft-zip", @@ -1276,7 +1276,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "serde", ] @@ -1284,7 +1284,7 @@ dependencies = [ [[package]] name = "craft-platform" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "async-channel", "async-io", @@ -1315,7 +1315,7 @@ dependencies = [ [[package]] name = "craft-print" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "craft-behavior", "craft-host", @@ -1339,7 +1339,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "dispatch2", "objc2 0.6.5", @@ -1351,7 +1351,7 @@ dependencies = [ [[package]] name = "craft-settings" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "craft-atomic", "craft-host", @@ -1368,12 +1368,12 @@ dependencies = [ [[package]] name = "craft-sheet" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" [[package]] name = "craft-stream-codecs" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "fax", "hayro-ccitt", @@ -1384,7 +1384,7 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "craft-xml", "flate2", @@ -1401,7 +1401,7 @@ dependencies = [ [[package]] name = "craft-theme" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "bitflags 2.13.2", "craft-tracked", @@ -1416,12 +1416,12 @@ dependencies = [ [[package]] name = "craft-tracked" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "craft-cloud-ui", "craft-ui-canvas", @@ -1435,7 +1435,7 @@ dependencies = [ [[package]] name = "craft-ui-canvas" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "craft-behavior", "craft-i18n", @@ -1451,7 +1451,7 @@ dependencies = [ [[package]] name = "craft-ui-contract" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "accesskit", "craft-behavior", @@ -1489,7 +1489,7 @@ dependencies = [ [[package]] name = "craft-ui-macros" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1500,7 +1500,7 @@ dependencies = [ [[package]] name = "craft-ui-panels" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "craft-behavior", "craft-host", @@ -1518,7 +1518,7 @@ dependencies = [ [[package]] name = "craft-ui-patterns" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "craft-behavior", "craft-host", @@ -1539,7 +1539,7 @@ dependencies = [ [[package]] name = "craft-ui-shell" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "craft-behavior", "craft-host", @@ -1559,7 +1559,7 @@ dependencies = [ [[package]] name = "craft-ui-widgets" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "craft-behavior", "craft-host", @@ -1578,7 +1578,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "chrono", "craft-host", @@ -1607,7 +1607,7 @@ dependencies = [ [[package]] name = "craft-web-api" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "js-sys", "serde_json", @@ -1618,7 +1618,7 @@ dependencies = [ [[package]] name = "craft-web-host" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "craft-host", "craft-platform", @@ -1630,7 +1630,7 @@ dependencies = [ [[package]] name = "craft-win32" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "winsafe", ] @@ -1638,7 +1638,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "craft-appkit", "craft-atomic", @@ -1670,7 +1670,7 @@ dependencies = [ [[package]] name = "craft-xls" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "craft-cfb", "craft-sheet", @@ -1683,7 +1683,7 @@ dependencies = [ [[package]] name = "craft-xlsx" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "craft-drawingml", "craft-opc", @@ -1695,7 +1695,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "quick-xml 0.41.0", "serde", @@ -1705,7 +1705,7 @@ dependencies = [ [[package]] name = "craft-zip" version = "0.1.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "flate2", "thiserror 2.0.21", @@ -3210,7 +3210,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/aiongg/craft-libs?rev=3ad64a26ea8a72c03c416681e14f7744393790b1#3ad64a26ea8a72c03c416681e14f7744393790b1" +source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" dependencies = [ "hayro-ccitt", ] diff --git a/Cargo.toml b/Cargo.toml index e668246aa2..091b4c436c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,29 +30,29 @@ gridcraft-math = { path = "crates/math" } # ui-egui, craft-print in the app, craft-web-api and craft-web-host in the web app) comes from one # craft-libs revision. # craft-update: app-specific pretend versions apply to startup and manual checks. -craft-update = { git = "https://github.com/aiongg/craft-libs", rev = "3ad64a26ea8a72c03c416681e14f7744393790b1", version = "=0.1.0", features = ["ui"] } +craft-update = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "=0.1.0", features = ["ui"] } # PDF RunLength encoding; this revision also fixes the vendored JBIG2 dependency for Git consumers. -craft-pdf = { git = "https://github.com/aiongg/craft-libs", rev = "3ad64a26ea8a72c03c416681e14f7744393790b1", version = "0.1.0", default-features = false } -craft-stream-codecs = { git = "https://github.com/aiongg/craft-libs", rev = "3ad64a26ea8a72c03c416681e14f7744393790b1", version = "0.1.0" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "0.1.0", default-features = false } +craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "0.1.0" } # Compound files ([MS-CFB]) and password-encrypted OOXML packages ([MS-OFFCRYPTO]). -craft-cfb = { git = "https://github.com/aiongg/craft-libs", rev = "3ad64a26ea8a72c03c416681e14f7744393790b1", version = "0.1.0" } -craft-offcrypto = { git = "https://github.com/aiongg/craft-libs", rev = "3ad64a26ea8a72c03c416681e14f7744393790b1", version = "0.1.0" } -craft-ods = { git = "https://github.com/aiongg/craft-libs", rev = "3ad64a26ea8a72c03c416681e14f7744393790b1", version = "0.1.0" } +craft-cfb = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "0.1.0" } +craft-offcrypto = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "0.1.0" } +craft-ods = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "0.1.0" } # OPC zip packages (parts, relationships, the zip writer) under `crates/xlsx/src/package.rs`. -craft-opc = { git = "https://github.com/aiongg/craft-libs", rev = "3ad64a26ea8a72c03c416681e14f7744393790b1", version = "0.1.0" } +craft-opc = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "0.1.0" } # Delimited text (CSV, TSV) and SYLK; `crates/xlsx/src/csv.rs` and `crates/engine/src/io/sylk.rs` # turn them into workbooks. -craft-csv = { git = "https://github.com/aiongg/craft-libs", rev = "3ad64a26ea8a72c03c416681e14f7744393790b1", version = "0.1.0" } -craft-math = { git = "https://github.com/aiongg/craft-libs", rev = "3ad64a26ea8a72c03c416681e14f7744393790b1", version = "0.1.0" } +craft-csv = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "0.1.0" } +craft-math = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "0.1.0" } # The native JSON workbook (`.json`, `.scjson`): read, written, and kept newer macros written back. -craft-gridcraft-format = { git = "https://github.com/aiongg/craft-libs", rev = "3ad64a26ea8a72c03c416681e14f7744393790b1", version = "0.1.0" } +craft-gridcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "0.1.0" } # Excel 97-2003 (.xls, BIFF8) workbooks; `crates/xlsx/src/xls.rs` maps them onto the model. # SpreadsheetML worksheet/drawing/string/package XML; workbook model mapping stays in gridcraft-xlsx. -craft-xlsx = { git = "https://github.com/aiongg/craft-libs", rev = "3ad64a26ea8a72c03c416681e14f7744393790b1", version = "0.1.0" } -craft-xml = { git = "https://github.com/aiongg/craft-libs", rev = "3ad64a26ea8a72c03c416681e14f7744393790b1", version = "0.1.0" } -craft-xls = { git = "https://github.com/aiongg/craft-libs", rev = "3ad64a26ea8a72c03c416681e14f7744393790b1", version = "0.1.0" } -craft-drawingml = { git = "https://github.com/aiongg/craft-libs", rev = "3ad64a26ea8a72c03c416681e14f7744393790b1", version = "0.1.0" } -craft-mcp-server = { git = "https://github.com/aiongg/craft-libs", rev = "3ad64a26ea8a72c03c416681e14f7744393790b1", version = "=0.1.0" } +craft-xlsx = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "0.1.0" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "0.1.0" } +craft-xls = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "0.1.0" } +craft-drawingml = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "0.1.0" } +craft-mcp-server = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "=0.1.0" } # foundation thiserror = "2" @@ -92,15 +92,15 @@ skrifa = { version = "0.44", default-features = false, features = ["std"] } epaint_default_fonts = "0.37" # One native window per workbook: the window list, Window menu titles and the immediate-viewport # driver. Same craft-libs revision as craft-update above. -craft-window = { version = "0.1.0", git = "https://github.com/aiongg/craft-libs", rev = "3ad64a26ea8a72c03c416681e14f7744393790b1", default-features = false, features = ["ui"] } +craft-window = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", default-features = false, features = ["ui"] } # The UI runtime GridCraft's egui UI is hosted by (`crates/ui-egui/src/framework.rs`): who the app is # to the framework's dialogs, the runtime's key bindings, the theme mode, window placement and the # printer controls. Same craft-libs revision as above. -craft-behavior = { version = "0.1.0", git = "https://github.com/aiongg/craft-libs", rev = "3ad64a26ea8a72c03c416681e14f7744393790b1" } -craft-host = { version = "0.1.0", git = "https://github.com/aiongg/craft-libs", rev = "3ad64a26ea8a72c03c416681e14f7744393790b1" } -craft-keymap = { version = "0.1.0", git = "https://github.com/aiongg/craft-libs", rev = "3ad64a26ea8a72c03c416681e14f7744393790b1" } -craft-theme = { version = "0.1.0", git = "https://github.com/aiongg/craft-libs", rev = "3ad64a26ea8a72c03c416681e14f7744393790b1" } -craft-print = { version = "0.1.0", git = "https://github.com/aiongg/craft-libs", rev = "3ad64a26ea8a72c03c416681e14f7744393790b1", features = ["ui"] } +craft-behavior = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f" } +craft-host = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f" } +craft-keymap = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f" } +craft-theme = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f" } +craft-print = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", features = ["ui"] } [workspace.lints.rust] unsafe_code = "forbid" diff --git a/apps/gridcraft-web/Cargo.toml b/apps/gridcraft-web/Cargo.toml index f2aa0e548f..22f879dfdc 100644 --- a/apps/gridcraft-web/Cargo.toml +++ b/apps/gridcraft-web/Cargo.toml @@ -18,8 +18,8 @@ gridcraft-engine = { workspace = true } gridcraft-ui-egui = { workspace = true } # The host messages (storytold/craft-libs): one contract and one bridge for the web builds. # The page command API (storytold/craft-libs#413): window.gridcraft over the control channel. -craft-web-api = { git = "https://github.com/aiongg/craft-libs", rev = "3ad64a26ea8a72c03c416681e14f7744393790b1", version = "0.1.0" } -craft-web-host = { git = "https://github.com/aiongg/craft-libs", rev = "3ad64a26ea8a72c03c416681e14f7744393790b1", version = "0.1.0" } +craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "0.1.0" } +craft-web-host = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "0.1.0" } egui = { workspace = true } log = { workspace = true } serde_json = { workspace = true } diff --git a/crates/ui-egui/Cargo.toml b/crates/ui-egui/Cargo.toml index 42e637df10..9bf606ecab 100644 --- a/crates/ui-egui/Cargo.toml +++ b/crates/ui-egui/Cargo.toml @@ -11,7 +11,7 @@ workspace = true [dependencies] # The UI runtime that hosts this egui UI (`src/framework.rs`) and the framework dialogs, from the # one craft-libs revision every craft-libs dependency uses (see the root Cargo.toml). -craft-ui = { git = "https://github.com/aiongg/craft-libs", rev = "3ad64a26ea8a72c03c416681e14f7744393790b1" } +craft-ui = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f" } craft-behavior = { workspace = true } craft-host = { workspace = true } craft-keymap = { workspace = true } From c2c9e2bc52af91e0d8cdc91813e93bced28e664b Mon Sep 17 00:00:00 2001 From: aiongg Date: Wed, 25 Nov 2026 06:32:47 +0000 Subject: [PATCH 79/94] Repin egui to storytold b15ffe9bfc (what craft-libs next pins) --- Cargo.lock | 28 ++++++++++++++-------------- Cargo.toml | 28 ++++++++++++++-------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a6f39a1f9f..89e57014b1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2033,7 +2033,7 @@ checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" [[package]] name = "ecolor" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560" +source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" dependencies = [ "bytemuck", "emath", @@ -2042,7 +2042,7 @@ dependencies = [ [[package]] name = "eframe" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560" +source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" dependencies = [ "ahash", "bytemuck", @@ -2077,7 +2077,7 @@ dependencies = [ [[package]] name = "egui" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560" +source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" dependencies = [ "accesskit", "ahash", @@ -2096,7 +2096,7 @@ dependencies = [ [[package]] name = "egui-wgpu" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560" +source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" dependencies = [ "ahash", "bytemuck", @@ -2115,7 +2115,7 @@ dependencies = [ [[package]] name = "egui-winit" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560" +source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" dependencies = [ "accesskit_winit", "arboard", @@ -2140,7 +2140,7 @@ dependencies = [ [[package]] name = "egui_extras" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560" +source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" dependencies = [ "ahash", "egui", @@ -2153,7 +2153,7 @@ dependencies = [ [[package]] name = "egui_glow" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560" +source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" dependencies = [ "bytemuck", "egui", @@ -2166,7 +2166,7 @@ dependencies = [ [[package]] name = "egui_kittest" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560" +source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" dependencies = [ "dify", "eframe", @@ -2192,7 +2192,7 @@ checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" [[package]] name = "emath" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560" +source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" dependencies = [ "bytemuck", ] @@ -2273,7 +2273,7 @@ dependencies = [ [[package]] name = "epaint" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560" +source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" dependencies = [ "ahash", "bytemuck", @@ -2299,7 +2299,7 @@ dependencies = [ [[package]] name = "epaint_default_fonts" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560" +source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" [[package]] name = "equivalent" @@ -8604,14 +8604,14 @@ dependencies = [ [[patch.unused]] name = "egui_demo_lib" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560" +source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" [[patch.unused]] name = "egui_inspection" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560" +source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" [[patch.unused]] name = "egui_system_font_provider" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=f5025284445ea19c35f746d96fc0b75468b3f560#f5025284445ea19c35f746d96fc0b75468b3f560" +source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" diff --git a/Cargo.toml b/Cargo.toml index 091b4c436c..58ee311cc8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -128,18 +128,18 @@ debug = 0 # Keep the complete egui family and native event bridge on reviewed fork commits. [patch.crates-io] -ecolor = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" } -emath = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" } -epaint = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" } -epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" } -egui = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" } -egui-winit = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" } -egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" } -egui_glow = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" } -egui_extras = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" } -egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" } -egui_system_font_provider = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" } -eframe = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" } -egui_demo_lib = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" } -egui_inspection = { git = "https://github.com/storytold/egui.git", rev = "f5025284445ea19c35f746d96fc0b75468b3f560" } +ecolor = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } +emath = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } +epaint = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } +epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } +egui = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } +egui-winit = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } +egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } +egui_glow = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } +egui_extras = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } +egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } +egui_system_font_provider = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } +eframe = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } +egui_demo_lib = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } +egui_inspection = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } winit = { git = "https://github.com/storytold/winit.git", rev = "a517b3846ee8457d84ee4975110bfda6797c44dc" } From 4f7a511b9f00056ce8f5c104335c9547d84610c3 Mon Sep 17 00:00:00 2001 From: aiongg Date: Wed, 25 Nov 2026 07:28:30 +0000 Subject: [PATCH 80/94] Print page: widen the settings column so craft-print's Copies row does not wrap --- crates/ui-egui/src/backstage/print.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ui-egui/src/backstage/print.rs b/crates/ui-egui/src/backstage/print.rs index de793b86ac..24178dba8a 100644 --- a/crates/ui-egui/src/backstage/print.rs +++ b/crates/ui-egui/src/backstage/print.rs @@ -22,7 +22,7 @@ pub(super) fn print(app: &mut SheetApp, ui: &mut Ui, bs: &mut Backstage, out: &m let pages: Vec = bs.preview.as_ref().and_then(|(_, p)| p.get("pageList")).and_then(Json::as_array).cloned().unwrap_or_default(); ui.horizontal_top(|ui| { ui.vertical(|ui| { - ui.set_width(250.0); + ui.set_width(340.0); if let Some(discover) = &app.services.printers { crate::printing::show(&mut app.printing, ui, discover, |label| lang.tr(label).to_owned()); } From 643b52cb2925a15272b0b6841dfb67770c7e59a5 Mon Sep 17 00:00:00 2001 From: aiongg Date: Wed, 25 Nov 2026 13:43:38 +0000 Subject: [PATCH 81/94] Repin craft-libs to storytold next d1bdf8e5da --- Cargo.lock | 98 +++++++++++++++++------------------ Cargo.toml | 42 +++++++-------- apps/gridcraft-web/Cargo.toml | 4 +- crates/ui-egui/Cargo.toml | 2 +- 4 files changed, 73 insertions(+), 73 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 53def46152..5d6fe71ca5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1034,7 +1034,7 @@ dependencies = [ [[package]] name = "craft-appkit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "block2 0.6.2", "objc2-app-kit 0.3.2", @@ -1044,7 +1044,7 @@ dependencies = [ [[package]] name = "craft-atomic" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "rustix 1.1.6", ] @@ -1052,7 +1052,7 @@ dependencies = [ [[package]] name = "craft-behavior" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "accesskit", "bitflags 2.13.2", @@ -1070,12 +1070,12 @@ dependencies = [ [[package]] name = "craft-cfb" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" [[package]] name = "craft-cloud-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "egui", ] @@ -1083,12 +1083,12 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" [[package]] name = "craft-csv" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "thiserror 2.0.21", ] @@ -1096,7 +1096,7 @@ dependencies = [ [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "serde", ] @@ -1104,7 +1104,7 @@ dependencies = [ [[package]] name = "craft-drawingml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "chrono", "craft-xml", @@ -1116,7 +1116,7 @@ dependencies = [ [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "harfrust 0.13.3", "kurbo", @@ -1130,12 +1130,12 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" [[package]] name = "craft-gridcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "serde", "serde_json", @@ -1145,7 +1145,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "bitflags 2.13.2", "craft-i18n", @@ -1158,7 +1158,7 @@ dependencies = [ [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "chrono", "fixed_decimal", @@ -1186,7 +1186,7 @@ dependencies = [ [[package]] name = "craft-keymap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "craft-host", "craft-i18n", @@ -1201,7 +1201,7 @@ dependencies = [ [[package]] name = "craft-math" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "craft-xml", "roxmltree", @@ -1211,7 +1211,7 @@ dependencies = [ [[package]] name = "craft-mcp-server" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "serde_json", ] @@ -1219,7 +1219,7 @@ dependencies = [ [[package]] name = "craft-odf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "aes", "base64 0.23.1", @@ -1237,7 +1237,7 @@ dependencies = [ [[package]] name = "craft-ods" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "craft-odf", "craft-sheet", @@ -1248,7 +1248,7 @@ dependencies = [ [[package]] name = "craft-offcrypto" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "aes", "base64 0.23.1", @@ -1265,7 +1265,7 @@ dependencies = [ [[package]] name = "craft-opc" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "craft-xml", "craft-zip", @@ -1276,7 +1276,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "serde", ] @@ -1284,7 +1284,7 @@ dependencies = [ [[package]] name = "craft-platform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "async-channel", "async-io", @@ -1315,7 +1315,7 @@ dependencies = [ [[package]] name = "craft-print" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "craft-behavior", "craft-host", @@ -1339,7 +1339,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "dispatch2", "objc2 0.6.5", @@ -1351,7 +1351,7 @@ dependencies = [ [[package]] name = "craft-settings" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "craft-atomic", "craft-host", @@ -1368,12 +1368,12 @@ dependencies = [ [[package]] name = "craft-sheet" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" [[package]] name = "craft-stream-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "fax", "hayro-ccitt", @@ -1384,7 +1384,7 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "craft-xml", "flate2", @@ -1401,7 +1401,7 @@ dependencies = [ [[package]] name = "craft-theme" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "bitflags 2.13.2", "craft-tracked", @@ -1416,12 +1416,12 @@ dependencies = [ [[package]] name = "craft-tracked" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "craft-cloud-ui", "craft-ui-canvas", @@ -1435,7 +1435,7 @@ dependencies = [ [[package]] name = "craft-ui-canvas" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "craft-behavior", "craft-i18n", @@ -1451,7 +1451,7 @@ dependencies = [ [[package]] name = "craft-ui-contract" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "accesskit", "craft-behavior", @@ -1489,7 +1489,7 @@ dependencies = [ [[package]] name = "craft-ui-macros" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1500,7 +1500,7 @@ dependencies = [ [[package]] name = "craft-ui-panels" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "craft-behavior", "craft-host", @@ -1518,7 +1518,7 @@ dependencies = [ [[package]] name = "craft-ui-patterns" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "craft-behavior", "craft-host", @@ -1539,7 +1539,7 @@ dependencies = [ [[package]] name = "craft-ui-shell" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "craft-behavior", "craft-host", @@ -1559,7 +1559,7 @@ dependencies = [ [[package]] name = "craft-ui-widgets" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "craft-behavior", "craft-host", @@ -1578,7 +1578,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "chrono", "craft-host", @@ -1607,7 +1607,7 @@ dependencies = [ [[package]] name = "craft-web-api" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "js-sys", "serde_json", @@ -1618,7 +1618,7 @@ dependencies = [ [[package]] name = "craft-web-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "craft-host", "craft-platform", @@ -1630,7 +1630,7 @@ dependencies = [ [[package]] name = "craft-win32" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "winsafe", ] @@ -1638,7 +1638,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "craft-appkit", "craft-atomic", @@ -1670,7 +1670,7 @@ dependencies = [ [[package]] name = "craft-xls" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "craft-cfb", "craft-sheet", @@ -1683,7 +1683,7 @@ dependencies = [ [[package]] name = "craft-xlsx" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "craft-drawingml", "craft-opc", @@ -1695,7 +1695,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "quick-xml 0.41.0", "serde", @@ -1705,7 +1705,7 @@ dependencies = [ [[package]] name = "craft-zip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "flate2", "thiserror 2.0.21", @@ -3211,7 +3211,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=16001e7210bee61db60c84fbe18c3c3e2ef4584f#16001e7210bee61db60c84fbe18c3c3e2ef4584f" +source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" dependencies = [ "hayro-ccitt", ] diff --git a/Cargo.toml b/Cargo.toml index 58ee311cc8..995d01157e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,29 +30,29 @@ gridcraft-math = { path = "crates/math" } # ui-egui, craft-print in the app, craft-web-api and craft-web-host in the web app) comes from one # craft-libs revision. # craft-update: app-specific pretend versions apply to startup and manual checks. -craft-update = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "=0.1.0", features = ["ui"] } +craft-update = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "=0.1.0", features = ["ui"] } # PDF RunLength encoding; this revision also fixes the vendored JBIG2 dependency for Git consumers. -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "0.1.0", default-features = false } -craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "0.1.0" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "0.1.0", default-features = false } +craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "0.1.0" } # Compound files ([MS-CFB]) and password-encrypted OOXML packages ([MS-OFFCRYPTO]). -craft-cfb = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "0.1.0" } -craft-offcrypto = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "0.1.0" } -craft-ods = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "0.1.0" } +craft-cfb = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "0.1.0" } +craft-offcrypto = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "0.1.0" } +craft-ods = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "0.1.0" } # OPC zip packages (parts, relationships, the zip writer) under `crates/xlsx/src/package.rs`. -craft-opc = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "0.1.0" } +craft-opc = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "0.1.0" } # Delimited text (CSV, TSV) and SYLK; `crates/xlsx/src/csv.rs` and `crates/engine/src/io/sylk.rs` # turn them into workbooks. -craft-csv = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "0.1.0" } -craft-math = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "0.1.0" } +craft-csv = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "0.1.0" } +craft-math = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "0.1.0" } # The native JSON workbook (`.json`, `.scjson`): read, written, and kept newer macros written back. -craft-gridcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "0.1.0" } +craft-gridcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "0.1.0" } # Excel 97-2003 (.xls, BIFF8) workbooks; `crates/xlsx/src/xls.rs` maps them onto the model. # SpreadsheetML worksheet/drawing/string/package XML; workbook model mapping stays in gridcraft-xlsx. -craft-xlsx = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "0.1.0" } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "0.1.0" } -craft-xls = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "0.1.0" } -craft-drawingml = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "0.1.0" } -craft-mcp-server = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "=0.1.0" } +craft-xlsx = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "0.1.0" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "0.1.0" } +craft-xls = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "0.1.0" } +craft-drawingml = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "0.1.0" } +craft-mcp-server = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "=0.1.0" } # foundation thiserror = "2" @@ -92,15 +92,15 @@ skrifa = { version = "0.44", default-features = false, features = ["std"] } epaint_default_fonts = "0.37" # One native window per workbook: the window list, Window menu titles and the immediate-viewport # driver. Same craft-libs revision as craft-update above. -craft-window = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", default-features = false, features = ["ui"] } +craft-window = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", default-features = false, features = ["ui"] } # The UI runtime GridCraft's egui UI is hosted by (`crates/ui-egui/src/framework.rs`): who the app is # to the framework's dialogs, the runtime's key bindings, the theme mode, window placement and the # printer controls. Same craft-libs revision as above. -craft-behavior = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f" } -craft-host = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f" } -craft-keymap = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f" } -craft-theme = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f" } -craft-print = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", features = ["ui"] } +craft-behavior = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" } +craft-host = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" } +craft-keymap = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" } +craft-theme = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" } +craft-print = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", features = ["ui"] } [workspace.lints.rust] unsafe_code = "forbid" diff --git a/apps/gridcraft-web/Cargo.toml b/apps/gridcraft-web/Cargo.toml index 22f879dfdc..03d37a8ab7 100644 --- a/apps/gridcraft-web/Cargo.toml +++ b/apps/gridcraft-web/Cargo.toml @@ -18,8 +18,8 @@ gridcraft-engine = { workspace = true } gridcraft-ui-egui = { workspace = true } # The host messages (storytold/craft-libs): one contract and one bridge for the web builds. # The page command API (storytold/craft-libs#413): window.gridcraft over the control channel. -craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "0.1.0" } -craft-web-host = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f", version = "0.1.0" } +craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "0.1.0" } +craft-web-host = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "0.1.0" } egui = { workspace = true } log = { workspace = true } serde_json = { workspace = true } diff --git a/crates/ui-egui/Cargo.toml b/crates/ui-egui/Cargo.toml index 9bf606ecab..9b0ee9b6b8 100644 --- a/crates/ui-egui/Cargo.toml +++ b/crates/ui-egui/Cargo.toml @@ -11,7 +11,7 @@ workspace = true [dependencies] # The UI runtime that hosts this egui UI (`src/framework.rs`) and the framework dialogs, from the # one craft-libs revision every craft-libs dependency uses (see the root Cargo.toml). -craft-ui = { git = "https://github.com/storytold/craft-libs", rev = "16001e7210bee61db60c84fbe18c3c3e2ef4584f" } +craft-ui = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" } craft-behavior = { workspace = true } craft-host = { workspace = true } craft-keymap = { workspace = true } From 3e43b2bce2eead65b3d30270590513925a9921f1 Mon Sep 17 00:00:00 2001 From: aiongg Date: Wed, 25 Nov 2026 15:48:35 +0000 Subject: [PATCH 82/94] Repin craft-libs to storytold next aa401985d --- Cargo.lock | 98 +++++++++++++++++------------------ Cargo.toml | 42 +++++++-------- apps/gridcraft-web/Cargo.toml | 4 +- crates/ui-egui/Cargo.toml | 2 +- 4 files changed, 73 insertions(+), 73 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5d6fe71ca5..890550d893 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1034,7 +1034,7 @@ dependencies = [ [[package]] name = "craft-appkit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "block2 0.6.2", "objc2-app-kit 0.3.2", @@ -1044,7 +1044,7 @@ dependencies = [ [[package]] name = "craft-atomic" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "rustix 1.1.6", ] @@ -1052,7 +1052,7 @@ dependencies = [ [[package]] name = "craft-behavior" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "accesskit", "bitflags 2.13.2", @@ -1070,12 +1070,12 @@ dependencies = [ [[package]] name = "craft-cfb" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" [[package]] name = "craft-cloud-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "egui", ] @@ -1083,12 +1083,12 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" [[package]] name = "craft-csv" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "thiserror 2.0.21", ] @@ -1096,7 +1096,7 @@ dependencies = [ [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "serde", ] @@ -1104,7 +1104,7 @@ dependencies = [ [[package]] name = "craft-drawingml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "chrono", "craft-xml", @@ -1116,7 +1116,7 @@ dependencies = [ [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "harfrust 0.13.3", "kurbo", @@ -1130,12 +1130,12 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" [[package]] name = "craft-gridcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "serde", "serde_json", @@ -1145,7 +1145,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "bitflags 2.13.2", "craft-i18n", @@ -1158,7 +1158,7 @@ dependencies = [ [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "chrono", "fixed_decimal", @@ -1186,7 +1186,7 @@ dependencies = [ [[package]] name = "craft-keymap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "craft-host", "craft-i18n", @@ -1201,7 +1201,7 @@ dependencies = [ [[package]] name = "craft-math" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "craft-xml", "roxmltree", @@ -1211,7 +1211,7 @@ dependencies = [ [[package]] name = "craft-mcp-server" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "serde_json", ] @@ -1219,7 +1219,7 @@ dependencies = [ [[package]] name = "craft-odf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "aes", "base64 0.23.1", @@ -1237,7 +1237,7 @@ dependencies = [ [[package]] name = "craft-ods" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "craft-odf", "craft-sheet", @@ -1248,7 +1248,7 @@ dependencies = [ [[package]] name = "craft-offcrypto" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "aes", "base64 0.23.1", @@ -1265,7 +1265,7 @@ dependencies = [ [[package]] name = "craft-opc" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "craft-xml", "craft-zip", @@ -1276,7 +1276,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "serde", ] @@ -1284,7 +1284,7 @@ dependencies = [ [[package]] name = "craft-platform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "async-channel", "async-io", @@ -1315,7 +1315,7 @@ dependencies = [ [[package]] name = "craft-print" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "craft-behavior", "craft-host", @@ -1339,7 +1339,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "dispatch2", "objc2 0.6.5", @@ -1351,7 +1351,7 @@ dependencies = [ [[package]] name = "craft-settings" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "craft-atomic", "craft-host", @@ -1368,12 +1368,12 @@ dependencies = [ [[package]] name = "craft-sheet" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" [[package]] name = "craft-stream-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "fax", "hayro-ccitt", @@ -1384,7 +1384,7 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "craft-xml", "flate2", @@ -1401,7 +1401,7 @@ dependencies = [ [[package]] name = "craft-theme" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "bitflags 2.13.2", "craft-tracked", @@ -1416,12 +1416,12 @@ dependencies = [ [[package]] name = "craft-tracked" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "craft-cloud-ui", "craft-ui-canvas", @@ -1435,7 +1435,7 @@ dependencies = [ [[package]] name = "craft-ui-canvas" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "craft-behavior", "craft-i18n", @@ -1451,7 +1451,7 @@ dependencies = [ [[package]] name = "craft-ui-contract" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "accesskit", "craft-behavior", @@ -1489,7 +1489,7 @@ dependencies = [ [[package]] name = "craft-ui-macros" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1500,7 +1500,7 @@ dependencies = [ [[package]] name = "craft-ui-panels" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "craft-behavior", "craft-host", @@ -1518,7 +1518,7 @@ dependencies = [ [[package]] name = "craft-ui-patterns" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "craft-behavior", "craft-host", @@ -1539,7 +1539,7 @@ dependencies = [ [[package]] name = "craft-ui-shell" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "craft-behavior", "craft-host", @@ -1559,7 +1559,7 @@ dependencies = [ [[package]] name = "craft-ui-widgets" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "craft-behavior", "craft-host", @@ -1578,7 +1578,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "chrono", "craft-host", @@ -1607,7 +1607,7 @@ dependencies = [ [[package]] name = "craft-web-api" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "js-sys", "serde_json", @@ -1618,7 +1618,7 @@ dependencies = [ [[package]] name = "craft-web-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "craft-host", "craft-platform", @@ -1630,7 +1630,7 @@ dependencies = [ [[package]] name = "craft-win32" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "winsafe", ] @@ -1638,7 +1638,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "craft-appkit", "craft-atomic", @@ -1670,7 +1670,7 @@ dependencies = [ [[package]] name = "craft-xls" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "craft-cfb", "craft-sheet", @@ -1683,7 +1683,7 @@ dependencies = [ [[package]] name = "craft-xlsx" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "craft-drawingml", "craft-opc", @@ -1695,7 +1695,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "quick-xml 0.41.0", "serde", @@ -1705,7 +1705,7 @@ dependencies = [ [[package]] name = "craft-zip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "flate2", "thiserror 2.0.21", @@ -3211,7 +3211,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e#d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" +source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" dependencies = [ "hayro-ccitt", ] diff --git a/Cargo.toml b/Cargo.toml index 995d01157e..5c72248170 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,29 +30,29 @@ gridcraft-math = { path = "crates/math" } # ui-egui, craft-print in the app, craft-web-api and craft-web-host in the web app) comes from one # craft-libs revision. # craft-update: app-specific pretend versions apply to startup and manual checks. -craft-update = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "=0.1.0", features = ["ui"] } +craft-update = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "=0.1.0", features = ["ui"] } # PDF RunLength encoding; this revision also fixes the vendored JBIG2 dependency for Git consumers. -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "0.1.0", default-features = false } -craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "0.1.0" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "0.1.0", default-features = false } +craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "0.1.0" } # Compound files ([MS-CFB]) and password-encrypted OOXML packages ([MS-OFFCRYPTO]). -craft-cfb = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "0.1.0" } -craft-offcrypto = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "0.1.0" } -craft-ods = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "0.1.0" } +craft-cfb = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "0.1.0" } +craft-offcrypto = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "0.1.0" } +craft-ods = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "0.1.0" } # OPC zip packages (parts, relationships, the zip writer) under `crates/xlsx/src/package.rs`. -craft-opc = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "0.1.0" } +craft-opc = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "0.1.0" } # Delimited text (CSV, TSV) and SYLK; `crates/xlsx/src/csv.rs` and `crates/engine/src/io/sylk.rs` # turn them into workbooks. -craft-csv = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "0.1.0" } -craft-math = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "0.1.0" } +craft-csv = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "0.1.0" } +craft-math = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "0.1.0" } # The native JSON workbook (`.json`, `.scjson`): read, written, and kept newer macros written back. -craft-gridcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "0.1.0" } +craft-gridcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "0.1.0" } # Excel 97-2003 (.xls, BIFF8) workbooks; `crates/xlsx/src/xls.rs` maps them onto the model. # SpreadsheetML worksheet/drawing/string/package XML; workbook model mapping stays in gridcraft-xlsx. -craft-xlsx = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "0.1.0" } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "0.1.0" } -craft-xls = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "0.1.0" } -craft-drawingml = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "0.1.0" } -craft-mcp-server = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "=0.1.0" } +craft-xlsx = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "0.1.0" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "0.1.0" } +craft-xls = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "0.1.0" } +craft-drawingml = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "0.1.0" } +craft-mcp-server = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "=0.1.0" } # foundation thiserror = "2" @@ -92,15 +92,15 @@ skrifa = { version = "0.44", default-features = false, features = ["std"] } epaint_default_fonts = "0.37" # One native window per workbook: the window list, Window menu titles and the immediate-viewport # driver. Same craft-libs revision as craft-update above. -craft-window = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", default-features = false, features = ["ui"] } +craft-window = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", default-features = false, features = ["ui"] } # The UI runtime GridCraft's egui UI is hosted by (`crates/ui-egui/src/framework.rs`): who the app is # to the framework's dialogs, the runtime's key bindings, the theme mode, window placement and the # printer controls. Same craft-libs revision as above. -craft-behavior = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" } -craft-host = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" } -craft-keymap = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" } -craft-theme = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" } -craft-print = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", features = ["ui"] } +craft-behavior = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" } +craft-host = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" } +craft-keymap = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" } +craft-theme = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" } +craft-print = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", features = ["ui"] } [workspace.lints.rust] unsafe_code = "forbid" diff --git a/apps/gridcraft-web/Cargo.toml b/apps/gridcraft-web/Cargo.toml index 03d37a8ab7..db990721c4 100644 --- a/apps/gridcraft-web/Cargo.toml +++ b/apps/gridcraft-web/Cargo.toml @@ -18,8 +18,8 @@ gridcraft-engine = { workspace = true } gridcraft-ui-egui = { workspace = true } # The host messages (storytold/craft-libs): one contract and one bridge for the web builds. # The page command API (storytold/craft-libs#413): window.gridcraft over the control channel. -craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "0.1.0" } -craft-web-host = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e", version = "0.1.0" } +craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "0.1.0" } +craft-web-host = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "0.1.0" } egui = { workspace = true } log = { workspace = true } serde_json = { workspace = true } diff --git a/crates/ui-egui/Cargo.toml b/crates/ui-egui/Cargo.toml index 9b0ee9b6b8..d20832a04e 100644 --- a/crates/ui-egui/Cargo.toml +++ b/crates/ui-egui/Cargo.toml @@ -11,7 +11,7 @@ workspace = true [dependencies] # The UI runtime that hosts this egui UI (`src/framework.rs`) and the framework dialogs, from the # one craft-libs revision every craft-libs dependency uses (see the root Cargo.toml). -craft-ui = { git = "https://github.com/storytold/craft-libs", rev = "d1bdf8e5dac7513e4fbc4dab16edaaeda5ebcf5e" } +craft-ui = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" } craft-behavior = { workspace = true } craft-host = { workspace = true } craft-keymap = { workspace = true } From 5682daedc17c1da0a34940a1747f851418b0a41b Mon Sep 17 00:00:00 2001 From: vangel76 Date: Wed, 25 Nov 2026 18:52:35 +0100 Subject: [PATCH 83/94] Remove Quick Analysis translations from the GridCraft locale files Keep English keys only; the translations move to a craft-i18n PR (AGENTS.md rule 16). --- crates/ui-egui/src/i18n/cs.rs | 24 ------------------------ crates/ui-egui/src/i18n/de.rs | 25 ------------------------- crates/ui-egui/src/i18n/es.rs | 25 ------------------------- crates/ui-egui/src/i18n/fr.rs | 25 ------------------------- crates/ui-egui/src/i18n/ja.rs | 25 +++++-------------------- crates/ui-egui/src/i18n/ko.rs | 25 ------------------------- crates/ui-egui/src/i18n/pt.rs | 20 -------------------- crates/ui-egui/src/i18n/ru.rs | 20 -------------------- crates/ui-egui/src/i18n/sr.rs | 25 ------------------------- crates/ui-egui/src/i18n/zh.rs | 25 ------------------------- 10 files changed, 5 insertions(+), 234 deletions(-) diff --git a/crates/ui-egui/src/i18n/cs.rs b/crates/ui-egui/src/i18n/cs.rs index 1f52b12bb0..a7464598a3 100644 --- a/crates/ui-egui/src/i18n/cs.rs +++ b/crates/ui-egui/src/i18n/cs.rs @@ -579,30 +579,6 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "Zoom Out" => "Oddálit", // widgets.rs (alphabetical keys). "Dismiss" => "Zavřít", - "Quick Analysis (Ctrl+Q)" => "Rychlá analýza (Ctrl+Q)", - "Formatting" => "Formátování", - "Charts" => "Grafy", - "Totals" => "Součty", - "Tables" => "Tabulky", - "Color Scale" => "Barevná škála", - "Icon Set" => "Sada ikon", - "Greater Than…" => "Větší než…", - "Clear Rules" => "Vymazat pravidla", - "Clustered Column" => "Skupinový sloupcový", - "Line" => "Spojnicový", - "Pie" => "Výsečový", - "Bar" => "Pruhový", - "Scatter" => "Bodový", - "% Total" => "% z celku", - "Running Total" => "Průběžný součet", - "By Column" => "Podle sloupců", - "By Row" => "Podle řádků", - "Column" => "Sloupec", - "Win/Loss" => "Zisk/ztráta", - "Green Data Bars" => "Zelené datové čáry", - "Blue-White-Red Scale" => "Škála modrá-bílá-červená", - "White-Green Scale" => "Škála bílá-zelená", - "Duplicate Values" => "Duplicitní hodnoty", "Rename" => "Přejmenovat", "Move or Copy…" => "Přesunout nebo kopírovat…", "Duplicate" => "Duplikovat", diff --git a/crates/ui-egui/src/i18n/de.rs b/crates/ui-egui/src/i18n/de.rs index 54cd5dcc0e..300cc4969a 100644 --- a/crates/ui-egui/src/i18n/de.rs +++ b/crates/ui-egui/src/i18n/de.rs @@ -478,31 +478,6 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "Dark" => "Dunkel", "Sheet Options|View" => "Anzeige", "Print" => "Drucken", - "Quick Analysis (Ctrl+Q)" => "Schnellanalyse (Strg+Q)", - "Formatting" => "Formatierung", - "Charts" => "Diagramme", - "Totals" => "Ergebnisse", - "Tables" => "Tabellen", - "Color Scale" => "Farbskala", - "Icon Set" => "Symbolsatz", - "Greater Than…" => "Größer als…", - "Clear Rules" => "Regeln löschen", - "Clustered Column" => "Gruppierte Säulen", - "Line" => "Linie", - "Pie" => "Kreis", - "Bar" => "Balken", - "Scatter" => "Punkt (XY)", - "Recommended Charts" => "Empfohlene Diagramme", - "% Total" => "% des Gesamtergebnisses", - "Running Total" => "Laufende Summe", - "By Column" => "Nach Spalte", - "By Row" => "Nach Zeile", - "Column" => "Säule", - "Win/Loss" => "Gewinn/Verlust", - "Green Data Bars" => "Grüne Datenbalken", - "Blue-White-Red Scale" => "Blau-Weiß-Rot-Skala", - "White-Green Scale" => "Weiß-Grün-Skala", - "Duplicate Values" => "Doppelte Werte", "Print What" => "Was drucken", // grid.rs cell and row/column header context menus. "Cut" => "Ausschneiden", diff --git a/crates/ui-egui/src/i18n/es.rs b/crates/ui-egui/src/i18n/es.rs index 0f6c924616..d0df42c8b2 100644 --- a/crates/ui-egui/src/i18n/es.rs +++ b/crates/ui-egui/src/i18n/es.rs @@ -496,31 +496,6 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "Compact" => "Compacto", "Outline" => "Esquema", "Tabular" => "Tabular", - "Quick Analysis (Ctrl+Q)" => "Análisis rápido (Ctrl+Q)", - "Formatting" => "Formato", - "Charts" => "Gráficos", - "Totals" => "Totales", - "Tables" => "Tablas", - "Color Scale" => "Escala de color", - "Icon Set" => "Conjunto de iconos", - "Greater Than…" => "Mayor que…", - "Clear Rules" => "Borrar reglas", - "Clustered Column" => "Columna agrupada", - "Line" => "Línea", - "Pie" => "Circular", - "Bar" => "Barras", - "Scatter" => "Dispersión", - "Recommended Charts" => "Gráficos recomendados", - "% Total" => "% del total", - "Running Total" => "Total acumulado", - "By Column" => "Por columna", - "By Row" => "Por fila", - "Column" => "Columna", - "Win/Loss" => "Ganancia/pérdida", - "Green Data Bars" => "Barras de datos verdes", - "Blue-White-Red Scale" => "Escala azul-blanco-rojo", - "White-Green Scale" => "Escala blanco-verde", - "Duplicate Values" => "Valores duplicados", "Insert Sheet" => "Insertar hoja", "Rename" => "Cambiar nombre", "Move or Copy…" => "Mover o copiar…", diff --git a/crates/ui-egui/src/i18n/fr.rs b/crates/ui-egui/src/i18n/fr.rs index c533b3ef43..104edcd161 100644 --- a/crates/ui-egui/src/i18n/fr.rs +++ b/crates/ui-egui/src/i18n/fr.rs @@ -456,31 +456,6 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { } "Maximum Change must be a number of 0 or more." => "L'écart maximal doit être un nombre supérieur ou égal à 0.", "Calculation settings are saved with the workbook." => "Les paramètres de calcul sont enregistrés avec le classeur.", - "Quick Analysis (Ctrl+Q)" => "Analyse rapide (Ctrl+Q)", - "Formatting" => "Mise en forme", - "Charts" => "Graphiques", - "Totals" => "Totaux", - "Tables" => "Tableaux", - "Color Scale" => "Échelle de couleurs", - "Icon Set" => "Jeu d'icônes", - "Greater Than…" => "Supérieur à…", - "Clear Rules" => "Effacer les règles", - "Clustered Column" => "Histogramme groupé", - "Line" => "Courbe", - "Pie" => "Secteurs", - "Bar" => "Barres", - "Scatter" => "Nuage de points", - "Recommended Charts" => "Graphiques recommandés", - "% Total" => "% du total", - "Running Total" => "Total cumulé", - "By Column" => "Par colonne", - "By Row" => "Par ligne", - "Column" => "Colonne", - "Win/Loss" => "Gain/perte", - "Green Data Bars" => "Barres de données vertes", - "Blue-White-Red Scale" => "Échelle bleu-blanc-rouge", - "White-Green Scale" => "Échelle blanc-vert", - "Duplicate Values" => "Valeurs en double", "Insert Sheet" => "Insérer une feuille", "Rename" => "Renommer", "Move or Copy…" => "Déplacer ou copier…", diff --git a/crates/ui-egui/src/i18n/ja.rs b/crates/ui-egui/src/i18n/ja.rs index a26845dea1..f5d9baa2ac 100644 --- a/crates/ui-egui/src/i18n/ja.rs +++ b/crates/ui-egui/src/i18n/ja.rs @@ -1034,26 +1034,6 @@ pub(super) const DIALOGS: &[(&str, &str)] = &[ ("Tab Color", "シートの見出しの色"), ("Unhide…", "再表示…"), ("Unprotect Sheet…", "シート保護の解除…"), - ("Quick Analysis (Ctrl+Q)", "クイック分析 (Ctrl+Q)"), - ("Formatting", "書式設定"), - ("Charts", "グラフ"), - ("Totals", "集計"), - ("Tables", "テーブル"), - ("Color Scale", "カラー スケール"), - ("Icon Set", "アイコン セット"), - ("Greater Than…", "指定の値より大きい…"), - ("Clear Rules", "ルールのクリア"), - ("Bar", "横棒"), - ("% Total", "合計に対する割合"), - ("Running Total", "累計"), - ("By Column", "列ごと"), - ("By Row", "行ごと"), - ("Column", "縦棒"), - ("Win/Loss", "勝敗"), - ("Green Data Bars", "緑のデータ バー"), - ("Blue-White-Red Scale", "青-白-赤のスケール"), - ("White-Green Scale", "白-緑のスケール"), - ("Duplicate Values", "重複する値"), ("Collapse dialog", "ダイアログを折りたたむ"), ("Expand dialog", "ダイアログを展開する"), ("Numerical Count", "数値の個数"), @@ -1203,6 +1183,7 @@ pub(super) const EXTRA: &[(&str, &str)] = &[ ("Theme Colors", "テーマの色"), ("Standard Colors", "標準の色"), ("Highlight Cells Rules", "セルの強調表示ルール"), + ("Greater Than…", "指定の値より大きい…"), ("Less Than…", "指定の値より小さい…"), ("Between…", "指定の範囲内…"), ("Equal To…", "指定の値に等しい…"), @@ -1229,6 +1210,7 @@ pub(super) const EXTRA: &[(&str, &str)] = &[ ("5 Arrows", "5 つの矢印"), ("5 Quarters", "5 つの四分円"), ("New Rule…", "新しいルール…"), + ("Clear Rules", "ルールのクリア"), ("Manage Rules…", "ルールの管理…"), ("Good, Bad and Neutral", "良い、悪い、どちらでもない"), ("Bad", "悪い"), @@ -1261,6 +1243,8 @@ pub(super) const EXTRA: &[(&str, &str)] = &[ ("Oval", "楕円"), ("Triangle", "三角形"), ("Arrow", "矢印"), + ("Column", "縦棒"), + ("Win/Loss", "勝敗"), ("Type to filter…", "入力して絞り込み…"), ("Sort Ascending", "昇順"), ("Sort Descending", "降順"), @@ -1299,6 +1283,7 @@ pub(super) const EXTRA: &[(&str, &str)] = &[ ("Treemap", "ツリーマップ"), ("Sunburst", "サンバースト"), ("Stock", "株価"), + ("Bar", "横棒"), ( "Drag to fill cells. Drag from inside a cell to select a range.", "ドラッグしてセルをオートフィルします。セルの内側からドラッグすると範囲を選択します。", diff --git a/crates/ui-egui/src/i18n/ko.rs b/crates/ui-egui/src/i18n/ko.rs index b7f1e8cc49..880f97ac84 100644 --- a/crates/ui-egui/src/i18n/ko.rs +++ b/crates/ui-egui/src/i18n/ko.rs @@ -462,31 +462,6 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "Maximum Iterations must be a whole number from 1 to 32767." => "최대 반복 횟수는 1에서 32767 사이의 정수여야 합니다.", "Maximum Change must be a number of 0 or more." => "변화 한도는 0 이상의 숫자여야 합니다.", "Calculation settings are saved with the workbook." => "계산 설정은 통합 문서와 함께 저장됩니다.", - "Quick Analysis (Ctrl+Q)" => "빠른 분석 (Ctrl+Q)", - "Formatting" => "서식", - "Charts" => "차트", - "Totals" => "합계", - "Tables" => "표", - "Color Scale" => "색 구성표", - "Icon Set" => "아이콘 집합", - "Greater Than…" => "보다 큼…", - "Clear Rules" => "규칙 지우기", - "Clustered Column" => "묶은 세로 막대형", - "Line" => "꺾은선형", - "Pie" => "원형", - "Bar" => "가로 막대형", - "Scatter" => "분산형", - "Recommended Charts" => "추천 차트", - "% Total" => "총합계 비율", - "Running Total" => "누계", - "By Column" => "열 기준", - "By Row" => "행 기준", - "Column" => "열", - "Win/Loss" => "이익/손실", - "Green Data Bars" => "녹색 데이터 막대", - "Blue-White-Red Scale" => "파랑-흰색-빨강 눈금", - "White-Green Scale" => "흰색-녹색 눈금", - "Duplicate Values" => "중복 값", "Insert Sheet" => "시트 삽입", "Rename" => "이름 바꾸기", "Move or Copy…" => "이동 또는 복사…", diff --git a/crates/ui-egui/src/i18n/pt.rs b/crates/ui-egui/src/i18n/pt.rs index 651b6fbec7..168450222f 100644 --- a/crates/ui-egui/src/i18n/pt.rs +++ b/crates/ui-egui/src/i18n/pt.rs @@ -1020,26 +1020,6 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "Protect\nSheet" => "Proteger\nPlanilha", "Watch\nWindow" => "Janela de\nInspeção", "Workbook\nStatistics" => "Estatísticas da\nPasta de Trabalho", - "Quick Analysis (Ctrl+Q)" => "Análise rápida (Ctrl+Q)", - "Formatting" => "Formatação", - "Charts" => "Gráficos", - "Totals" => "Totais", - "Tables" => "Tabelas", - "Color Scale" => "Escala de cor", - "Icon Set" => "Conjunto de ícones", - "Greater Than…" => "Maior que…", - "Clear Rules" => "Limpar regras", - "Bar" => "Barras", - "% Total" => "% do total", - "Running Total" => "Total acumulado", - "By Column" => "Por coluna", - "By Row" => "Por linha", - "Column" => "Coluna", - "Win/Loss" => "Ganho/perda", - "Green Data Bars" => "Barras de dados verdes", - "Blue-White-Red Scale" => "Escala azul-branco-vermelho", - "White-Green Scale" => "Escala branco-verde", - "Duplicate Values" => "Valores duplicados", "Rename" => "Renomear", "Move or Copy…" => "Mover ou copiar…", "Duplicate" => "Duplicar", diff --git a/crates/ui-egui/src/i18n/ru.rs b/crates/ui-egui/src/i18n/ru.rs index 7fcd028972..e2fd2ef3e9 100644 --- a/crates/ui-egui/src/i18n/ru.rs +++ b/crates/ui-egui/src/i18n/ru.rs @@ -461,26 +461,6 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "Maximum Iterations must be a whole number from 1 to 32767." => "Предельное число итераций должно быть целым числом от 1 до 32767.", "Maximum Change must be a number of 0 or more." => "Максимальное изменение должно быть числом не меньше 0.", "Calculation settings are saved with the workbook." => "Параметры вычислений сохраняются вместе с книгой.", - "Quick Analysis (Ctrl+Q)" => "Быстрый анализ (Ctrl+Q)", - "Formatting" => "Форматирование", - "Charts" => "Диаграммы", - "Totals" => "Итоги", - "Tables" => "Таблицы", - "Color Scale" => "Цветовая шкала", - "Icon Set" => "Набор значков", - "Greater Than…" => "Больше…", - "Clear Rules" => "Удалить правила", - "Bar" => "Линейчатая", - "% Total" => "% от итога", - "Running Total" => "Нарастающий итог", - "By Column" => "По столбцам", - "By Row" => "По строкам", - "Column" => "Столбец", - "Win/Loss" => "Выигрыш/проигрыш", - "Green Data Bars" => "Зелёные гистограммы", - "Blue-White-Red Scale" => "Шкала сине-бело-красная", - "White-Green Scale" => "Шкала бело-зелёная", - "Duplicate Values" => "Повторяющиеся значения", " (password)" => " (пароль)", " (password, unlocked)" => " (пароль, разблокировано)", "$ English (United States)" => "$ английский (США)", diff --git a/crates/ui-egui/src/i18n/sr.rs b/crates/ui-egui/src/i18n/sr.rs index e4dc96b824..4b65ab8be3 100644 --- a/crates/ui-egui/src/i18n/sr.rs +++ b/crates/ui-egui/src/i18n/sr.rs @@ -451,31 +451,6 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "Bottom Margin" => "Donja margina", "Header Margin" => "Margina zaglavlja", "Footer Margin" => "Margina podnožja", - "Quick Analysis (Ctrl+Q)" => "Brza analiza (Ctrl+Q)", - "Formatting" => "Formatiranje", - "Charts" => "Grafikoni", - "Totals" => "Ukupne vrednosti", - "Tables" => "Tabele", - "Color Scale" => "Skala boja", - "Icon Set" => "Skup ikona", - "Greater Than…" => "Veće od…", - "Clear Rules" => "Obriši pravila", - "Clustered Column" => "Grupisani stubičasti", - "Line" => "Linijski", - "Pie" => "Kružni", - "Bar" => "Trakasti", - "Scatter" => "Tačkasti", - "Recommended Charts" => "Preporučeni grafikoni", - "% Total" => "% od ukupnog", - "Running Total" => "Tekući zbir", - "By Column" => "Po kolonama", - "By Row" => "Po redovima", - "Column" => "Kolona", - "Win/Loss" => "Dobitak/gubitak", - "Green Data Bars" => "Zelene trake podataka", - "Blue-White-Red Scale" => "Skala plavo-belo-crveno", - "White-Green Scale" => "Skala belo-zeleno", - "Duplicate Values" => "Duplirane vrednosti", "Insert Sheet" => "Убаци лист", "Rename" => "Преименуј", "Move or Copy…" => "Премести или копирај…", diff --git a/crates/ui-egui/src/i18n/zh.rs b/crates/ui-egui/src/i18n/zh.rs index e7385cef69..b57d3292df 100644 --- a/crates/ui-egui/src/i18n/zh.rs +++ b/crates/ui-egui/src/i18n/zh.rs @@ -454,31 +454,6 @@ pub(super) fn translate(text: &str) -> Option<&'static str> { "Maximum Iterations must be a whole number from 1 to 32767." => "最多迭代次数必须是 1 到 32767 之间的整数。", "Maximum Change must be a number of 0 or more." => "最大误差必须是大于或等于 0 的数字。", "Calculation settings are saved with the workbook." => "计算设置随工作簿一起保存。", - "Quick Analysis (Ctrl+Q)" => "快速分析 (Ctrl+Q)", - "Formatting" => "格式化", - "Charts" => "图表", - "Totals" => "汇总", - "Tables" => "表", - "Color Scale" => "色阶", - "Icon Set" => "图标集", - "Greater Than…" => "大于…", - "Clear Rules" => "清除规则", - "Clustered Column" => "簇状柱形图", - "Line" => "折线图", - "Pie" => "饼图", - "Bar" => "条形图", - "Scatter" => "散点图", - "Recommended Charts" => "推荐的图表", - "% Total" => "占总计的百分比", - "Running Total" => "累计", - "By Column" => "按列", - "By Row" => "按行", - "Column" => "柱形", - "Win/Loss" => "盈亏", - "Green Data Bars" => "绿色数据条", - "Blue-White-Red Scale" => "蓝-白-红色阶", - "White-Green Scale" => "白-绿色阶", - "Duplicate Values" => "重复值", "Insert Sheet" => "插入工作表", "Rename" => "重命名", "Move or Copy…" => "移动或复制…", From e9449b55ab3d2db562282de8312294a1b61f0814 Mon Sep 17 00:00:00 2001 From: vangel76 Date: Wed, 25 Nov 2026 19:09:50 +0100 Subject: [PATCH 84/94] Read the frame ink of equations saved before the paragraph carried it An older writer put the frame's ink on every Office Math run and wrote no fill on the paragraph end. With a colour command in the source, such an equation now reads that shared run colour instead of Automatic. --- crates/xlsx/src/drawing.rs | 32 +++++++++++++++++++++++-- crates/xlsx/src/tests/equation_tests.rs | 20 ++++++++++++++++ 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/crates/xlsx/src/drawing.rs b/crates/xlsx/src/drawing.rs index 96ccc0ad7c..474b210f47 100644 --- a/crates/xlsx/src/drawing.rs +++ b/crates/xlsx/src/drawing.rs @@ -337,7 +337,8 @@ fn described_source(descr: &str) -> Option<(&str, &str)> { /// stands in, as do the runs of a body without Office Math (one colour throughout: the plain-text /// box of an equation outside the subset). The runs of GridCraft's own Office Math cannot stand /// in when the source colours some of them (`{\color{green}a}+d` would read back green), so such -/// a source with no saved ink reads as Automatic. +/// a source with no saved ink reads as Automatic, unless every run carries the same colour: that +/// is how earlier versions saved an explicit ink (on each run, with no paragraph-end fill). fn equation_ink(tb: Option<&El>, source: &str, own: bool, has_math: bool) -> Color { let Some(tb) = tb else { return Color::default() }; if own && has_math { @@ -345,12 +346,39 @@ fn equation_ink(tb: Option<&El>, source: &str, own: bool, has_math: bool) -> Col return c; } if source.contains("\\color") || source.contains("\\textcolor") { - return Color::default(); + return uniform_run_color(tb).unwrap_or_default(); } } first_run_color(tb, 0).unwrap_or_default() } +/// The colour every run under `e` carries, or `None` when there is no run, a run has no fill or +/// the runs differ. +fn uniform_run_color(e: &El) -> Option { + let mut found: Option = None; + let mut mixed = false; + collect_run_colors(e, 0, &mut found, &mut mixed); + if mixed { None } else { found } +} + +fn collect_run_colors(e: &El, depth: usize, found: &mut Option, mixed: &mut bool) { + if depth > 12 || *mixed { + return; + } + if e.name == "rPr" { + match (e.child("solidFill").and_then(dml_color), *found) { + (None, _) => *mixed = true, + (Some(c), None) => *found = Some(c), + (Some(c), Some(f)) if c != f => *mixed = true, + _ => {} + } + return; + } + for c in &e.children { + collect_run_colors(c, depth + 1, found, mixed); + } +} + /// The colour of the first run (DrawingML `rPr` with a fill) under `e`. fn first_run_color(e: &El, depth: usize) -> Option { if depth > 12 { diff --git a/crates/xlsx/src/tests/equation_tests.rs b/crates/xlsx/src/tests/equation_tests.rs index a2110cac4b..800a84bd1f 100644 --- a/crates/xlsx/src/tests/equation_tests.rs +++ b/crates/xlsx/src/tests/equation_tests.rs @@ -581,6 +581,26 @@ fn nested_colours_keep_the_frame_ink_through_save_and_reopen() { } } +#[test] +fn a_workbook_saved_before_the_paragraph_carried_the_ink_keeps_its_explicit_frame_ink() { + // The earlier writer put the frame's ink on every Office Math run and wrote no fill on the + // paragraph end: strip that fill from a saved equation to get the same bytes. + let src = "{\\color{green}a+{\\color{black}b}+c}+d"; + let wb = book(vec![equation(1, "B2", src, Color::Rgb(0x1F4E79))]); + let mut parts = unzip(&write_xlsx(&wb).unwrap()); + let name = parts.keys().find(|k| k.starts_with("xl/drawings/drawing")).unwrap().clone(); + let d = drawing(&parts); + let at = d.find("').unwrap() + at + 1; + let close = d[open_end..].find("").unwrap() + open_end; + assert!(d[open_end..close].contains("1F4E79"), "the paragraph end carries the ink: {d}"); + let legacy = format!("{}{}", &d[..open_end], &d[close..]); + assert!(legacy.matches("1F4E79").count() > 1, "every run still carries the ink"); + parts.insert(name, legacy.into_bytes()); + let s = shapes(&read_xlsx(&rezip(&parts)).unwrap().0); + assert_eq!((s.len(), s[0].kind, s[0].text.as_str(), s[0].line), (1, ShapeKind::Equation, src, Color::Rgb(0x1F4E79))); +} + #[test] fn the_plain_text_stand_in_for_an_equation_is_drawn_at_a_normal_size() { // A source Office Math cannot hold is saved as the text box alone; a source it can hold has From 966c634b1cc0ee99f55f219cf7e707bbdd262ce9 Mon Sep 17 00:00:00 2001 From: aiongg Date: Wed, 25 Nov 2026 19:15:01 +0000 Subject: [PATCH 85/94] Repin craft-libs to storytold next 8fa4db64a9 and egui to b9770908e --- Cargo.lock | 126 +++++++++++++++++----------------- Cargo.toml | 70 +++++++++---------- apps/gridcraft-web/Cargo.toml | 4 +- crates/ui-egui/Cargo.toml | 2 +- 4 files changed, 101 insertions(+), 101 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 890550d893..505d605cc8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1034,7 +1034,7 @@ dependencies = [ [[package]] name = "craft-appkit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "block2 0.6.2", "objc2-app-kit 0.3.2", @@ -1044,7 +1044,7 @@ dependencies = [ [[package]] name = "craft-atomic" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "rustix 1.1.6", ] @@ -1052,7 +1052,7 @@ dependencies = [ [[package]] name = "craft-behavior" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "accesskit", "bitflags 2.13.2", @@ -1070,12 +1070,12 @@ dependencies = [ [[package]] name = "craft-cfb" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" [[package]] name = "craft-cloud-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "egui", ] @@ -1083,12 +1083,12 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" [[package]] name = "craft-csv" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "thiserror 2.0.21", ] @@ -1096,7 +1096,7 @@ dependencies = [ [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "serde", ] @@ -1104,7 +1104,7 @@ dependencies = [ [[package]] name = "craft-drawingml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "chrono", "craft-xml", @@ -1116,7 +1116,7 @@ dependencies = [ [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "harfrust 0.13.3", "kurbo", @@ -1130,12 +1130,12 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" [[package]] name = "craft-gridcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "serde", "serde_json", @@ -1145,7 +1145,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "bitflags 2.13.2", "craft-i18n", @@ -1158,7 +1158,7 @@ dependencies = [ [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "chrono", "fixed_decimal", @@ -1186,7 +1186,7 @@ dependencies = [ [[package]] name = "craft-keymap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "craft-host", "craft-i18n", @@ -1201,7 +1201,7 @@ dependencies = [ [[package]] name = "craft-math" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "craft-xml", "roxmltree", @@ -1211,7 +1211,7 @@ dependencies = [ [[package]] name = "craft-mcp-server" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "serde_json", ] @@ -1219,7 +1219,7 @@ dependencies = [ [[package]] name = "craft-odf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "aes", "base64 0.23.1", @@ -1237,7 +1237,7 @@ dependencies = [ [[package]] name = "craft-ods" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "craft-odf", "craft-sheet", @@ -1248,7 +1248,7 @@ dependencies = [ [[package]] name = "craft-offcrypto" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "aes", "base64 0.23.1", @@ -1265,7 +1265,7 @@ dependencies = [ [[package]] name = "craft-opc" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "craft-xml", "craft-zip", @@ -1276,7 +1276,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "serde", ] @@ -1284,7 +1284,7 @@ dependencies = [ [[package]] name = "craft-platform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "async-channel", "async-io", @@ -1315,7 +1315,7 @@ dependencies = [ [[package]] name = "craft-print" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "craft-behavior", "craft-host", @@ -1339,7 +1339,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "dispatch2", "objc2 0.6.5", @@ -1351,7 +1351,7 @@ dependencies = [ [[package]] name = "craft-settings" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "craft-atomic", "craft-host", @@ -1368,12 +1368,12 @@ dependencies = [ [[package]] name = "craft-sheet" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" [[package]] name = "craft-stream-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "fax", "hayro-ccitt", @@ -1384,7 +1384,7 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "craft-xml", "flate2", @@ -1401,7 +1401,7 @@ dependencies = [ [[package]] name = "craft-theme" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "bitflags 2.13.2", "craft-tracked", @@ -1416,12 +1416,12 @@ dependencies = [ [[package]] name = "craft-tracked" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "craft-cloud-ui", "craft-ui-canvas", @@ -1435,7 +1435,7 @@ dependencies = [ [[package]] name = "craft-ui-canvas" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "craft-behavior", "craft-i18n", @@ -1451,7 +1451,7 @@ dependencies = [ [[package]] name = "craft-ui-contract" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "accesskit", "craft-behavior", @@ -1489,7 +1489,7 @@ dependencies = [ [[package]] name = "craft-ui-macros" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1500,7 +1500,7 @@ dependencies = [ [[package]] name = "craft-ui-panels" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "craft-behavior", "craft-host", @@ -1518,7 +1518,7 @@ dependencies = [ [[package]] name = "craft-ui-patterns" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "craft-behavior", "craft-host", @@ -1539,7 +1539,7 @@ dependencies = [ [[package]] name = "craft-ui-shell" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "craft-behavior", "craft-host", @@ -1559,7 +1559,7 @@ dependencies = [ [[package]] name = "craft-ui-widgets" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "craft-behavior", "craft-host", @@ -1578,7 +1578,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "chrono", "craft-host", @@ -1607,7 +1607,7 @@ dependencies = [ [[package]] name = "craft-web-api" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "js-sys", "serde_json", @@ -1618,7 +1618,7 @@ dependencies = [ [[package]] name = "craft-web-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "craft-host", "craft-platform", @@ -1630,7 +1630,7 @@ dependencies = [ [[package]] name = "craft-win32" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "winsafe", ] @@ -1638,7 +1638,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "craft-appkit", "craft-atomic", @@ -1670,7 +1670,7 @@ dependencies = [ [[package]] name = "craft-xls" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "craft-cfb", "craft-sheet", @@ -1683,7 +1683,7 @@ dependencies = [ [[package]] name = "craft-xlsx" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "craft-drawingml", "craft-opc", @@ -1695,7 +1695,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "quick-xml 0.41.0", "serde", @@ -1705,7 +1705,7 @@ dependencies = [ [[package]] name = "craft-zip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "flate2", "thiserror 2.0.21", @@ -2033,7 +2033,7 @@ checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" [[package]] name = "ecolor" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" +source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564" dependencies = [ "bytemuck", "emath", @@ -2042,7 +2042,7 @@ dependencies = [ [[package]] name = "eframe" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" +source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564" dependencies = [ "ahash", "bytemuck", @@ -2077,7 +2077,7 @@ dependencies = [ [[package]] name = "egui" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" +source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564" dependencies = [ "accesskit", "ahash", @@ -2096,7 +2096,7 @@ dependencies = [ [[package]] name = "egui-wgpu" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" +source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564" dependencies = [ "ahash", "bytemuck", @@ -2115,7 +2115,7 @@ dependencies = [ [[package]] name = "egui-winit" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" +source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564" dependencies = [ "accesskit_winit", "arboard", @@ -2140,7 +2140,7 @@ dependencies = [ [[package]] name = "egui_extras" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" +source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564" dependencies = [ "ahash", "egui", @@ -2153,7 +2153,7 @@ dependencies = [ [[package]] name = "egui_glow" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" +source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564" dependencies = [ "bytemuck", "egui", @@ -2166,7 +2166,7 @@ dependencies = [ [[package]] name = "egui_kittest" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" +source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564" dependencies = [ "dify", "eframe", @@ -2192,7 +2192,7 @@ checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" [[package]] name = "emath" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" +source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564" dependencies = [ "bytemuck", ] @@ -2273,7 +2273,7 @@ dependencies = [ [[package]] name = "epaint" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" +source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564" dependencies = [ "ahash", "bytemuck", @@ -2299,7 +2299,7 @@ dependencies = [ [[package]] name = "epaint_default_fonts" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" +source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564" [[package]] name = "equivalent" @@ -3211,7 +3211,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=aa401985dd4658cdaa272fdccafdcd6e7f4dd60b#aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" +source = "git+https://github.com/storytold/craft-libs?rev=8fa4db64a9bb943520259ea95331a303ba788f21#8fa4db64a9bb943520259ea95331a303ba788f21" dependencies = [ "hayro-ccitt", ] @@ -8605,14 +8605,14 @@ dependencies = [ [[patch.unused]] name = "egui_demo_lib" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" +source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564" [[patch.unused]] name = "egui_inspection" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" +source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564" [[patch.unused]] name = "egui_system_font_provider" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=b15ffe9bfc2c8e6748533b32b708e10abaf2afec#b15ffe9bfc2c8e6748533b32b708e10abaf2afec" +source = "git+https://github.com/storytold/egui.git?rev=b9770908e0f304896f9658d239a7b29cf8af1564#b9770908e0f304896f9658d239a7b29cf8af1564" diff --git a/Cargo.toml b/Cargo.toml index 5c72248170..2e19c125cc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,29 +30,29 @@ gridcraft-math = { path = "crates/math" } # ui-egui, craft-print in the app, craft-web-api and craft-web-host in the web app) comes from one # craft-libs revision. # craft-update: app-specific pretend versions apply to startup and manual checks. -craft-update = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "=0.1.0", features = ["ui"] } +craft-update = { git = "https://github.com/storytold/craft-libs", rev = "8fa4db64a9bb943520259ea95331a303ba788f21", version = "=0.1.0", features = ["ui"] } # PDF RunLength encoding; this revision also fixes the vendored JBIG2 dependency for Git consumers. -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "0.1.0", default-features = false } -craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "0.1.0" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "8fa4db64a9bb943520259ea95331a303ba788f21", version = "0.1.0", default-features = false } +craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "8fa4db64a9bb943520259ea95331a303ba788f21", version = "0.1.0" } # Compound files ([MS-CFB]) and password-encrypted OOXML packages ([MS-OFFCRYPTO]). -craft-cfb = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "0.1.0" } -craft-offcrypto = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "0.1.0" } -craft-ods = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "0.1.0" } +craft-cfb = { git = "https://github.com/storytold/craft-libs", rev = "8fa4db64a9bb943520259ea95331a303ba788f21", version = "0.1.0" } +craft-offcrypto = { git = "https://github.com/storytold/craft-libs", rev = "8fa4db64a9bb943520259ea95331a303ba788f21", version = "0.1.0" } +craft-ods = { git = "https://github.com/storytold/craft-libs", rev = "8fa4db64a9bb943520259ea95331a303ba788f21", version = "0.1.0" } # OPC zip packages (parts, relationships, the zip writer) under `crates/xlsx/src/package.rs`. -craft-opc = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "0.1.0" } +craft-opc = { git = "https://github.com/storytold/craft-libs", rev = "8fa4db64a9bb943520259ea95331a303ba788f21", version = "0.1.0" } # Delimited text (CSV, TSV) and SYLK; `crates/xlsx/src/csv.rs` and `crates/engine/src/io/sylk.rs` # turn them into workbooks. -craft-csv = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "0.1.0" } -craft-math = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "0.1.0" } +craft-csv = { git = "https://github.com/storytold/craft-libs", rev = "8fa4db64a9bb943520259ea95331a303ba788f21", version = "0.1.0" } +craft-math = { git = "https://github.com/storytold/craft-libs", rev = "8fa4db64a9bb943520259ea95331a303ba788f21", version = "0.1.0" } # The native JSON workbook (`.json`, `.scjson`): read, written, and kept newer macros written back. -craft-gridcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "0.1.0" } +craft-gridcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "8fa4db64a9bb943520259ea95331a303ba788f21", version = "0.1.0" } # Excel 97-2003 (.xls, BIFF8) workbooks; `crates/xlsx/src/xls.rs` maps them onto the model. # SpreadsheetML worksheet/drawing/string/package XML; workbook model mapping stays in gridcraft-xlsx. -craft-xlsx = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "0.1.0" } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "0.1.0" } -craft-xls = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "0.1.0" } -craft-drawingml = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "0.1.0" } -craft-mcp-server = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "=0.1.0" } +craft-xlsx = { git = "https://github.com/storytold/craft-libs", rev = "8fa4db64a9bb943520259ea95331a303ba788f21", version = "0.1.0" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "8fa4db64a9bb943520259ea95331a303ba788f21", version = "0.1.0" } +craft-xls = { git = "https://github.com/storytold/craft-libs", rev = "8fa4db64a9bb943520259ea95331a303ba788f21", version = "0.1.0" } +craft-drawingml = { git = "https://github.com/storytold/craft-libs", rev = "8fa4db64a9bb943520259ea95331a303ba788f21", version = "0.1.0" } +craft-mcp-server = { git = "https://github.com/storytold/craft-libs", rev = "8fa4db64a9bb943520259ea95331a303ba788f21", version = "=0.1.0" } # foundation thiserror = "2" @@ -92,15 +92,15 @@ skrifa = { version = "0.44", default-features = false, features = ["std"] } epaint_default_fonts = "0.37" # One native window per workbook: the window list, Window menu titles and the immediate-viewport # driver. Same craft-libs revision as craft-update above. -craft-window = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", default-features = false, features = ["ui"] } +craft-window = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "8fa4db64a9bb943520259ea95331a303ba788f21", default-features = false, features = ["ui"] } # The UI runtime GridCraft's egui UI is hosted by (`crates/ui-egui/src/framework.rs`): who the app is # to the framework's dialogs, the runtime's key bindings, the theme mode, window placement and the # printer controls. Same craft-libs revision as above. -craft-behavior = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" } -craft-host = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" } -craft-keymap = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" } -craft-theme = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" } -craft-print = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", features = ["ui"] } +craft-behavior = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "8fa4db64a9bb943520259ea95331a303ba788f21" } +craft-host = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "8fa4db64a9bb943520259ea95331a303ba788f21" } +craft-keymap = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "8fa4db64a9bb943520259ea95331a303ba788f21" } +craft-theme = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "8fa4db64a9bb943520259ea95331a303ba788f21" } +craft-print = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "8fa4db64a9bb943520259ea95331a303ba788f21", features = ["ui"] } [workspace.lints.rust] unsafe_code = "forbid" @@ -128,18 +128,18 @@ debug = 0 # Keep the complete egui family and native event bridge on reviewed fork commits. [patch.crates-io] -ecolor = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } -emath = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } -epaint = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } -epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } -egui = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } -egui-winit = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } -egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } -egui_glow = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } -egui_extras = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } -egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } -egui_system_font_provider = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } -eframe = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } -egui_demo_lib = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } -egui_inspection = { git = "https://github.com/storytold/egui.git", rev = "b15ffe9bfc2c8e6748533b32b708e10abaf2afec" } +ecolor = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +emath = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +epaint = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +egui = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +egui-winit = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +egui_glow = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +egui_extras = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +egui_system_font_provider = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +eframe = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +egui_demo_lib = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } +egui_inspection = { git = "https://github.com/storytold/egui.git", rev = "b9770908e0f304896f9658d239a7b29cf8af1564" } winit = { git = "https://github.com/storytold/winit.git", rev = "a517b3846ee8457d84ee4975110bfda6797c44dc" } diff --git a/apps/gridcraft-web/Cargo.toml b/apps/gridcraft-web/Cargo.toml index db990721c4..2b27a5d932 100644 --- a/apps/gridcraft-web/Cargo.toml +++ b/apps/gridcraft-web/Cargo.toml @@ -18,8 +18,8 @@ gridcraft-engine = { workspace = true } gridcraft-ui-egui = { workspace = true } # The host messages (storytold/craft-libs): one contract and one bridge for the web builds. # The page command API (storytold/craft-libs#413): window.gridcraft over the control channel. -craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "0.1.0" } -craft-web-host = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b", version = "0.1.0" } +craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "8fa4db64a9bb943520259ea95331a303ba788f21", version = "0.1.0" } +craft-web-host = { git = "https://github.com/storytold/craft-libs", rev = "8fa4db64a9bb943520259ea95331a303ba788f21", version = "0.1.0" } egui = { workspace = true } log = { workspace = true } serde_json = { workspace = true } diff --git a/crates/ui-egui/Cargo.toml b/crates/ui-egui/Cargo.toml index d20832a04e..1796a8b6d9 100644 --- a/crates/ui-egui/Cargo.toml +++ b/crates/ui-egui/Cargo.toml @@ -11,7 +11,7 @@ workspace = true [dependencies] # The UI runtime that hosts this egui UI (`src/framework.rs`) and the framework dialogs, from the # one craft-libs revision every craft-libs dependency uses (see the root Cargo.toml). -craft-ui = { git = "https://github.com/storytold/craft-libs", rev = "aa401985dd4658cdaa272fdccafdcd6e7f4dd60b" } +craft-ui = { git = "https://github.com/storytold/craft-libs", rev = "8fa4db64a9bb943520259ea95331a303ba788f21" } craft-behavior = { workspace = true } craft-host = { workspace = true } craft-keymap = { workspace = true } From cfc092212612de09c6d1f672908acde1ad839ee9 Mon Sep 17 00:00:00 2001 From: vangel76 Date: Wed, 25 Nov 2026 20:34:24 +0100 Subject: [PATCH 86/94] Skip Office Math run styles when reading the legacy frame ink The earlier writer saved a style-only m:rPr beside the a:rPr that carries the fill on styled runs. The legacy ink check counted it as a run without a fill and read Automatic. --- crates/xlsx/src/drawing.rs | 12 ++++++++++++ crates/xlsx/src/tests/equation_tests.rs | 6 ++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/crates/xlsx/src/drawing.rs b/crates/xlsx/src/drawing.rs index 474b210f47..c0de11df20 100644 --- a/crates/xlsx/src/drawing.rs +++ b/crates/xlsx/src/drawing.rs @@ -366,6 +366,11 @@ fn collect_run_colors(e: &El, depth: usize, found: &mut Option, mixed: &m return; } if e.name == "rPr" { + // Office Math's own run style (`m:rPr`: bold, plain, script) sits beside the DrawingML one + // that carries the fill, and the parser drops the prefix that tells them apart + if is_math_run_style(e) { + return; + } match (e.child("solidFill").and_then(dml_color), *found) { (None, _) => *mixed = true, (Some(c), None) => *found = Some(c), @@ -379,6 +384,13 @@ fn collect_run_colors(e: &El, depth: usize, found: &mut Option, mixed: &m } } +/// Whether `e` is an Office Math `m:rPr` (only style children such as `m:sty`), not the DrawingML +/// `a:rPr` of the run, which holds the fill and the font. +fn is_math_run_style(e: &El) -> bool { + const MATH_STYLE: [&str; 6] = ["nor", "sty", "scr", "lit", "aln", "brk"]; + !e.children.is_empty() && e.children.iter().all(|c| MATH_STYLE.contains(&c.name.as_str())) +} + /// The colour of the first run (DrawingML `rPr` with a fill) under `e`. fn first_run_color(e: &El, depth: usize) -> Option { if depth > 12 { diff --git a/crates/xlsx/src/tests/equation_tests.rs b/crates/xlsx/src/tests/equation_tests.rs index 800a84bd1f..262b77c441 100644 --- a/crates/xlsx/src/tests/equation_tests.rs +++ b/crates/xlsx/src/tests/equation_tests.rs @@ -584,12 +584,14 @@ fn nested_colours_keep_the_frame_ink_through_save_and_reopen() { #[test] fn a_workbook_saved_before_the_paragraph_carried_the_ink_keeps_its_explicit_frame_ink() { // The earlier writer put the frame's ink on every Office Math run and wrote no fill on the - // paragraph end: strip that fill from a saved equation to get the same bytes. - let src = "{\\color{green}a+{\\color{black}b}+c}+d"; + // paragraph end: strip that fill from a saved equation to get the same bytes. The styled + // runs (`\\mathbf`, `\\text`) also carry an `m:rPr` of Office Math style beside the `a:rPr`. + let src = "{\\color{green}a+{\\color{black}\\mathbf{b}}+\\text{c}}+d"; let wb = book(vec![equation(1, "B2", src, Color::Rgb(0x1F4E79))]); let mut parts = unzip(&write_xlsx(&wb).unwrap()); let name = parts.keys().find(|k| k.starts_with("xl/drawings/drawing")).unwrap().clone(); let d = drawing(&parts); + assert!(d.contains("').unwrap() + at + 1; let close = d[open_end..].find("").unwrap() + open_end; From 8bbc760f5dcdaebccce31d8522c25645c025c2cf Mon Sep 17 00:00:00 2001 From: vangel76 Date: Wed, 25 Nov 2026 20:38:25 +0100 Subject: [PATCH 87/94] Quick Analysis: name the launcher and tiles as buttons and show keyboard focus The launcher and every tile now expose a button role with their translated label (the launcher also its open state). The popup hands the keyboard to its first tile, arrows move the focus between tiles, Enter or Space runs one, and the focused control gets a visible ring. Ctrl+Q closes the popup while a tile has the keyboard. --- crates/ui-egui/src/quick_analysis.rs | 63 ++++++++++++++++--- .../ui-egui/tests/it/quick_analysis_button.rs | 54 ++++++++++++++++ 2 files changed, 109 insertions(+), 8 deletions(-) diff --git a/crates/ui-egui/src/quick_analysis.rs b/crates/ui-egui/src/quick_analysis.rs index f7db7b5697..66f5fb2e89 100644 --- a/crates/ui-egui/src/quick_analysis.rs +++ b/crates/ui-egui/src/quick_analysis.rs @@ -49,6 +49,8 @@ pub struct State { pub tab: Tab, /// Totals by row (results to the right) instead of by column (results below). pub by_rows: bool, + /// The popup just opened: its first tile takes the keyboard focus so arrows, Enter and Space work. + focus_first_tile: bool, } /// What a tile does. @@ -153,6 +155,7 @@ pub fn toggle(app: &mut SheetApp, on: Option) -> Result { return Err("Select at least two cells to use Quick Analysis.".into()); } else { app.grid.quick_analysis.open = Some((sheet, sel)); + app.grid.quick_analysis.focus_first_tile = true; } Ok(json!({"open": app.grid.quick_analysis.open.is_some()})) } @@ -208,8 +211,11 @@ pub fn show(app: &mut SheetApp, ui: &mut Ui, geo: &Geo, sh: &Sheet) { // Right after a fill-handle drag the Auto Fill Options button sits at the same corner; it wins // until that fill is no longer current (Ctrl+Q still opens the popup). let fill_tag = app.grid.fill_tag.is_some(); + // Whether the launcher or a popup control has the keyboard, so the grid reads no keys this frame. + let mut keyboard_in_popup = false; if corner_visible && (open || (!busy && !fill_tag)) { let mut clicked = false; + let mut focused = false; egui::Area::new(Id::unique("quick_analysis_button")).fixed_pos(button.min).order(Order::Foreground).show(&ctx, |ui| { let (r, resp) = ui.allocate_exact_size(button.size(), Sense::click()); let fill = if resp.is_pointer_button_down_on() || open { @@ -222,8 +228,13 @@ pub fn show(app: &mut SheetApp, ui: &mut Ui, geo: &Geo, sh: &Sheet) { ui.painter().rect_filled(r, 4.0, fill); ui.painter().rect_stroke(r, 4.0, Stroke::new(1.0, t.separator), StrokeKind::Inside); icons::paint(ui.painter(), Rect::from_center_size(r.center(), vec2(16.0, 16.0)), Icon::QuickAnalysis, t.accent); - clicked = resp.on_hover_text(lang.tr("Quick Analysis (Ctrl+Q)")).clicked(); + paint_focus_ring(ui, &t, r, &resp); + let name = lang.tr("Quick Analysis (Ctrl+Q)"); + resp.widget_info(|| egui::WidgetInfo::selected(egui::Role::Button, true, open, name)); + focused = resp.has_focus(); + clicked = resp.on_hover_text(name).clicked(); }); + keyboard_in_popup = focused; if clicked { let _ = toggle(app, None); } @@ -231,12 +242,16 @@ pub fn show(app: &mut SheetApp, ui: &mut Ui, geo: &Geo, sh: &Sheet) { let Some((_, opened_for)) = app.grid.quick_analysis.open else { return }; let pos = pos2(button.left(), button.bottom() + 4.0); let mut picked: Option = None; + // The frame that opened the popup (Ctrl+Q is still in the input) must not close it again. + let just_opened = app.grid.quick_analysis.focus_first_tile; let resp = egui::Area::new(Id::unique("quick_analysis_popup")).fixed_pos(pos).order(Order::Foreground).constrain(true).show(&ctx, |ui| { egui::Frame::popup(ui.style()).show(ui, |ui| { let state = &mut app.grid.quick_analysis; ui.horizontal(|ui| { for tab in Tab::ALL { - if ui.selectable_label(state.tab == tab, lang.tr(tab.label())).clicked() { + let tab_button = ui.selectable_label(state.tab == tab, lang.tr(tab.label())); + keyboard_in_popup |= tab_button.has_focus(); + if tab_button.clicked() { state.tab = tab; } } @@ -244,16 +259,17 @@ pub fn show(app: &mut SheetApp, ui: &mut Ui, geo: &Geo, sh: &Sheet) { ui.separator(); if state.tab == Tab::Totals { ui.horizontal(|ui| { - ui.selectable_value(&mut state.by_rows, false, lang.tr("By Column")); - ui.selectable_value(&mut state.by_rows, true, lang.tr("By Row")); + keyboard_in_popup |= ui.selectable_value(&mut state.by_rows, false, lang.tr("By Column")).has_focus(); + keyboard_in_popup |= ui.selectable_value(&mut state.by_rows, true, lang.tr("By Row")).has_focus(); }); } let items = tiles(state.tab, &opened_for.a1(), &sheet_name, state.by_rows); + let mut take_focus = std::mem::take(&mut state.focus_first_tile); for row in items.chunks(6) { ui.horizontal(|ui| { ui.spacing_mut().item_spacing.x = 2.0; for item in row { - if paint_tile(ui, &t, item, lang.tr(item.label)) { + if paint_tile(ui, &t, item, lang.tr(item.label), std::mem::take(&mut take_focus), &mut keyboard_in_popup) { picked = Some(item.action.clone()); } } @@ -269,14 +285,43 @@ pub fn show(app: &mut SheetApp, ui: &mut Ui, geo: &Geo, sh: &Sheet) { Action::Run(id, params) => app.run_or_alert(id, params), Action::Dialog(name, params) => app.open_dialog(name, params), } - } else if outside_click || ctx.input_mut(|i| i.consume_key(egui::Modifiers::NONE, egui::Key::Escape)) { + } else if outside_click + || ctx.input_mut(|i| i.consume_key(egui::Modifiers::NONE, egui::Key::Escape)) + || (keyboard_in_popup && !just_opened && toggle_key_pressed(&ctx)) + { app.grid.quick_analysis.open = None; } } -/// One option of the popup: a small picture over a wrapped label. True when clicked. -fn paint_tile(ui: &mut Ui, t: &Tokens, item: &Tile, label: &str) -> bool { +/// Ctrl+Q (Control+Q on a Mac, where Command+Q stays Quit) while a tile has the keyboard: the grid +/// no longer reads keys then, so the popup closes itself on the key that opened it. +fn toggle_key_pressed(ctx: &egui::Context) -> bool { + ctx.input_mut(|i| { + let pressed = |e: &egui::Event| { + matches!(e, egui::Event::Key { key: egui::Key::Q, pressed: true, modifiers: m, .. } if m.ctrl && !m.shift && !m.alt && !m.mac_cmd) + }; + let Some(at) = i.events.iter().position(pressed) else { return false }; + + i.events.remove(at); + true + }) +} + +/// A visible ring around a control that has the keyboard focus. +fn paint_focus_ring(ui: &Ui, t: &Tokens, rect: Rect, resp: &egui::Response) { + if resp.has_focus() { + ui.painter().rect_stroke(rect.expand(1.0), 5.0, Stroke::new(2.0, t.sheet_focus), StrokeKind::Outside); + } +} + +/// One option of the popup: a small picture over a wrapped label, a button named by that label. +/// `take_focus` gives it the keyboard focus. True when clicked. +fn paint_tile(ui: &mut Ui, t: &Tokens, item: &Tile, label: &str, take_focus: bool, has_keyboard: &mut bool) -> bool { let (rect, resp) = ui.allocate_exact_size(TILE, Sense::click()); + if take_focus { + resp.request_focus(); + } + resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, label)); if resp.is_pointer_button_down_on() { ui.painter().rect_filled(rect, 4.0, t.pressed); } else if resp.hovered() { @@ -287,6 +332,8 @@ fn paint_tile(ui: &mut Ui, t: &Tokens, item: &Tile, label: &str) -> bool { let galley = ui.painter().layout(label.to_string(), theme::ui_font(11.0), t.text, TILE.x - 4.0); let at = pos2(rect.center().x - galley.size().x / 2.0, rect.top() + 34.0); ui.painter().with_clip_rect(rect.intersect(ui.clip_rect())).galley(at, galley, t.text); + paint_focus_ring(ui, t, rect, &resp); + *has_keyboard |= resp.has_focus(); resp.clicked() } diff --git a/crates/ui-egui/tests/it/quick_analysis_button.rs b/crates/ui-egui/tests/it/quick_analysis_button.rs index 9a5e1f2b14..e8ff38782f 100644 --- a/crates/ui-egui/tests/it/quick_analysis_button.rs +++ b/crates/ui-egui/tests/it/quick_analysis_button.rs @@ -134,3 +134,57 @@ fn escape_closes_the_popup_without_cancelling_the_pending_copy() { esc(&mut h); assert!(h.state().session.clipboard.is_none(), "a second Esc, with no popup, cancels the copy as before"); } + +/// The launcher and the tiles are named buttons. The popup hands the keyboard to its first tile, +/// an arrow moves the focus to the next one and Enter runs it. +#[test] +fn launcher_and_tiles_are_named_buttons_that_work_by_keyboard() { + use egui::accesskit::Role; + use egui_kittest::kittest::Queryable as _; + let mut session = crate::support::blank_session(); + session.execute("range.setValues", json!({"range": "A1", "values": [[1, 2, 3], [4, 5, 6]]})).unwrap(); + session.execute("selection.set", json!({"range": "A1:C2"})).unwrap(); + let mut h = crate::support::harness(session, 4); + h.get_by_role_and_label(Role::Button, "Quick Analysis (Ctrl+Q)"); + + toggle(h.state_mut(), Some(true)).unwrap(); + h.run_steps(3); + assert!(h.get_by_role_and_label(Role::Button, "Data Bars").is_focused(), "the first tile takes the focus"); + h.get_by_role_and_label(Role::Button, "Clear Rules"); + + h.key_press(egui::Key::ArrowRight); + h.run_steps(2); + assert!(h.get_by_role_and_label(Role::Button, "Color Scale").is_focused(), "an arrow moves the focus to the next tile"); + h.key_press(egui::Key::Enter); + h.run_steps(2); + assert!(h.state().grid.quick_analysis.open.is_none(), "the chosen tile closes the popup"); + let sheet = h.state().session.active().unwrap().wb.active().unwrap(); + assert_eq!(sheet.cond_formats.len(), 1, "and its color scale is applied"); +} + +/// Whether a frame of the launcher and popup draws the focus ring colour as a stroke. +fn draws_focus_ring(app: &mut SheetApp, frames: usize) -> bool { + let sh = app.session.active().unwrap().wb.active().unwrap().clone(); + let g = Geo::new(&sh, Rect::from_min_max(pos2(0.0, 0.0), pos2(1200.0, 800.0)), Vec2::ZERO); + let ctx = egui::Context::default(); + // No fade-in, so the colours are the theme's own. + ctx.global_style_mut(|style| style.animation_time = 0.0); + let ring = gridcraft_ui_egui::theme::Tokens::get(&ctx).sheet_focus; + let mut seen = false; + for _ in 0..frames { + let out = ctx.run_ui(egui::RawInput::default(), |ui| gridcraft_ui_egui::quick_analysis::show(app, ui, &g, &sh)); + seen = out.shapes.iter().any(|s| matches!(&s.shape, egui::Shape::Rect(r) if r.stroke.color == ring)); + out.drop_without_applying_deltas(); + } + seen +} + +/// The focused tile shows a ring, so a keyboard user can see where they are. +#[test] +fn the_focused_tile_shows_a_visible_focus_ring() { + let mut app = app(); + app.run("selection.set", json!({"range": "B2:D5"})).unwrap(); + assert!(!draws_focus_ring(&mut app, 3), "no ring while the popup is closed"); + toggle(&mut app, Some(true)).unwrap(); + assert!(draws_focus_ring(&mut app, 3), "the first tile has the focus and a ring"); +} From 731c90dcc13b47b81e52830686dfc5e5f87b3ef1 Mon Sep 17 00:00:00 2001 From: vangel76 Date: Wed, 25 Nov 2026 20:52:50 +0100 Subject: [PATCH 88/94] Quick Analysis: use a focus ring colour that meets 3:1 on the popup in both themes The sheet's green focus colour is only 2.5:1 on the dark popup (1.9:1 on a hovered tile). Tiles now ring with the theme accent (3.9:1 or more on the popup, hover and pressed fills in light and dark); the launcher sits on the sheet and keeps the sheet's focus colour. The contrast test covers the popup pairs. --- crates/ui-egui/src/quick_analysis.rs | 11 ++++++----- crates/ui-egui/src/theme.rs | 9 +++++++++ crates/ui-egui/tests/it/quick_analysis_button.rs | 6 +++--- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/crates/ui-egui/src/quick_analysis.rs b/crates/ui-egui/src/quick_analysis.rs index 66f5fb2e89..50cd7fcb7a 100644 --- a/crates/ui-egui/src/quick_analysis.rs +++ b/crates/ui-egui/src/quick_analysis.rs @@ -228,7 +228,8 @@ pub fn show(app: &mut SheetApp, ui: &mut Ui, geo: &Geo, sh: &Sheet) { ui.painter().rect_filled(r, 4.0, fill); ui.painter().rect_stroke(r, 4.0, Stroke::new(1.0, t.separator), StrokeKind::Inside); icons::paint(ui.painter(), Rect::from_center_size(r.center(), vec2(16.0, 16.0)), Icon::QuickAnalysis, t.accent); - paint_focus_ring(ui, &t, r, &resp); + // The launcher sits on the sheet, so its ring is the sheet's focus colour + paint_focus_ring(ui, t.sheet_focus, r, &resp); let name = lang.tr("Quick Analysis (Ctrl+Q)"); resp.widget_info(|| egui::WidgetInfo::selected(egui::Role::Button, true, open, name)); focused = resp.has_focus(); @@ -307,10 +308,10 @@ fn toggle_key_pressed(ctx: &egui::Context) -> bool { }) } -/// A visible ring around a control that has the keyboard focus. -fn paint_focus_ring(ui: &Ui, t: &Tokens, rect: Rect, resp: &egui::Response) { +/// A visible ring in `color` around a control that has the keyboard focus. +fn paint_focus_ring(ui: &Ui, color: Color32, rect: Rect, resp: &egui::Response) { if resp.has_focus() { - ui.painter().rect_stroke(rect.expand(1.0), 5.0, Stroke::new(2.0, t.sheet_focus), StrokeKind::Outside); + ui.painter().rect_stroke(rect.expand(1.0), 5.0, Stroke::new(2.0, color), StrokeKind::Outside); } } @@ -332,7 +333,7 @@ fn paint_tile(ui: &mut Ui, t: &Tokens, item: &Tile, label: &str, take_focus: boo let galley = ui.painter().layout(label.to_string(), theme::ui_font(11.0), t.text, TILE.x - 4.0); let at = pos2(rect.center().x - galley.size().x / 2.0, rect.top() + 34.0); ui.painter().with_clip_rect(rect.intersect(ui.clip_rect())).galley(at, galley, t.text); - paint_focus_ring(ui, t, rect, &resp); + paint_focus_ring(ui, t.popup_focus_ring(), rect, &resp); *has_keyboard |= resp.has_focus(); resp.clicked() } diff --git a/crates/ui-egui/src/theme.rs b/crates/ui-egui/src/theme.rs index 9ebf199440..1910a8aa93 100644 --- a/crates/ui-egui/src/theme.rs +++ b/crates/ui-egui/src/theme.rs @@ -300,6 +300,12 @@ impl Tokens { if ctx.global_style().visuals.dark_mode { Tokens::dark() } else { Tokens::light() } } + /// The ring around a focused control on a popup or menu surface. The sheet's own focus colour + /// is too dim on the dark popup (2.5:1), so this follows the theme's accent instead. + pub fn popup_focus_ring(&self) -> Color32 { + self.accent + } + /// One colour of the category palette. pub fn cat(&self, c: Cat) -> Color32 { self.cat.get(c as usize).copied().unwrap_or(self.text) @@ -440,6 +446,9 @@ mod contrast_tests { add("slider fill on sheet", t.sheet_fill, t.grid_bg, GLYPH); add("slider fill on track", t.sheet_fill, t.sheet_track, GLYPH); add("control focus ring on sheet", t.sheet_focus, t.grid_bg, GLYPH); + for (name, bg) in [("menu", t.menu_bg), ("hover", t.hover), ("pressed", t.pressed)] { + add(&format!("popup control focus ring on {name}"), t.popup_focus_ring(), bg, GLYPH); + } add("recording dot on ribbon", t.recording, t.ribbon, GLYPH); add("recording dot on status bar", t.recording, t.status_bar, GLYPH); for (name, c) in [ diff --git a/crates/ui-egui/tests/it/quick_analysis_button.rs b/crates/ui-egui/tests/it/quick_analysis_button.rs index e8ff38782f..5d75214f7a 100644 --- a/crates/ui-egui/tests/it/quick_analysis_button.rs +++ b/crates/ui-egui/tests/it/quick_analysis_button.rs @@ -162,18 +162,18 @@ fn launcher_and_tiles_are_named_buttons_that_work_by_keyboard() { assert_eq!(sheet.cond_formats.len(), 1, "and its color scale is applied"); } -/// Whether a frame of the launcher and popup draws the focus ring colour as a stroke. +/// Whether a frame of the launcher and popup draws the popup focus ring (a 2 px stroke). fn draws_focus_ring(app: &mut SheetApp, frames: usize) -> bool { let sh = app.session.active().unwrap().wb.active().unwrap().clone(); let g = Geo::new(&sh, Rect::from_min_max(pos2(0.0, 0.0), pos2(1200.0, 800.0)), Vec2::ZERO); let ctx = egui::Context::default(); // No fade-in, so the colours are the theme's own. ctx.global_style_mut(|style| style.animation_time = 0.0); - let ring = gridcraft_ui_egui::theme::Tokens::get(&ctx).sheet_focus; + let ring = gridcraft_ui_egui::theme::Tokens::get(&ctx).popup_focus_ring(); let mut seen = false; for _ in 0..frames { let out = ctx.run_ui(egui::RawInput::default(), |ui| gridcraft_ui_egui::quick_analysis::show(app, ui, &g, &sh)); - seen = out.shapes.iter().any(|s| matches!(&s.shape, egui::Shape::Rect(r) if r.stroke.color == ring)); + seen = out.shapes.iter().any(|s| matches!(&s.shape, egui::Shape::Rect(r) if r.stroke.color == ring && r.stroke.width == 2.0)); out.drop_without_applying_deltas(); } seen From f96096f97ebfd72a6fd4fa771f7bf05e21274353 Mon Sep 17 00:00:00 2001 From: aiongg Date: Wed, 25 Nov 2026 20:44:58 +0000 Subject: [PATCH 89/94] The print job takes the panel's Collate; tests load their fonts as the app does --- apps/gridcraft/src/print.rs | 1 + crates/ui-egui/tests/common/mod.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/gridcraft/src/print.rs b/apps/gridcraft/src/print.rs index e19988a119..8ea22e4a39 100644 --- a/apps/gridcraft/src/print.rs +++ b/apps/gridcraft/src/print.rs @@ -36,6 +36,7 @@ pub fn submit() -> Submit { _ => None, }, copies: settings.copies.clamp(1, 999), + collate: settings.collate, duplex: settings.duplex.and_then(|value| match value { Duplex::LongEdge => Some(craft_print::Duplex::LongEdge), Duplex::ShortEdge => Some(craft_print::Duplex::ShortEdge), diff --git a/crates/ui-egui/tests/common/mod.rs b/crates/ui-egui/tests/common/mod.rs index f5ea88666c..90fd33be43 100644 --- a/crates/ui-egui/tests/common/mod.rs +++ b/crates/ui-egui/tests/common/mod.rs @@ -19,7 +19,7 @@ pub type Harness = egui_kittest::Harness<'static, SheetApp>; pub fn builder() -> HarnessBuilder { egui_kittest::Harness::builder().with_context_setup(|ctx| { gridcraft_ui_egui::framework::install_headless(ctx); - ctx.set_fonts(gridcraft_ui_egui::theme::pinned_font_definitions()); + craft_ui::fonts::load(ctx, gridcraft_ui_egui::theme::pinned_font_definitions()); gridcraft_ui_egui::theme::apply(ctx, false); }) } From 3a37c2e88295a61e91942ddc0866a28bab02bf5d Mon Sep 17 00:00:00 2001 From: skylar taylor-barrick Date: Wed, 25 Nov 2026 16:17:18 -0600 Subject: [PATCH 90/94] Use the shared nightly launcher template (#4758) Renders the plain nightly tar's launcher from craft-common-actions' shared template. Independent check: dylanmtaylor compared all 14 app launcher PRs byte for byte with the template rendered from the registry (https://github.com/storytold/craft-common-actions/pull/367#issuecomment-7172085284); this head was re-checked against craft-common-actions main 88148a5. --- docs/nightly-release-preparation.md | 15 ++- packaging/linux/nightly-linux-launch-tests.py | 107 +++++++++++++++--- packaging/linux/nightly-tar-launch.sh | 16 +++ packaging/linux/nightly.sh | 5 +- 4 files changed, 118 insertions(+), 25 deletions(-) create mode 100755 packaging/linux/nightly-tar-launch.sh diff --git a/docs/nightly-release-preparation.md b/docs/nightly-release-preparation.md index 1517a514ff..1568cfc23d 100644 --- a/docs/nightly-release-preparation.md +++ b/docs/nightly-release-preparation.md @@ -105,21 +105,24 @@ traversing root, a root that resolves through a link into a fenced folder, an in `${XDG_DATA_HOME:-$HOME/.local/share}/gridcraft-nightly/profile`, a sibling of stable's `/gridcraft`, never an ancestor. -**Every Linux format ships a launcher, and each passes an already-supplied profile through.** +**Every Linux format ships a launcher.** The flat nightly tar's `gridcraft` is craft-common-actions' +shared launcher template (`scripts/nightly-launcher.sh.in` from #363, rendered for this app), so it always +supplies its own profile; the packaged formats pass an already-supplied profile through. | Format | Launcher | GUI | Data root | |---|---|---|---| | deb/rpm | `/usr/bin/gridcraft-nightly` | `/usr/lib/gridcraft-nightly/gridcraft` | `/gridcraft-nightly/profile` | | AppImage | `AppRun` (a script) and `usr/bin/gridcraft-nightly` | `usr/bin/gridcraft` | same | -| flat nightly tar | `gridcraft` | `gridcraft-bin` | same | -| plain tree tarball | `bin/gridcraft-nightly` | `bin/gridcraft` | same | -| Arch handoff | `bin/gridcraft-nightly` | `.gridcraft-nightly/gridcraft` | same | +| flat nightly tar | `gridcraft` (the shared template) | `gridcraft-bin` | `/ai.storyteller.gridcraft.nightly` | +| plain tree tarball | `bin/gridcraft-nightly` | `bin/gridcraft` | `/gridcraft-nightly/profile` | +| Arch handoff | `bin/gridcraft-nightly` | `.gridcraft-nightly/gridcraft` | `/gridcraft-nightly/profile` | | Flatpak bundle | `/app/bin/gridcraft-nightly` | `/app/bin/gridcraft` | the sandbox's own `~/.local/share` | The flat nightly tar uses the kit's standard layout: `` is the launcher people run and `-bin` is the GUI ELF it starts, so the shared Unix verifier can keep requiring `gridcraft` -as the entrypoint. No launcher falls back to a relative or world-writable path for the GUI, and a -candidate that is the launcher itself is never started. +as the entrypoint. That launcher is the shared template: it resolves its own directory once and execs +`gridcraft-bin` with `--launch-profile nightly-v1 --profile-root /ai.storyteller.gridcraft.nightly --` +and the user's arguments, asking a bare `--version`/`-V` in the Launcher's own form. **macOS and Windows.** `GridCraft Nightly.app` (`CFBundleIdentifier ai.storyteller.gridcraft.nightly`, associations removed) is built and verified unsigned on main and diff --git a/packaging/linux/nightly-linux-launch-tests.py b/packaging/linux/nightly-linux-launch-tests.py index dff5ad53f1..06482c808c 100644 --- a/packaging/linux/nightly-linux-launch-tests.py +++ b/packaging/linux/nightly-linux-launch-tests.py @@ -2,10 +2,13 @@ """The Linux launch profile, staged the way each format ships it; no cargo build, no GUI, no network. What is checked, all synthetic: - * `nightly-launch.sh` (the AppImage and tar launcher) passes the flavor's own tokens and nothing else; + * `nightly-tar-launch.sh` (craft-common-actions' rendered template, the plain tar's entrypoint) starts + `-bin` with the template's exact tokens and the channel's own profile root; + * `nightly-launch.sh` (the AppImage and plain-tree launcher) passes the flavor's own tokens; * `package.sh` stages the deb/rpm, AppImage and tar launchers and a nightly desktop entry, and leaves a stable tree exactly as it was. `nfpm`, `appimagetool` and `strip` are stubs on PATH. """ +import hashlib import os from pathlib import Path import shutil @@ -16,9 +19,13 @@ import unittest ROOT = Path(__file__).resolve().parents[2] LAUNCHER = ROOT / "packaging/linux/nightly-launch.sh" +TAR_LAUNCHER = ROOT / "packaging/linux/nightly-tar-launch.sh" PACKAGE = ROOT / "packaging/linux/package.sh" NIGHTLY_VERSION = "0.19.1-nightly.20261124.7.1.gabcdef012345" PROFILE = "gridcraft-nightly/profile" +# The tar launcher is the shared template rendered for this app; these are its bytes. +TAR_PROFILE = "ai.storyteller.gridcraft.nightly" +TAR_LAUNCHER_SHA256 = "da4d5c6187527b57bb3d6b9f2b8791dff71c2f3421a4116cbda3cd3314b54af7" RECORDER = """#!/bin/sh printf '<%s>\\n' "$@" @@ -30,7 +37,7 @@ def run(argv, cwd, env, check=True): class MovedTreeLauncher(unittest.TestCase): - """nightly-launch.sh as AppRun and as an unpacked tar's launcher.""" + """nightly-launch.sh as AppRun and as a plain tree tarball's launcher.""" def setUp(self): self.scratch = tempfile.TemporaryDirectory() @@ -43,13 +50,11 @@ class MovedTreeLauncher(unittest.TestCase): """Each placement puts the GUI and this launcher where its format does. appdir: AppRun at the root, GUI in usr/bin (also usr/bin/gridcraft-nightly). - tar: the kit's flat tar, `gridcraft` launcher beside the `gridcraft-bin` GUI. tree: a plain tree tarball, bin/gridcraft-nightly beside bin/gridcraft. """ tree = self.root / layout binary, launcher_name = { "appdir": (tree / "usr/bin/gridcraft", tree / "AppRun"), - "tar": (tree / "gridcraft-bin", tree / "gridcraft"), "tree": (tree / "bin/gridcraft", tree / "bin/gridcraft-nightly"), }[layout] binary.parent.mkdir(parents=True) @@ -66,7 +71,7 @@ class MovedTreeLauncher(unittest.TestCase): return ["<--launch-profile>", "", "<--profile-root>", f"<{self.data / PROFILE}>", "<-->"] def test_every_layout_starts_the_gui_through_the_launch_profile(self): - for layout in ("appdir", "tar", "tree"): + for layout in ("appdir", "tree"): with self.subTest(layout=layout): launcher = self.install(layout) self.assertEqual(self.query(launcher).stdout.splitlines(), self.tokens()) @@ -92,16 +97,84 @@ class MovedTreeLauncher(unittest.TestCase): self.assertIn("no GridCraft binary", missing.stderr) self.assertFalse(self.data.exists(), "a refused launch creates no data folder") - def test_a_flat_tar_launcher_never_starts_itself(self): - launcher = self.install("tar") - (self.root / "tar/gridcraft-bin").unlink() - refused = run([str(launcher)], cwd=self.root, env=self.env, check=False) - self.assertEqual(refused.returncode, 2) - self.assertIn("no GridCraft binary", refused.stderr) - def test_the_launcher_is_portable_shell(self): - run(["sh", "-n", str(LAUNCHER)], cwd=self.root, env=self.env) - self.assertTrue(LAUNCHER.read_text().startswith("#!/bin/sh\n")) + for launcher in (LAUNCHER, TAR_LAUNCHER): + with self.subTest(launcher=launcher.name): + run(["sh", "-n", str(launcher)], cwd=self.root, env=self.env) + self.assertTrue(launcher.read_text().startswith("#!/bin/sh\n")) + + +class CanonicalTarLauncher(unittest.TestCase): + """The plain nightly tar's entrypoint: the shared template, rendered for GridCraft.""" + + def setUp(self): + self.scratch = tempfile.TemporaryDirectory() + self.addCleanup(self.scratch.cleanup) + self.root = Path(self.scratch.name) + self.data = self.root / "data" + self.home = self.root / "home with space" + self.env = {"PATH": os.environ["PATH"], "XDG_DATA_HOME": str(self.data)} + + def install(self): + """The kit's flat tar: the `gridcraft` launcher beside the `gridcraft-bin` GUI.""" + tree = self.root / "tar" + tree.mkdir() + (tree / "gridcraft-bin").write_text(RECORDER) + (tree / "gridcraft-bin").chmod(0o755) + shutil.copy2(TAR_LAUNCHER, tree / "gridcraft") + (tree / "gridcraft").chmod(0o755) + return tree / "gridcraft" + + def prefix(self, profile_root): + return ["<--launch-profile>", "", "<--profile-root>", f"<{profile_root}>"] + + def tokens(self, profile_root): + return self.prefix(profile_root) + ["<-->"] + + def test_every_argument_follows_the_profile_tokens(self): + launcher = self.install() + self.assertEqual(run([str(launcher)], cwd=self.root, env=self.env).stdout.splitlines(), + self.tokens(self.data / TAR_PROFILE)) + self.assertEqual( + run([str(launcher), "workbook with spaces.xlsx", "--other-name.xlsx"], cwd=self.root, env=self.env).stdout.splitlines(), + self.tokens(self.data / TAR_PROFILE) + ["", "<--other-name.xlsx>"], + ) + + def test_the_profile_root_falls_back_to_the_data_home_under_home(self): + launcher = self.install() + env = {"PATH": os.environ["PATH"], "HOME": str(self.home)} + self.assertEqual(run([str(launcher), "book.xlsx"], cwd=self.root, env=env).stdout.splitlines(), + self.tokens(self.home / ".local/share" / TAR_PROFILE) + [""]) + self.assertFalse(self.home.exists(), "the launcher creates no folder of its own") + + def test_a_version_query_asks_the_gui_in_the_launcher_form(self): + launcher = self.install() + for flag in ("--version", "-V"): + with self.subTest(flag=flag): + self.assertEqual(run([str(launcher), flag], cwd=self.root, env=self.env).stdout.splitlines(), + self.prefix(self.data / TAR_PROFILE) + ["<--version>"]) + + def test_a_launcher_profile_argv_passes_through_unchanged(self): + # The ArtCraft Launcher names its own profile and per-install root; the app validates the pair. + launcher = self.install() + argv = ["--launch-profile", "nightly-v1", "--profile-root", str(self.root / "launcher root"), "--", "book.xlsx"] + self.assertEqual(run([str(launcher), *argv], cwd=self.root, env=self.env).stdout.splitlines(), + [f"<{arg}>" for arg in argv]) + + def test_a_missing_gui_fails_before_anything_runs(self): + launcher = self.install() + (self.root / "tar/gridcraft-bin").unlink() + missing = run([str(launcher), "book.xlsx"], cwd=self.root, env=self.env, check=False) + self.assertNotEqual(missing.returncode, 0) + self.assertEqual(missing.stdout, "") + + def test_the_bytes_are_the_shared_template_rendered_for_gridcraft(self): + data = TAR_LAUNCHER.read_bytes() + self.assertEqual(hashlib.sha256(data).hexdigest(), TAR_LAUNCHER_SHA256, + "the tar launcher must stay byte for byte scripts/nightly-launcher.sh.in rendered for gridcraft") + self.assertIn(b'target="$dir/gridcraft-bin"', data) + self.assertIn(b'/ai.storyteller.gridcraft.nightly"', data) + self.assertNotIn(b"gridcraft-nightly/profile", data, "the profile root is the package identity") class FlatNightlyTar(unittest.TestCase): @@ -110,13 +183,13 @@ class FlatNightlyTar(unittest.TestCase): def test_the_flat_tar_stages_the_kit_layout(self): source = (ROOT / "packaging/linux/nightly.sh").read_text() self.assertIn('cp "$NIGHTLY_GUI" "$STAGE/gridcraft-bin"', source, "the GUI is -bin") - self.assertIn('"$ROOT/packaging/linux/nightly-launch.sh" "$STAGE/gridcraft"', source, "the launcher is ") + self.assertIn('"$ROOT/packaging/linux/nightly-tar-launch.sh" "$STAGE/gridcraft"', source, "the launcher is ") self.assertNotIn('"$STAGE/gridcraft-nightly"', source, "the flat tar's launcher is gridcraft") policy = (ROOT / "packaging/nightly-archive.py").read_text() self.assertIn('{"gridcraft", "gridcraft-bin", "gridcraft-nightly.png"}', policy) self.assertIn('required = {"gridcraft", "gridcraft-bin", "gridcraft-nightly.png"', policy) - launcher = LAUNCHER.read_text() - self.assertIn('"$here/gridcraft-bin"', launcher, "the launcher starts the GUI the tar ships") + launcher = TAR_LAUNCHER.read_text() + self.assertIn('target="$dir/gridcraft-bin"', launcher, "the launcher starts the GUI the tar ships") class StagedFormats(unittest.TestCase): diff --git a/packaging/linux/nightly-tar-launch.sh b/packaging/linux/nightly-tar-launch.sh new file mode 100755 index 0000000000..a8465b760a --- /dev/null +++ b/packaging/linux/nightly-tar-launch.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# Nightly launcher generated by craft-common-actions scripts/nightly-launcher.sh.in. Do not edit: +# the shared nightly producer accepts this file only byte for byte as rendered for the app. +set -eu +dir=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P) +readonly dir +target="$dir/gridcraft-bin" +readonly target +profile_root="${XDG_DATA_HOME:-$HOME/.local/share}/ai.storyteller.gridcraft.nightly" +readonly profile_root +case "${1-}" in + # The ArtCraft Launcher passes its own profile and per-install root; the app validates the pair. + --launch-profile) exec "$target" "$@" ;; + --version | -V) exec "$target" --launch-profile nightly-v1 --profile-root "$profile_root" --version ;; +esac +exec "$target" --launch-profile nightly-v1 --profile-root "$profile_root" -- "$@" diff --git a/packaging/linux/nightly.sh b/packaging/linux/nightly.sh index 9839623801..93d49a98fb 100755 --- a/packaging/linux/nightly.sh +++ b/packaging/linux/nightly.sh @@ -20,10 +20,11 @@ STAGE="$NIGHTLY_WORK/stage" mkdir -p "$STAGE" # The kit's tar layout: `gridcraft` is the launcher people run and `gridcraft-bin` is the GUI it # starts. An unpacked archive is isolated too, because the GUI refuses to start without a launch -# profile and the launcher is the only thing that supplies one. +# profile and the launcher is the only thing that supplies one. The launcher is craft-common-actions' +# canonical template rendered for this app (scripts/nightly_app.py launcher), not a local script. cp "$NIGHTLY_GUI" "$STAGE/gridcraft-bin" chmod 755 "$STAGE/gridcraft-bin" -cp "$ROOT/packaging/linux/nightly-launch.sh" "$STAGE/gridcraft" +cp "$ROOT/packaging/linux/nightly-tar-launch.sh" "$STAGE/gridcraft" chmod 755 "$STAGE/gridcraft" # The nightly channel's own icon (deeper field); the archive member name stays as the helper requires. cp "$ROOT/assets/app-icon/gridcraft-nightly.png" "$STAGE/gridcraft-nightly.png" From b1216a17e8f13ba6fab276bcb6dcfec79ba86601 Mon Sep 17 00:00:00 2001 From: skylar taylor-barrick Date: Wed, 25 Nov 2026 20:44:49 -0600 Subject: [PATCH 91/94] Switch on supervised nightlies on the nightly-signer branch (#4767) Supervised nightly switch-on, merged under Skylar's explicit Nightly 758 override after green CI, CodeRabbit on this head with no open threads, Sonar passing, and an independent adversarial review with no blockers. --- .github/nightly-signing-policy.json | 10 +- .github/workflows/nightly-sign.yml | 17 +- .github/workflows/nightly.yml | 8 +- docs/nightly-release-preparation.md | 55 +++-- packaging/nightly-release-tests.py | 326 +++++++++++++++++++++++++++- 5 files changed, 383 insertions(+), 33 deletions(-) diff --git a/.github/nightly-signing-policy.json b/.github/nightly-signing-policy.json index 02d5129b1c..111e18eb97 100644 --- a/.github/nightly-signing-policy.json +++ b/.github/nightly-signing-policy.json @@ -2,13 +2,13 @@ "schema": "craft-nightly-release-policy/v3", "repository": "storytold/gridcraft", "repository_id": 1408285582, - "producer_workflow_id": null, + "producer_workflow_id": 429713469, "producer_workflow_path": ".github/workflows/nightly.yml", - "producer_tooling_revision": "605d58766e8f536564da8fc81d3676ac86816dea", - "producer_workflow_ref": "storytold/craft-common-actions/.github/workflows/nightly-unsigned.yml@605d58766e8f536564da8fc81d3676ac86816dea", + "producer_tooling_revision": "be00e5ccd18b68e950c8a08532f2230e7c3d0cba", + "producer_workflow_ref": "storytold/craft-common-actions/.github/workflows/nightly-unsigned.yml@be00e5ccd18b68e950c8a08532f2230e7c3d0cba", "signer_workflow_path": ".github/workflows/nightly-sign.yml", - "signer_tooling_revision": "605d58766e8f536564da8fc81d3676ac86816dea", - "release_branch": "release", + "signer_tooling_revision": "be00e5ccd18b68e950c8a08532f2230e7c3d0cba", + "release_branch": "nightly-signer", "manual_actors": [ "bflatastic", "dylanmtaylor", diff --git a/.github/workflows/nightly-sign.yml b/.github/workflows/nightly-sign.yml index 4430db0945..4f7f25a9f8 100644 --- a/.github/workflows/nightly-sign.yml +++ b/.github/workflows/nightly-sign.yml @@ -1,7 +1,8 @@ name: GridCraft release-ref nightly signer -# Enabled for supervised manual dispatch on release. Main/release contents must match. -# A reusable callee does not change context; this must be a real top-level release dispatch. +# Enabled for supervised manual dispatch on the dedicated nightly-signer branch, which only ever +# fast-forwards to reviewed main commits (never the stable release branch). +# A reusable callee does not change context; this must be a real top-level signer-branch dispatch. on: workflow_dispatch: inputs: @@ -22,21 +23,23 @@ concurrency: jobs: release: - # Actual context guards: official repository, manual dispatch, real release branch. + # Actual context guards: official repository, manual dispatch, real nightly-signer branch. if: >- github.repository == 'storytold/gridcraft' && github.event_name == 'workflow_dispatch' && - github.ref == 'refs/heads/release' && github.ref_type == 'branch' + github.ref == 'refs/heads/nightly-signer' && github.ref_type == 'branch' permissions: contents: write actions: read checks: read attestations: write id-token: write - uses: storytold/craft-common-actions/.github/workflows/nightly-release.yml@605d58766e8f536564da8fc81d3676ac86816dea + uses: storytold/craft-common-actions/.github/workflows/nightly-release.yml@be00e5ccd18b68e950c8a08532f2230e7c3d0cba with: - tooling-revision: 605d58766e8f536564da8fc81d3676ac86816dea + tooling-revision: be00e5ccd18b68e950c8a08532f2230e7c3d0cba + app-name: gridcraft producer_run_id: ${{ inputs.producer_run_id }} producer_run_attempt: ${{ inputs.producer_run_attempt }} # No secrets: inherit or raw platform values in this caller. Only the isolated native - # callee job may bind the existing release environment and export keys in its signing step. + # callee job may bind the release environment and export its keys; that environment must + # admit nightly-signer alongside release before the first dispatch. diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index a201ce8588..0c9439d1fa 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -22,13 +22,13 @@ jobs: actions: read attestations: write id-token: write - uses: storytold/craft-common-actions/.github/workflows/nightly-unsigned.yml@605d58766e8f536564da8fc81d3676ac86816dea + uses: storytold/craft-common-actions/.github/workflows/nightly-unsigned.yml@be00e5ccd18b68e950c8a08532f2230e7c3d0cba with: - tooling-revision: 605d58766e8f536564da8fc81d3676ac86816dea + tooling-revision: be00e5ccd18b68e950c8a08532f2230e7c3d0cba app-name: gridcraft manual-actors: '["bflatastic","dylanmtaylor","echelon","FredApps","skylartaylor"]' craft-fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83 # One producer run builds every listed platform for one all-or-nothing release. The pin is the - # craft-common-actions main commit that merged #339 (bounded lineage compares), on top of the - # Linux/macOS signer (#342). + # craft-common-actions main commit that merged the exact-analysis admission (#371, after #370, + # #369 and #364). platforms: '["windows-x86_64","linux-x86_64","macos-aarch64"]' diff --git a/docs/nightly-release-preparation.md b/docs/nightly-release-preparation.md index 1568cfc23d..8a002d820f 100644 --- a/docs/nightly-release-preparation.md +++ b/docs/nightly-release-preparation.md @@ -1,11 +1,11 @@ # Windows, Linux and macOS release-ref nightly: supervised manual go-live **Enabled for supervised manual runs, not yet qualified.** The producer (`nightly.yml`, main) and the -signer (`nightly-sign.yml`, release) keep only their exact context guards and run when one of the reviewed +signer (`nightly-sign.yml`, on the dedicated `nightly-signer` branch) keep only their exact context guards and run when one of the reviewed manual actors dispatches them. There is no schedule yet. The installed policy [`.github/nightly-signing-policy.json`](../.github/nightly-signing-policy.json) is the v3 policy -adapted from `storytold/photocraft#16594`. Once `nightly.yml` lands on `main`, populate -`producer_workflow_id` before promoting the policy to `release`, read with: +adapted from `storytold/photocraft#16594`. `producer_workflow_id` is the registered +`nightly.yml` workflow id, read with: ```bash gh api repos/storytold/gridcraft/actions/workflows/nightly.yml --jq .id @@ -14,16 +14,38 @@ gh api repos/storytold/gridcraft/actions/workflows/nightly.yml --jq .id The callers pass no platform secrets. The unsigned reusable caller's maximum OIDC/attestation permissions are for its isolated attester; its compiler narrows to contents and Actions read only, with no OIDC, attestation write, release environment or platform signing secrets. -Shared tooling is pinned to `605d58766e8f536564da8fc81d3676ac86816dea`, the craft-common-actions -main commit that merged [#339](https://github.com/storytold/craft-common-actions/pull/339) (bounded -lineage compares and an issue reread at the end of candidate admission) on top of -[#342](https://github.com/storytold/craft-common-actions/pull/342) (policy v3, the `platforms` input -and the Linux and macOS legs). Both callers name it in `uses` and `tooling-revision`. A pin is reviewed -source availability, not provider, queue, native signing or crypto qualification. +Shared tooling is pinned to `be00e5ccd18b68e950c8a08532f2230e7c3d0cba`, the craft-common-actions +main commit that merged [#371](https://github.com/storytold/craft-common-actions/pull/371) (the +candidate is admitted on the built commit's own Sonar analysis, not main's latest) after +[#370](https://github.com/storytold/craft-common-actions/pull/370) (the Windows and macOS nightly +registry rows for the 14 apps) and +[#369](https://github.com/storytold/craft-common-actions/pull/369) (shared helper checkouts kept out +of the app's clean-source check, and macOS on `macos-15`), following +[#364](https://github.com/storytold/craft-common-actions/pull/364) (the signer may run on the +policy's signer branch) and [#363](https://github.com/storytold/craft-common-actions/pull/363) (the +multi-app pipeline, which makes the signer's `app-name` input required and admits any reviewed +registry app), with #342 (`a4f6fd51`, policy v3 and the `platforms` input) and #339 (`605d5876`) +earlier. Both callers name it in `uses` and `tooling-revision`. A pin is reviewed source +availability, not provider, queue, native signing or crypto qualification. +**Signer branch.** The signer runs on `refs/heads/nightly-signer`, not on the stable `release` +branch, so nightly signer files never need a stable release sync. The policy's `release_branch` +names it, the signer's guard requires it and its caller passes `app-name`. The branch only +fast-forwards to reviewed main commits, through the nightly-signer settings script's `advance` (no +queued signer run, a trust-closure scan, then the full diff of `.github/` and `packaging/`), and the +existing `release` environment must admit `nightly-signer` alongside `release` before the first +dispatch (a repository settings change, not a workflow one). Its trust closure is all of `.github/` +and `packaging/`, including `packaging/env.sh`, which `import-cert.sh` sources with the Apple keys. +On that branch only the pinned `nightly-sign.yml` caller may reach an environment: no app workflow +binds one, nothing else calls `nightly-release.yml`, and the only caller of the shared stable +`release.yml` is `release.yml`, whose callee must carry the stable-only environment guard. The +contract tests check the in-repo part on every main PR; the settings scan also resolves the callee. +Stable releases still come only from `refs/heads/release`. History does not carry over a switch +between `release` and `nightly-signer`, so the switch happens before the first publication. + Existing stable workflows are unchanged. **First runs.** The first runs are manual dispatches in this order: `nightly.yml` on main (only a -listed manual actor passes the producer's plan step), then `nightly-sign.yml` on `release` with that +listed manual actor passes the producer's plan step), then `nightly-sign.yml` on `nightly-signer` with that producer run ID and attempt, by a listed manual actor. **Manual actors.** `bflatastic`, `dylanmtaylor`, `echelon`, `FredApps` and `skylartaylor`, in the @@ -44,13 +66,13 @@ so there is no separate Linux or macOS caller job and the signer caller has no p ## Installed policy values and their sources Read on 2026-11-24; re-read anything that may have moved (and populate `producer_workflow_id` and -any Sonar debt snapshot) before the policy is promoted to `release`. +any Sonar debt snapshot) before `nightly-signer` is advanced to it. | Field | Value | Source | |---|---|---| | `repository_id` | `1408285582` | `gh api repos/storytold/gridcraft --jq .id` | -| `producer_workflow_id` | `null` (pending `main` registration) | Read with `gh api repos/storytold/gridcraft/actions/workflows/nightly.yml --jq .id` after `nightly.yml` lands on `main` | -| `producer_tooling_revision`, `signer_tooling_revision`, `producer_workflow_ref` | `605d5876…` (craft-common-actions #339) | The callers' pin | +| `producer_workflow_id` | `429713469` | `gh api repos/storytold/gridcraft/actions/workflows/nightly.yml` (path `.github/workflows/nightly.yml`, state `active`) | +| `producer_tooling_revision`, `signer_tooling_revision`, `producer_workflow_ref` | `be00e5cc…` (craft-common-actions exact-analysis admission, #371 after #370 and #369, following #364) | The callers' pin | | `manual_actors` / `automatic_signer_actors` | the five release managers / `[]` | release-managers team (id 19837241) members who can push; equals the producer caller's `manual-actors` | | `max_age_seconds`, `max_artifact_bytes` | `86400`, `2147483648` | Go-live checklist | | `platforms` | three rows | Suite stable identities (Windows Authenticode publisher subject, Linux OpenPGP release key fingerprint, macOS Apple Developer ID team `DJ6XS33FX8`) | @@ -63,8 +85,8 @@ any Sonar debt snapshot) before the policy is promoted to `release`. - `.github/workflows/nightly.yml`: default-main registration of the unsigned producer, named `GridCraft unsigned nightly`, enabled for manual dispatch by `manual-actors`; no signing secrets may be passed or inherited. -- `.github/workflows/nightly-sign.yml`: top-level release registration, enabled for manual dispatch, - and identical on main and release after reviewed promotion. It rejects wrong repository/event/actual branch, +- `.github/workflows/nightly-sign.yml`: top-level signer registration, enabled for manual dispatch + on `nightly-signer`, which carries a reviewed main commit. It rejects wrong repository/event/actual branch, including same-name tags. Its constant whole-run concurrency (`gridcraft-nightly-release`) is distinct from stable, cancellation is off and `queue: max` must be hosted-qualified. The caller itself passes no credentials; only the shared callee's sign jobs bind the `release` environment. @@ -82,6 +104,9 @@ any Sonar debt snapshot) before the policy is promoted to `release`. - Manual actors are exactly the reviewed release managers in both `nightly.yml` and `.github/nightly-signing-policy.json`, with `automatic_signer_actors` empty. - Root serialization in `nightly-sign.yml` remains literal (`group: gridcraft-nightly-release`, `cancel-in-progress: false`); it carries no `queue:` key while actionlint 1.7.12 rejects that key, and the value is re-added when the hosted queue is qualified. - Installed policy v3 fields, bounds, platforms, candidate workflows, and Sonar identity match `sonar-project.properties` and the callers. +- The `nightly-signer` trust-closure scan: no app workflow binds `environment:`, only + `nightly-sign.yml` calls `nightly-release.yml` at a 40-hex SHA, and the only caller of the + shared stable `release.yml` is `release.yml`. ## GridCraft's nightly-v1 flavor (the same branch) diff --git a/packaging/nightly-release-tests.py b/packaging/nightly-release-tests.py index ca9301cbfd..72191664ff 100755 --- a/packaging/nightly-release-tests.py +++ b/packaging/nightly-release-tests.py @@ -6,11 +6,21 @@ import hashlib import json from pathlib import Path import re +import textwrap import unittest ROOT = Path(__file__).resolve().parents[1] INSTALLED_POLICY = ROOT / ".github/nightly-signing-policy.json" +DISPATCHER = ROOT / ".github/workflows/nightly-dispatch.yml" +SIGNER_BRANCH = "nightly-signer" + + +def inline_scripts(path): + """Read literal run blocks, not a substitute for YAML/actionlint validation.""" + return [textwrap.dedent(block) for block in re.findall( + r"^ run: \|\n((?: .*\n|\n)+)", path.read_text(), re.MULTILINE)] + NIGHTLY_PLATFORMS = ("windows-x86_64", "linux-x86_64", "macos-aarch64") # Each platform's one trust field in policy v3, and the public stable identity it must name. NIGHTLY_TRUST = { @@ -275,7 +285,7 @@ class NightlyEnabledCallers(unittest.TestCase): "github.ref_type == 'branch' && (github.event_name == 'schedule' || " "github.event_name == 'workflow_dispatch')", "nightly-sign.yml": "github.repository == 'storytold/gridcraft' && github.event_name == 'workflow_dispatch' && " - "github.ref == 'refs/heads/release' && github.ref_type == 'branch'", + "github.ref == 'refs/heads/nightly-signer' && github.ref_type == 'branch'", } def test_enabled_jobs_keep_exact_context_guards(self): @@ -347,7 +357,7 @@ class NightlyInstalledPolicy(unittest.TestCase): self.assertEqual(set(self.policy), expected) self.assertEqual(self.policy["schema"], "craft-nightly-release-policy/v3") self.assertEqual(self.policy["repository"], "storytold/gridcraft") - self.assertEqual(self.policy["release_branch"], "release") + self.assertEqual(self.policy["release_branch"], SIGNER_BRANCH, "the signer runs on its dedicated branch") self.assertIs(type(self.policy["repository_id"]), int) self.assertGreater(self.policy["repository_id"], 0) # producer_workflow_id is null until nightly.yml is registered on main; once set, must be a positive int. @@ -459,6 +469,318 @@ class NightlyInstalledPolicy(unittest.TestCase): self.assertIn(item["type"], sonar["issue_types"]) self.assertRegex(item["hash"], r"^[0-9a-f]{32}$") + def test_sonar_policy_keeps_the_shared_candidate_contract(self): + """The Sonar shape craft-common-actions' candidate contract() admits, refused here first. + An empty issue scope, an accepted condition outside the reviewed issue types, a metric in both + lists, a missing live gate condition or a widened security bound is refused at admission, so + this suite must catch it before a nightly run can. `debt` stays empty, so any unresolved + vulnerability on main is still refused; accepting the new-code rating only records the + reviewed A threshold instead of demanding a clean rating the live gate does not. + """ + sonar = self.policy["candidate_policy"]["sonar"] + accepted = {"bugs": "BUG", "vulnerabilities": "VULNERABILITY", "code_smells": "CODE_SMELL", + "security_rating": "VULNERABILITY", "new_security_rating": "VULNERABILITY"} + gate = {"new_reliability_rating", "new_security_rating", "new_maintainability_rating", + "new_coverage", "new_duplicated_lines_density", "new_security_hotspots_reviewed"} + self.assertTrue(sonar["issue_types"], "an empty issue scope is refused as unreviewed") + self.assertEqual(len(sonar["issue_types"]), len(set(sonar["issue_types"]))) + metrics = {} + for field in ("accepted_conditions", "required_conditions"): + for condition in sonar[field]: + with self.subTest(field=field, metric=condition.get("metric")): + expected = {"metric", "comparator", "error_threshold"} + if field == "accepted_conditions": + expected.add("maximum") + self.assertEqual(set(condition), expected) + self.assertNotIn(condition["metric"], metrics, "one condition per gate metric") + metrics[condition["metric"]] = condition + self.assertIn(condition["comparator"], ("GT", "LT")) + self.assertRegex(condition["error_threshold"], r"^(?:0|[1-9][0-9]*)(?:\.[0-9]+)?$") + if field != "accepted_conditions": + continue + self.assertIn(condition["metric"], accepted, "an accepted metric outside the reviewed map") + self.assertIn(accepted[condition["metric"]], sonar["issue_types"], + "an accepted failure must lie inside the reviewed issue scope") + self.assertEqual(condition["comparator"], "GT") + self.assertRegex(condition["maximum"], r"^(?:0|[1-9][0-9]*)(?:\.[0-9]+)?$") + maximum = float(condition["maximum"]) + if condition["metric"] in ("security_rating", "new_security_rating"): + self.assertEqual(int(maximum), maximum, "the A..E bound is a whole rating") + self.assertTrue(1 <= maximum <= 5, "the security bound stays A..E") + self.assertEqual(condition["error_threshold"], "1", "the reviewed A threshold stays") + else: + self.assertLessEqual(maximum, len(sonar["debt"]), "accepted failures exceed the reviewed debt") + self.assertEqual({accepted[c["metric"]] for c in sonar["accepted_conditions"]}, set(sonar["issue_types"]), + "accepted conditions and reviewed issue types must cover the same scope") + self.assertEqual(set(metrics), gate, "every live gate condition stays gated exactly once") + + +SHARED = "storytold/craft-common-actions/.github/workflows/" +# App workflows reviewed to call the shared stable release.yml. That callee must carry the +# stable-only environment guard (dry runs and non-release refs bind no environment); the +# nightly-signer settings scan checks the resolved callee before creating or advancing the branch. +REVIEWED_STABLE_RELEASE_CALLERS = {"release.yml"} + + +def app_workflows(): + return {path.name: path.read_text() for path in sorted((ROOT / ".github/workflows").glob("*.y*ml"))} + + +WORKFLOW_KEY = re.compile(r'''("(?:[^"\\]|\\.)*"|'(?:[^']|'')*'|[^\s'"#{}\[\],:&*!|>%@`?-][^:#,{}]*?|-[^\s:#][^:#,{}]*?)\s*:(?:\s+(.*))?$''') + + +def _workflow_key(text): + if text.startswith('"'): + return None if "\\" in text else text[1:-1] + if text.startswith("'"): + return text[1:-1].replace("''", "'") + return text + + +def _workflow_value(text): + """A one-line scalar value without its comment and quotes; None when escaped or unterminated.""" + text = text.strip() + if text.startswith('"'): + quoted = re.match(r'"((?:[^"\\]|\\.)*)"\s*(?:#.*)?$', text) + return None if quoted is None or "\\" in quoted.group(1) else quoted.group(1) + if text.startswith("'"): + quoted = re.match(r"'((?:[^']|'')*)'\s*(?:#.*)?$", text) + return None if quoted is None else quoted.group(1).replace("''", "'") + return re.split(r"\s+#", text, maxsplit=1)[0].strip() + + +def _strip_comment(text): + """(text without its comment, unterminated) using a quote-aware scan. + + As in YAML, a quote opens a quoted scalar only where a scalar starts (line start or after + `:`, `-`, `,`, `{` or `[`), and a `#` starts a comment only outside quotes, at the start or + after whitespace. + """ + quote, index = None, 0 + while index < len(text): + char = text[index] + if quote == '"': + if char == "\\": + index += 2 + continue + if char == '"': + quote = None + elif quote == "'": + if char == "'": + if text[index + 1:index + 2] == "'": + index += 2 + continue + quote = None + elif char in "\"'" and text[:index].rstrip()[-1:] in ("", ":", "-", ",", "{", "["): + quote = char + elif char == "#" and (index == 0 or text[index - 1] in " \t"): + return text[:index].rstrip(), False + index += 1 + return text.rstrip(), quote is not None + + +FLOW_QUOTED = re.compile(r"\"(?:[^\"\\]|\\.)*\"|'(?:[^']|'')*'") +FLOW_FORBIDDEN_KEYS = {"environment", "uses"} + + +def workflow_entries(source): + """Every mapping entry in a workflow, plus the YAML forms this reader refuses. + + A narrow reader, not a YAML parser (none ships with the runner's Python). Each entry is + (line, key, value, multiline): plain, single- and double-quoted keys and one-line values in + block and simple one-line flow mappings. Block scalar bodies are skipped, and an entry whose + value is a block scalar or continues on the next lines is marked multiline. It refuses whatever + could hide a key from it: escaped double-quoted keys, explicit `?` keys, merge keys, anchors, + aliases, tags, tab indentation and nested or multi-line flow. + """ + lines = source.splitlines() + entries, refused, block = [], [], None + + def continues(index, indent): + for follow in lines[index + 1:]: + stripped = follow.strip() + if not stripped or stripped.startswith("#"): + continue + deeper = len(follow) - len(follow.lstrip(" ")) > indent + return deeper and not stripped.startswith("- ") and WORKFLOW_KEY.match(stripped) is None + return False + + for index, raw in enumerate(lines): + number = index + 1 + stripped = raw.strip() + indent = len(raw) - len(raw.lstrip(" ")) + if block is not None: + if not stripped or indent > block: + continue + block = None + if not stripped or stripped.startswith("#"): + continue + if "\t" in raw[:indent + 1]: + refused.append(f"line {number}: tab indentation"); continue + body, unterminated = _strip_comment(stripped) + if unterminated: + refused.append(f"line {number}: unterminated or multi-line quoted scalar"); continue + if not body: + continue + while body.startswith("- "): + body = body[2:].lstrip() + if body == "?" or body.startswith("? "): + refused.append(f"line {number}: explicit key"); continue + match = WORKFLOW_KEY.match(body) + value = body + if match is not None: + key, value = _workflow_key(match.group(1)), match.group(2) or "" + if key is None: + refused.append(f"line {number}: escaped double-quoted key"); continue + if key == "<<": + refused.append(f"line {number}: merge key"); continue + plain = re.sub(r"\$\{\{.*?\}\}", "", value).strip() + bare = re.sub(r"\"(?:[^\"\\]|\\.)*\"|'(?:[^']|'')*'", "''", plain) + if re.match(r"[&*!]", plain): + refused.append(f"line {number}: anchor, alias or tag") + is_block = re.fullmatch(r"[|>][0-9+-]*", plain) is not None + if match is not None: + entries.append((number, key, _workflow_value(value), + is_block or ((value == "" or not is_block) and continues(index, indent)))) + if "{" in bare and bare != "{}": + masked = re.fullmatch(r"\{([^{}\[\]]*)\}", FLOW_QUOTED.sub("''", value.strip())) + flow = re.fullmatch(r"\{([^{}\[\]]*)\}", value.strip()) + if any(set(scalar[1:-1]) & set("#{}[],") for scalar in FLOW_QUOTED.findall(value)): + refused.append(f"line {number}: flow mapping quoted scalar with # or flow punctuation") + elif masked is None or flow is None: + refused.append(f"line {number}: nested or multi-line flow mapping") + else: + # The masked text only proves the shape: a quoted key ("uses", 'environment') keeps + # its identity, so the entries are read from the original mapping text, never ''. + for item in flow.group(1).split(","): + entry = WORKFLOW_KEY.match(item.strip()) + key = _workflow_key(entry.group(1)) if entry else None + if key is None: + refused.append(f"line {number}: unreadable flow mapping entry") + elif key in FLOW_FORBIDDEN_KEYS: + refused.append(f"line {number}: {key} in a flow mapping (must be block style)") + else: + entries.append((number, key, _workflow_value(entry.group(2) or ""), False)) + if match is not None and is_block: + block = indent + return entries, refused + + +def workflow_keys(source): + """(line, key) for every mapping entry, plus the refused YAML forms.""" + entries, refused = workflow_entries(source) + return [(number, key) for number, key, _, _ in entries], refused + + +SHARED_CALLEE = re.compile(r"storytold/craft-common-actions/\.github/workflows/([\w.-]+\.ya?ml)@(\S+)", re.IGNORECASE) +INSPECTED_KEYS = {"environment", "uses"} + + +def trust_closure_problems(workflows): + """The nightly-signer trust-closure scan over app workflow sources; empty when the tree is safe. + + Every key it inspects comes from workflow_entries(), never a regex over the raw text. + """ + problems, stable_callers, signer_calls = [], set(), 0 + for name, source in workflows.items(): + entries, refused = workflow_entries(source) + problems.extend(name + " uses YAML the scan cannot read (" + reason + ")" for reason in refused) + for number, key, value, multiline in entries: + if key not in INSPECTED_KEYS: + continue + if key == "environment": + problems.append(f"{name} binds an environment directly (line {number})") + continue + if value is None or multiline: + problems.append(f"{name} has a uses value the scan cannot read (line {number})") + continue + callee = SHARED_CALLEE.fullmatch(value) + if callee is None: + if re.search(r"craft-common-actions", value, re.IGNORECASE) and re.search(r"workflows/(nightly-)?release\.ya?ml", value, re.IGNORECASE): + problems.append(f"{name} has an unrecognised shared release caller (line {number})") + continue + workflow, ref = callee.group(1), callee.group(2) + if workflow.lower() in ("nightly-release.yml", "nightly-release.yaml"): + if name == "nightly-sign.yml": + signer_calls += 1 + if name != "nightly-sign.yml" or not re.fullmatch(r"[0-9a-f]{40}", ref): + problems.append(name + " calls nightly-release.yml@" + ref) + if workflow.lower() in ("release.yml", "release.yaml"): + stable_callers.add(name) + if ref != "main" and not re.fullmatch(r"[0-9a-f]{40}", ref): + problems.append(name + " calls release.yml@" + ref + "; use @main or a reviewed full SHA") + if stable_callers != REVIEWED_STABLE_RELEASE_CALLERS: + problems.append("shared release.yml callers are " + ", ".join(sorted(stable_callers))) + if signer_calls != 1: + problems.append("nightly-sign.yml must call nightly-release.yml exactly once") + return problems + + +class NightlySignerBranchTrustClosure(unittest.TestCase): + """On refs/heads/nightly-signer, only the pinned signer caller may reach an environment.""" + + def test_trust_closure_scan_passes_on_this_tree(self): + self.assertEqual(trust_closure_problems(app_workflows()), []) + + def test_trust_closure_scan_refuses_each_route_into_an_environment(self): + tree = app_workflows() + bad = { + "a workflow binds an environment": {**tree, "extra.yml": "jobs:\n x:\n runs-on: ubuntu-latest\n environment: release\n"}, + "a double-quoted environment key": {**tree, "extra.yml": 'jobs:\n x:\n runs-on: ubuntu-latest\n "environment": release\n'}, + "a single-quoted environment key": {**tree, "extra.yml": "jobs:\n x:\n runs-on: ubuntu-latest\n 'environment' : release\n"}, + "an environment mapping": {**tree, "extra.yml": "jobs:\n x:\n runs-on: ubuntu-latest\n environment:\n name: release\n"}, + "an environment in a flow mapping": {**tree, "extra.yml": "jobs:\n x: {runs-on: ubuntu-latest, environment: release}\n"}, + "an escaped key": {**tree, "extra.yml": 'jobs:\n x:\n runs-on: ubuntu-latest\n "environ\\u006dent": release\n'}, + "a merge key": {**tree, "extra.yml": "base: &b\n runs-on: ubuntu-latest\njobs:\n x:\n <<: *b\n"}, + "an explicit key": {**tree, "extra.yml": "jobs:\n x:\n ? environment\n : release\n"}, + "a nested flow mapping": {**tree, "extra.yml": "jobs:\n x: {steps: [{run: a}]}\n"}, + "a double-quoted uses key copying the signer": {**tree, "extra.yml": 'jobs:\n x:\n "uses": ' + SHARED + "nightly-release.yml@" + "a" * 40 + "\n"}, + "a single-quoted uses key": {**tree, "extra.yml": "jobs:\n x:\n 'uses': " + SHARED + "nightly-release.yml@" + "a" * 40 + "\n"}, + "a quoted uses value": {**tree, "extra.yml": 'jobs:\n x:\n uses: "' + SHARED + "nightly-release.yml@" + "a" * 40 + '"\n'}, + "uses in a flow mapping": {**tree, "extra.yml": "jobs:\n x: {uses: " + SHARED + "nightly-release.yml@" + "a" * 40 + "}\n"}, + "a differently cased owner": {**tree, "extra.yml": "jobs:\n x:\n uses: Storytold/Craft-Common-Actions/.github/workflows/nightly-release.yml@" + "a" * 40 + "\n"}, + "a folded uses value": {**tree, "extra.yml": "jobs:\n x:\n uses: >-\n " + SHARED + "nightly-release.yml@" + "a" * 40 + "\n"}, + "a continued uses value": {**tree, "extra.yml": "jobs:\n x:\n uses: " + SHARED + "\n nightly-release.yml@" + "a" * 40 + "\n"}, + "a quoted second signer call": {**tree, "nightly-sign.yml": tree["nightly-sign.yml"] + " again:\n \"uses\": " + SHARED + "nightly-release.yml@" + "a" * 40 + "\n"}, + "a hash inside a quoted flow scalar": {**tree, "extra.yml": 'jobs:\n x: {name: "a} # b", runs-on: ubuntu-latest, environment: release, steps: []}\n'}, + "a single-quoted hash in a flow scalar": {**tree, "extra.yml": "jobs:\n x: {name: 'a # b', runs-on: ubuntu-latest}\n"}, + "a comma inside a quoted flow scalar": {**tree, "extra.yml": 'jobs:\n x: {name: "a, environment: release", runs-on: ubuntu-latest}\n'}, + "a bracket inside a quoted flow scalar": {**tree, "extra.yml": 'jobs:\n x: {name: "[a]", runs-on: ubuntu-latest}\n'}, + "an unterminated quote": {**tree, "extra.yml": 'jobs:\n x:\n name: "a\n b"\n runs-on: ubuntu-latest\n'}, + "environment in any flow mapping": {**tree, "extra.yml": "jobs:\n x:\n runs-on: ubuntu-latest\n with: {environment: release}\n"}, + "a double-quoted environment key in a flow mapping": {**tree, "extra.yml": 'jobs:\n x:\n runs-on: ubuntu-latest\n with: {"environment": release}\n'}, + "a single-quoted environment key in a flow mapping": {**tree, "extra.yml": "jobs:\n x:\n runs-on: ubuntu-latest\n with: {'environment': release}\n"}, + "a double-quoted uses key in a flow mapping": {**tree, "extra.yml": 'jobs:\n x: {"uses": ' + SHARED + "nightly-release.yml@" + "a" * 40 + "}\n"}, + "uses in any flow mapping": {**tree, "extra.yml": "jobs:\n x:\n steps:\n - {uses: actions/checkout@v4}\n"}, + "another caller of the signer": {**tree, "extra.yml": "jobs:\n x:\n uses: " + SHARED + "nightly-release.yml@" + "a" * 40 + "\n"}, + "a mutable signer pin": {**tree, "nightly-sign.yml": re.sub(r"nightly-release\.yml@[0-9a-f]{40}", "nightly-release.yml@main", tree["nightly-sign.yml"])}, + "a new stable release caller": {**tree, "extra.yml": "jobs:\n x:\n uses: " + SHARED + "release.yml@main\n"}, + "a stable caller on a branch or tag ref": {**tree, "release.yml": tree["release.yml"].replace(SHARED + "release.yml@main", SHARED + "release.yml@v1")}, + } + for label, workflows in bad.items(): + with self.subTest(case=label): + self.assertTrue(trust_closure_problems(workflows)) + + def test_quoted_keys_in_a_flow_mapping_are_read_not_masked(self): + entries, refused = workflow_entries('jobs:\n x: {runs-on: ubuntu-latest, "name": build}\n') + self.assertEqual(refused, []) + self.assertIn((2, "name", "build", False), entries, "a quoted key keeps its identity") + self.assertIn((2, "runs-on", "ubuntu-latest", False), entries) + _, refused = workflow_entries("jobs:\n x: {runs-on: ubuntu-latest, 'environment': release}\n") + self.assertEqual(refused, ["line 2: environment in a flow mapping (must be block style)"]) + + def test_signer_dispatch_guard_and_policy_name_the_same_branch(self): + sign = (ROOT / ".github/workflows/nightly-sign.yml").read_text() + (_, guard), = job_conditions(sign.split("\njobs:\n", 1)[1]) + self.assertIn("github.ref == 'refs/heads/" + SIGNER_BRANCH + "'", guard) + self.assertNotIn("refs/heads/release", sign, "the signer no longer runs on the stable branch") + self.assertEqual(re.findall(r"(?m)^ app-name: (\S+)$", sign), ["gridcraft"], "the shared signer needs the reviewed registry app") + # This app ships no completion dispatcher yet: that workflow forwards scheduled producers + # only, and no schedule is approved. Adding it is part of a reviewed cadence change. + self.assertFalse(DISPATCHER.exists(), "a completion dispatcher needs its own reviewed activation") + self.assertEqual(json.loads(INSTALLED_POLICY.read_text())["release_branch"], SIGNER_BRANCH) + self.assertFalse((ROOT / "docs/nightly-signing-policy.example.json").exists(), + "a policy example must then name the signer branch") if __name__ == "__main__": unittest.main(verbosity=2) From de4e878aa8b558346bce308e5694493d7adb8f81 Mon Sep 17 00:00:00 2001 From: skylar taylor-barrick Date: Thu, 26 Nov 2026 00:41:08 -0600 Subject: [PATCH 92/94] Re-pin nightly callers to craft-common-actions 8389cad8 (signer Windows fix) (#4777) Round-5 re-pin under Skylar's Nightly 891 signer-only roll (route A keeps the one-shared-pin invariant). Moves every nightly pin from craft-common-actions be00e5cc to 8389cad8, which carries the Windows ctime rule that stops the signer refusing a just-written JSON (#375). Only the pins and their docs move; no build or packaging code changes. --- .github/nightly-signing-policy.json | 6 +++--- .github/workflows/nightly-sign.yml | 4 ++-- .github/workflows/nightly.yml | 7 +++---- docs/nightly-release-preparation.md | 17 ++++------------- 4 files changed, 12 insertions(+), 22 deletions(-) diff --git a/.github/nightly-signing-policy.json b/.github/nightly-signing-policy.json index 111e18eb97..6c59485ccf 100644 --- a/.github/nightly-signing-policy.json +++ b/.github/nightly-signing-policy.json @@ -4,10 +4,10 @@ "repository_id": 1408285582, "producer_workflow_id": 429713469, "producer_workflow_path": ".github/workflows/nightly.yml", - "producer_tooling_revision": "be00e5ccd18b68e950c8a08532f2230e7c3d0cba", - "producer_workflow_ref": "storytold/craft-common-actions/.github/workflows/nightly-unsigned.yml@be00e5ccd18b68e950c8a08532f2230e7c3d0cba", + "producer_tooling_revision": "8389cad8b849ea6bdb5e15fbce16772c3457565a", + "producer_workflow_ref": "storytold/craft-common-actions/.github/workflows/nightly-unsigned.yml@8389cad8b849ea6bdb5e15fbce16772c3457565a", "signer_workflow_path": ".github/workflows/nightly-sign.yml", - "signer_tooling_revision": "be00e5ccd18b68e950c8a08532f2230e7c3d0cba", + "signer_tooling_revision": "8389cad8b849ea6bdb5e15fbce16772c3457565a", "release_branch": "nightly-signer", "manual_actors": [ "bflatastic", diff --git a/.github/workflows/nightly-sign.yml b/.github/workflows/nightly-sign.yml index 4f7f25a9f8..f263a8ffc3 100644 --- a/.github/workflows/nightly-sign.yml +++ b/.github/workflows/nightly-sign.yml @@ -34,9 +34,9 @@ jobs: checks: read attestations: write id-token: write - uses: storytold/craft-common-actions/.github/workflows/nightly-release.yml@be00e5ccd18b68e950c8a08532f2230e7c3d0cba + uses: storytold/craft-common-actions/.github/workflows/nightly-release.yml@8389cad8b849ea6bdb5e15fbce16772c3457565a with: - tooling-revision: be00e5ccd18b68e950c8a08532f2230e7c3d0cba + tooling-revision: 8389cad8b849ea6bdb5e15fbce16772c3457565a app-name: gridcraft producer_run_id: ${{ inputs.producer_run_id }} producer_run_attempt: ${{ inputs.producer_run_attempt }} diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 0c9439d1fa..94c3a2f7a1 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -22,13 +22,12 @@ jobs: actions: read attestations: write id-token: write - uses: storytold/craft-common-actions/.github/workflows/nightly-unsigned.yml@be00e5ccd18b68e950c8a08532f2230e7c3d0cba + uses: storytold/craft-common-actions/.github/workflows/nightly-unsigned.yml@8389cad8b849ea6bdb5e15fbce16772c3457565a with: - tooling-revision: be00e5ccd18b68e950c8a08532f2230e7c3d0cba + tooling-revision: 8389cad8b849ea6bdb5e15fbce16772c3457565a app-name: gridcraft manual-actors: '["bflatastic","dylanmtaylor","echelon","FredApps","skylartaylor"]' craft-fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83 # One producer run builds every listed platform for one all-or-nothing release. The pin is the - # craft-common-actions main commit that merged the exact-analysis admission (#371, after #370, - # #369 and #364). + # craft-common-actions main commit that merged 8389cad8 (#375, the signer Windows fix). platforms: '["windows-x86_64","linux-x86_64","macos-aarch64"]' diff --git a/docs/nightly-release-preparation.md b/docs/nightly-release-preparation.md index 8a002d820f..94f87ef365 100644 --- a/docs/nightly-release-preparation.md +++ b/docs/nightly-release-preparation.md @@ -14,18 +14,9 @@ gh api repos/storytold/gridcraft/actions/workflows/nightly.yml --jq .id The callers pass no platform secrets. The unsigned reusable caller's maximum OIDC/attestation permissions are for its isolated attester; its compiler narrows to contents and Actions read only, with no OIDC, attestation write, release environment or platform signing secrets. -Shared tooling is pinned to `be00e5ccd18b68e950c8a08532f2230e7c3d0cba`, the craft-common-actions -main commit that merged [#371](https://github.com/storytold/craft-common-actions/pull/371) (the -candidate is admitted on the built commit's own Sonar analysis, not main's latest) after -[#370](https://github.com/storytold/craft-common-actions/pull/370) (the Windows and macOS nightly -registry rows for the 14 apps) and -[#369](https://github.com/storytold/craft-common-actions/pull/369) (shared helper checkouts kept out -of the app's clean-source check, and macOS on `macos-15`), following -[#364](https://github.com/storytold/craft-common-actions/pull/364) (the signer may run on the -policy's signer branch) and [#363](https://github.com/storytold/craft-common-actions/pull/363) (the -multi-app pipeline, which makes the signer's `app-name` input required and admits any reviewed -registry app), with #342 (`a4f6fd51`, policy v3 and the `platforms` input) and #339 (`605d5876`) -earlier. Both callers name it in `uses` and `tooling-revision`. A pin is reviewed source +Shared tooling is pinned to `8389cad8b849ea6bdb5e15fbce16772c3457565a`, the craft-common-actions +main commit that merged the signer Windows fix (#375), following the shared work already +reviewed here. Both callers name it in `uses` and `tooling-revision`. A pin is reviewed source availability, not provider, queue, native signing or crypto qualification. **Signer branch.** The signer runs on `refs/heads/nightly-signer`, not on the stable `release` branch, so nightly signer files never need a stable release sync. The policy's `release_branch` @@ -72,7 +63,7 @@ any Sonar debt snapshot) before `nightly-signer` is advanced to it. |---|---|---| | `repository_id` | `1408285582` | `gh api repos/storytold/gridcraft --jq .id` | | `producer_workflow_id` | `429713469` | `gh api repos/storytold/gridcraft/actions/workflows/nightly.yml` (path `.github/workflows/nightly.yml`, state `active`) | -| `producer_tooling_revision`, `signer_tooling_revision`, `producer_workflow_ref` | `be00e5cc…` (craft-common-actions exact-analysis admission, #371 after #370 and #369, following #364) | The callers' pin | +| `producer_tooling_revision`, `signer_tooling_revision`, `producer_workflow_ref` | `8389cad8…` (the signer Windows fix (#375)) | The callers' pin | | `manual_actors` / `automatic_signer_actors` | the five release managers / `[]` | release-managers team (id 19837241) members who can push; equals the producer caller's `manual-actors` | | `max_age_seconds`, `max_artifact_bytes` | `86400`, `2147483648` | Go-live checklist | | `platforms` | three rows | Suite stable identities (Windows Authenticode publisher subject, Linux OpenPGP release key fingerprint, macOS Apple Developer ID team `DJ6XS33FX8`) | From aab0a9c385ba5ee7e9817680218f2d28b03db046 Mon Sep 17 00:00:00 2001 From: skylar taylor-barrick Date: Thu, 26 Nov 2026 05:30:10 -0600 Subject: [PATCH 93/94] Nightly: open the Launcher's files rather than its `--`, and stop blocking a refused launch on macOS (#4775) Nightly launch fix under Skylar's Exec 454: the Launcher's trailing `--` no longer reaches the file list, and a refused launch no longer blocks on macOS (the reason goes to stderr and the app exits 2). Folds in the review rounds: only options before `--` name the control channel (`-- --control` opens a document), documents keep command-line order across the separator, the launcher fixture takes the platform's absolute profile root, and the fixture is rustfmt-clean. --- apps/gridcraft/src/main.rs | 167 ++++++++++++++++++++++++++++++------- 1 file changed, 138 insertions(+), 29 deletions(-) diff --git a/apps/gridcraft/src/main.rs b/apps/gridcraft/src/main.rs index 9da2a92121..049f6b901d 100644 --- a/apps/gridcraft/src/main.rs +++ b/apps/gridcraft/src/main.rs @@ -268,14 +268,23 @@ fn initialize_nightly_process_identity() -> Result<(), process_identity::Identit ) } -/// Tell a desktop user why a nightly launch was refused. A headless form (`--version` on a runner) -/// never gets here: the version query is answered before this and before any profile work. +/// Whether a refusal may also open a native message box. Standard error always carries the reason; +/// this only adds a box where one renders without the app's event loop. Never on macOS: rfd's alert +/// there needs the AppKit run loop this start has not reached, so a refused nightly launch hung in +/// an invisible modal instead of exiting (GridCraft Mac smoke, 2026-11-26). +fn refusal_dialog(flavor: build_flavor::BuildFlavor, desktop_session: bool, macos: bool) -> bool { + build_flavor::needs_native_error(flavor, desktop_session) && !macos +} + +/// Tell a desktop user why a nightly launch was refused, in a native box where one renders without the +/// app's event loop (Windows, X11/Wayland), and on standard error always. A headless form (`--version` +/// on a runner) never gets here: the version query is answered before this and before any profile work. fn report_launch_profile_error(error: &str) { eprintln!("GridCraft launch profile: {error}"); let desktop_session = cfg!(windows) || cfg!(target_os = "macos") || (cfg!(target_os = "linux") && ["DISPLAY", "WAYLAND_DISPLAY"].into_iter().any(|key| std::env::var_os(key).is_some_and(|v| !v.is_empty()))); - if build_flavor::needs_native_error(build_flavor::COMPILED, desktop_session) { + if refusal_dialog(build_flavor::COMPILED, desktop_session, cfg!(target_os = "macos")) { if let Err(error) = initialize_nightly_process_identity() { eprintln!("GridCraft launch profile: {error}"); return; @@ -330,6 +339,55 @@ fn prepare_launch() -> Option> { Some(early.args) } +/// The app's own command line, once the launch profile's tokens are gone: `--control`, +/// `--control-token`, `--sample` and the files to open. `--` ends the options, and everything after +/// it is a file, even a name that reads like one — that is how the Launcher hands a nightly its +/// documents (`launch_profile::parse` puts the separator first), so the separator itself is never +/// opened as a file. +#[derive(Debug, Default, PartialEq)] +struct DesktopArgs { + control_port: Option, + control_token: Option, + sample: Option, + files: Vec, +} + +fn desktop_args(args: &[String], control_port: Option, control_token: Option) -> DesktopArgs { + let mut parsed = DesktopArgs { control_port, control_token, ..DesktopArgs::default() }; + let mut i = 0; + while i < args.len() { + match args[i].as_str() { + "--" => { + parsed.files.extend(args[i + 1..].iter().cloned()); + break; + } + "--control" => { + i += 1; + parsed.control_port = args.get(i).and_then(|p| p.parse().ok()); + } + "--control-token" => { + i += 1; + parsed.control_token = args.get(i).cloned(); + } + "--sample" => { + i += 1; + parsed.sample = Some(args.get(i).cloned().unwrap_or_else(|| "sales".into())); + } + a if a.starts_with("-psn_") => {} + a => parsed.files.push(a.to_string()), + } + i += 1; + } + parsed +} + +/// A nightly owns no control channel, and only options count: everything after `--` is a file, so a +/// document named `--control` is opened rather than read as a flag. +fn nightly_control_refused(nightly: bool, args: &[String]) -> bool { + let options_end = args.iter().position(|a| a == "--").unwrap_or(args.len()); + nightly && args[..options_end].iter().any(|a| a == "--control" || a == "--control-token") +} + fn main() -> eframe::Result<()> { // A confined launcher run (`gridcraft_sandbox::launch_command`, which a Python cell starts from // this same executable) comes before everything else: it opens no window, writes no log, and @@ -392,34 +450,14 @@ fn main() -> eframe::Result<()> { } // The control channel is a stable-only service: a nightly window owns no port, writes no // token and never inherits the stable app's `GRIDCRAFT_CONTROL_PORT`/`GRIDCRAFT_CONTROL_TOKEN`. - if nightly && args.iter().any(|a| a == "--control" || a == "--control-token") { + if nightly_control_refused(nightly, &args) { eprintln!("GridCraft Nightly: the control channel is not part of the nightly channel"); std::process::exit(2); } - let mut control_port: Option = (!nightly).then(|| std::env::var("GRIDCRAFT_CONTROL_PORT").ok().and_then(|p| p.parse().ok())).flatten(); - let mut control_token: Option = (!nightly).then(|| std::env::var("GRIDCRAFT_CONTROL_TOKEN").ok()).flatten(); - let mut sample: Option = None; - let mut files: Vec = Vec::new(); - let mut i = 0; - while i < args.len() { - match args[i].as_str() { - "--control" => { - i += 1; - control_port = args.get(i).and_then(|p| p.parse().ok()); - } - "--control-token" => { - i += 1; - control_token = args.get(i).cloned(); - } - "--sample" => { - i += 1; - sample = Some(args.get(i).cloned().unwrap_or_else(|| "sales".into())); - } - a if a.starts_with("-psn_") => {} - a => files.push(a.to_string()), - } - i += 1; - } + let control_port: Option = (!nightly).then(|| std::env::var("GRIDCRAFT_CONTROL_PORT").ok().and_then(|p| p.parse().ok())).flatten(); + let control_token: Option = (!nightly).then(|| std::env::var("GRIDCRAFT_CONTROL_TOKEN").ok()).flatten(); + let parsed = desktop_args(&args, control_port, control_token); + let (control_port, control_token, sample, files) = (parsed.control_port, parsed.control_token, parsed.sample, parsed.files); // The log file lives in the settings folder, next to the preferences; opened after the // arguments, so `--version` leaves no file behind. Records logged until now are written to it // first. Runs without preferences (agents' test runs) log to standard error only, so they @@ -449,7 +487,6 @@ fn main() -> eframe::Result<()> { if !nightly { app.start_update_check(); } - let control_port = control_port; load_prefs(&mut app); // Stamp the startup workbook's author from the persisted user name. if app.session.documents().is_empty() { @@ -616,3 +653,75 @@ mod packaging_tests { } } } + +#[cfg(test)] +mod launch_separator_tests { + use super::*; + use crate::build_flavor::BuildFlavor; + + /// The profile root a Launcher run is started with: absolute for the platform the test runs on. + /// `launch_profile::parse` refuses a root that is relative there, and a POSIX path has no drive + /// or UNC prefix, so it is not absolute on Windows - where CI runs these tests too. + fn launcher_root() -> &'static str { + if cfg!(windows) { r"C:\NightlyData\profiles\gridcraft" } else { "/nightly-data/profiles/gridcraft" } + } + + /// The argv the Launcher starts a nightly with, extended by `tail`, as the start then reads it. + fn launcher_argv(tail: &[&str]) -> Vec { + let mut argv: Vec = + ["--launch-profile", "nightly-v1", "--profile-root", launcher_root(), "--"].iter().map(std::ffi::OsString::from).collect(); + argv.extend(tail.iter().map(std::ffi::OsString::from)); + launch_profile::parse(argv).unwrap().args.iter().map(|a| a.to_string_lossy().into_owned()).collect() + } + + #[test] + fn the_other_platforms_root_spelling_is_refused_as_relative() { + let foreign = if cfg!(windows) { "/nightly-data/profiles/gridcraft" } else { r"C:\NightlyData\profiles\gridcraft" }; + let argv: Vec = + ["--launch-profile", "nightly-v1", "--profile-root", foreign, "--"].iter().map(std::ffi::OsString::from).collect(); + assert!(launch_profile::parse(argv).is_err(), "a root that is not absolute on this platform must be refused"); + } + + #[test] + fn the_launchers_separator_is_never_a_file() { + let parsed = desktop_args(&launcher_argv(&[]), None, None); + assert_eq!(parsed, DesktopArgs::default(), "the separator must not reach the file list"); + } + + #[test] + fn files_after_the_separator_are_opened_in_order() { + assert_eq!(desktop_args(&launcher_argv(&["a.file"]), None, None).files, ["a.file"]); + let parsed = desktop_args(&launcher_argv(&["a.file", "--version", "--sample"]), None, None); + assert_eq!(parsed.files, ["a.file", "--version", "--sample"], "after -- every word is a file"); + assert_eq!((parsed.sample, parsed.control_port), (None, None)); + } + + #[test] + fn a_control_flag_after_the_separator_is_a_file_not_a_refusal() { + let argv = launcher_argv(&["--control"]); + assert!(!nightly_control_refused(true, &argv), "a document named --control must open, not refuse"); + let parsed = desktop_args(&argv, None, None); + assert_eq!((parsed.control_port, parsed.files), (None, vec!["--control".to_string()])); + } + + #[test] + fn a_control_flag_before_the_separator_still_names_the_port() { + let with_file = vec!["--control".to_string(), "7979".to_string(), "--".to_string(), "a.file".to_string()]; + assert!(nightly_control_refused(true, &with_file)); + let parsed = desktop_args(&with_file, None, None); + assert_eq!((parsed.control_port, parsed.files), (Some(7979), vec!["a.file".to_string()])); + let plain = vec!["--control".to_string(), "7979".to_string()]; + assert!(nightly_control_refused(true, &plain)); + let parsed = desktop_args(&plain, None, None); + assert_eq!((parsed.control_port, parsed.files), (Some(7979), Vec::::new())); + assert!(!nightly_control_refused(false, &plain), "the stable app keeps its control channel"); + } + + #[test] + fn a_refusal_never_blocks_on_a_modal_before_the_event_loop_on_macos() { + assert!(refusal_dialog(BuildFlavor::NightlyV1, true, false), "a desktop refusal still shows the box where one renders"); + assert!(!refusal_dialog(BuildFlavor::NightlyV1, true, true), "macOS has no run loop yet: the modal would hang"); + assert!(!refusal_dialog(BuildFlavor::NightlyV1, false, false), "a headless session has no box"); + assert!(!refusal_dialog(BuildFlavor::Stable, true, false), "only a nightly refusal explains itself in a box"); + } +} From 4318d0e82ea2349054c4ee2042032f9a590d625b Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Thu, 26 Nov 2026 21:49:35 +0700 Subject: [PATCH 94/94] rustfmt the main merge under main's formatting config --- crates/ui-egui/src/app.rs | 16 ++++++++++++++-- crates/ui-egui/src/grid.rs | 8 +++++++- crates/ui-egui/src/grid/tests.rs | 16 ++++++++++++++-- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index bf83f6c928..894cc3257e 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -376,7 +376,13 @@ mod lifecycle_tests { use egui::{Event, Modifiers, MouseWheelUnit, TouchPhase, vec2}; let ctx = egui::Context::default(); let mut app = app(); - let wheel = |modifiers| Event::MouseWheel { unit: MouseWheelUnit::Point, source: egui::MouseWheelSource::Unknown, delta: vec2(0.0, 3.0), phase: TouchPhase::Move, modifiers }; + let wheel = |modifiers| Event::MouseWheel { + unit: MouseWheelUnit::Point, + source: egui::MouseWheelSource::Unknown, + delta: vec2(0.0, 3.0), + phase: TouchPhase::Move, + modifiers, + }; app.synthetic.push_back(vec![wheel(Modifiers::CTRL)]); app.synthetic.push_back(vec![wheel(Modifiers::NONE)]); let mut raw = egui::RawInput::default(); @@ -388,7 +394,13 @@ mod lifecycle_tests { app.synthetic_injected_at_pass = None; let mut raw = egui::RawInput::default(); app.raw_input_hook(&ctx, &mut raw); - let end = Event::MouseWheel { unit: MouseWheelUnit::Point, source: egui::MouseWheelSource::Unknown, delta: egui::Vec2::ZERO, phase: TouchPhase::End, modifiers: Modifiers::NONE }; + let end = Event::MouseWheel { + unit: MouseWheelUnit::Point, + source: egui::MouseWheelSource::Unknown, + delta: egui::Vec2::ZERO, + phase: TouchPhase::End, + modifiers: Modifiers::NONE, + }; assert_eq!(raw.events, vec![end, wheel(Modifiers::NONE)]); } diff --git a/crates/ui-egui/src/grid.rs b/crates/ui-egui/src/grid.rs index 2ac3bf5a47..b0d34890bf 100644 --- a/crates/ui-egui/src/grid.rs +++ b/crates/ui-egui/src/grid.rs @@ -83,7 +83,13 @@ pub(crate) fn end_stuck_ctrl_wheel(events: &mut Vec, ctrl_wheel: &m egui::TouchPhase::Start => *ctrl_wheel = ctrl, egui::TouchPhase::Move if ctrl => *ctrl_wheel = true, egui::TouchPhase::Move if *ctrl_wheel => { - out.push(egui::Event::MouseWheel { unit: *unit, source: *source, delta: egui::Vec2::ZERO, phase: egui::TouchPhase::End, modifiers: *modifiers }); + out.push(egui::Event::MouseWheel { + unit: *unit, + source: *source, + delta: egui::Vec2::ZERO, + phase: egui::TouchPhase::End, + modifiers: *modifiers, + }); *ctrl_wheel = false; } egui::TouchPhase::Move => {} diff --git a/crates/ui-egui/src/grid/tests.rs b/crates/ui-egui/src/grid/tests.rs index 38519590a2..f2689f71c5 100644 --- a/crates/ui-egui/src/grid/tests.rs +++ b/crates/ui-egui/src/grid/tests.rs @@ -408,8 +408,20 @@ fn upward_text_with_middle_align_is_centred_in_a_merged_block() { fn a_wheel_turn_without_ctrl_ends_a_ctrl_wheel_touch() { use super::end_stuck_ctrl_wheel; use egui::{Event, Modifiers, MouseWheelUnit, TouchPhase, vec2}; - let wheel = |phase, modifiers| Event::MouseWheel { unit: MouseWheelUnit::Point, source: egui::MouseWheelSource::Unknown, delta: vec2(0.0, 3.0), phase, modifiers }; - let end = Event::MouseWheel { unit: MouseWheelUnit::Point, source: egui::MouseWheelSource::Unknown, delta: egui::Vec2::ZERO, phase: TouchPhase::End, modifiers: Modifiers::NONE }; + let wheel = |phase, modifiers| Event::MouseWheel { + unit: MouseWheelUnit::Point, + source: egui::MouseWheelSource::Unknown, + delta: vec2(0.0, 3.0), + phase, + modifiers, + }; + let end = Event::MouseWheel { + unit: MouseWheelUnit::Point, + source: egui::MouseWheelSource::Unknown, + delta: egui::Vec2::ZERO, + phase: TouchPhase::End, + modifiers: Modifiers::NONE, + }; let mut ctrl_wheel = false; // Wayland: a plain turn starts a touch that never ends; nothing to change yet. let mut events = vec![wheel(TouchPhase::Start, Modifiers::NONE), wheel(TouchPhase::Move, Modifiers::NONE)];