mirror of
https://github.com/storytold/gridcraft.git
synced 2026-11-19 00:26:33 +00:00
FORMULATEXT and the in-cell editor keep Hidden formulas hidden (#3298)
* FORMULATEXT and the cell editor keep a hidden formula's source hidden * address review: recalculate formulas when sheet protection changes * address review: skip the full recalculation for a no-op unprotect * address review: recalculate on protect/unprotect without marking the edit structural
This commit is contained in:
1 parent
e14f783503
commit
bc2dabc7ea
5 files changed
+56
-6
No files matched your search
@@ -366,6 +366,10 @@ pub struct Ctx<'a> {
|
||||
pub wb: Workbook,
|
||||
pub changed: Vec<Key>,
|
||||
pub structural: bool,
|
||||
/// Recalculate every formula without the other effects of `structural` (table headers are not
|
||||
/// resynchronized, array formulas are still checked): for edits that change only what a
|
||||
/// function reads, like sheet protection.
|
||||
pub recalc_all: bool,
|
||||
pub sel: &'a mut Selection,
|
||||
/// Rows whose automatic height should be recomputed (sheet, row).
|
||||
pub fit_rows: Vec<(usize, u32)>,
|
||||
@@ -400,13 +404,14 @@ pub(crate) fn commit<R>(d: &mut DocState, f: impl FnOnce(&mut Ctx) -> Result<R>)
|
||||
wb: (*d.wb).clone(),
|
||||
changed: Vec::new(),
|
||||
structural: false,
|
||||
recalc_all: false,
|
||||
sel: &mut sel,
|
||||
fit_rows: Vec::new(),
|
||||
protection_checked: false,
|
||||
edits: Vec::new(),
|
||||
};
|
||||
let r = f(&mut ctx)?;
|
||||
let Ctx { mut wb, mut changed, structural, mut fit_rows, protection_checked, edits, .. } = ctx;
|
||||
let Ctx { mut wb, mut changed, structural, recalc_all, mut fit_rows, protection_checked, edits, .. } = ctx;
|
||||
// Equations whose source changed (or that arrived without a layout, as from a paste) are
|
||||
// laid out here, so painting only ever reads the cache.
|
||||
wb.refresh_equations();
|
||||
@@ -435,7 +440,7 @@ pub(crate) fn commit<R>(d: &mut DocState, f: impl FnOnce(&mut Ctx) -> Result<R>)
|
||||
if let Some(t0) = t0 {
|
||||
eprintln!("commit: edit {:?}, {} changed", since(t0), changed.len());
|
||||
}
|
||||
if structural {
|
||||
if structural || recalc_all {
|
||||
d.calc.recalc_all(&mut wb);
|
||||
} else if !changed.is_empty() {
|
||||
d.calc.cells_changed(&mut wb, &changed);
|
||||
|
||||
Reference in new issue
Block a user