mirror of
https://github.com/storytold/gridcraft.git
synced 2026-11-01 22:56:54 -06:00
Merge pull request #152 from nihilist-narwhal/fix-whole-sheet-selection
Whole-sheet selection: Fill and Remove Duplicates no longer run out of memory or time
This commit is contained in:
@@ -112,7 +112,8 @@ fn data_range(s: &Session, p: &Json) -> Result<RangeRef> {
|
||||
}
|
||||
let sel = d.selection.current();
|
||||
if !sel.is_single() {
|
||||
let used = sh.used_range().unwrap_or(sel);
|
||||
// An empty sheet has no data to work on: just the active cell.
|
||||
let Some(used) = sh.used_range() else { return Ok(RangeRef::cell(d.selection.active)) };
|
||||
return Ok(sel.intersection(&used).unwrap_or(sel));
|
||||
}
|
||||
Ok(current_region(sh, d.selection.active))
|
||||
@@ -668,6 +669,9 @@ fn remove_duplicates(s: &mut Session, p: &Json) -> Result<Json> {
|
||||
let r = data_range(s, p)?;
|
||||
let d = s.doc()?;
|
||||
let sh = d.wb.active().ok_or(EngineError::NoDocument)?;
|
||||
// Rows and columns past the data are blank: only the part with data is compared (whole
|
||||
// columns compared a million blank rows and reported them as removed duplicates).
|
||||
let r = sh.used_range().and_then(|u| r.intersection(&u)).unwrap_or(RangeRef::cell(r.start));
|
||||
let header = bool_param(p, "header").unwrap_or_else(|| guess_header(&d.wb, sh, r));
|
||||
let cols: Vec<u32> = p
|
||||
.get("columns")
|
||||
|
||||
Reference in New Issue
Block a user