Fix-up: Insert Copied Cells target and PivotChart anchor use #206's checked cell_param

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon ThomasandClaude Opus 5.5 committed 2026-10-11 14:34:37 -04:00
1 parent a9f9b09acc
commit 743ca809cc
3 files changed
+5 -10

No files matched your search

+2 -1
View File
@@ -1338,7 +1338,8 @@ fn insert_pivot_chart(s: &mut Session, p: &Json) -> Result<Json> {
let series = pv::chart_series(&sh.name, area.start, &out);
let t = str_param(p, "type").unwrap_or("column");
let kind = super::insert::chart_kind(t, str_param(p, "subtype").unwrap_or(""));
let at = cell_param(p, "at").unwrap_or_else(|| CellRef::new(area.start.row, area.end.col.saturating_add(2).min(gridcraft_core::MAX_COLS - 1)));
let at =
cell_param(s, p, "at")?.unwrap_or_else(|| CellRef::new(area.start.row, area.end.col.saturating_add(2).min(gridcraft_core::MAX_COLS - 1)));
let title = match p.get("title") {
Some(Json::String(t)) => Some(t.clone()),
Some(Json::Null) => None,
+1 -4
View File
@@ -400,10 +400,7 @@ fn insert_copied_cells(s: &mut Session, p: &Json) -> Result<Json> {
let Some(clip) = s.clipboard.clone() else { return Err(EngineError::Other("Nothing to paste.".into())) };
let sheet = target_sheet(s, p)?;
let d = s.doc()?;
let at = match str_param(p, "at") {
Some(t) => cell_param(p, "at").ok_or_else(|| bad("home.insertCopiedCells", format!("not a cell: {t}")))?,
None => d.selection.current().start,
};
let at = cell_param_on(s, p, "at", sheet)?.unwrap_or(d.selection.current().start);
let shift = str_param(p, "shift").unwrap_or("down");
if shift != "down" && shift != "right" {
return Err(bad("home.insertCopiedCells", format!("unknown `shift`: {shift} (down or right)")));
+2 -5
View File
@@ -2115,11 +2115,8 @@ fn select_ranges(app: &mut SheetApp, r: RangeRef, add: bool, active: CellRef) {
let clicked = r.a1();
let ranges = toggled_ranges(current, clicked.clone(), add);
// A removed area takes the active cell with it; `selection.set` then puts it at the start of the last area.
let params = if ranges.contains(&clicked) {
json!({"range": ranges.join(","), "active": active.a1()})
} else {
json!({"range": ranges.join(",")})
};
let params =
if ranges.contains(&clicked) { json!({"range": ranges.join(","), "active": active.a1()}) } else { json!({"range": ranges.join(",")}) };
let _ = app.session.run("selection.set", params);
}