mirror of
https://github.com/storytold/gridcraft.git
synced 2026-10-24 10:46:50 -06:00
- range.setValues with parse: false still turns on Wrap Text for a line break (CodeRabbit). - Japanese: the fill-handle hint says AutoFill (オートフィル), not paint (CodeRabbit). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
fe2f9a7582
commit
f1e29fa828
@@ -333,11 +333,14 @@ fn range_set_values(s: &mut Session, p: &Json) -> Result<Json> {
|
||||
// Text as given: no date or number reading, and a leading `'` is part of the
|
||||
// text rather than the marker that makes it text. A formula is still a
|
||||
// formula, which is what the ticket asks for and what `=` means in a cell.
|
||||
Json::String(text) if !parse && !text.starts_with('=') => Some(Cell {
|
||||
value: Value::Text(text.as_str().into()),
|
||||
formula: None,
|
||||
style: cx.wb.sheet(sheet).map(|sh| sh.style_id(at)).unwrap_or_default(),
|
||||
}),
|
||||
Json::String(text) if !parse && !text.starts_with('=') => {
|
||||
let mut style = cx.wb.sheet(sheet).map(|sh| sh.style_id(at)).unwrap_or_default();
|
||||
// Line breaks still turn on Wrap Text, as typed input does.
|
||||
if text.contains('\n') && !cx.wb.styles.get(style).align.wrap {
|
||||
style = cx.wb.styles.derive(style, |s| s.align.wrap = true);
|
||||
}
|
||||
Some(Cell { value: Value::Text(text.as_str().into()), formula: None, style })
|
||||
}
|
||||
_ => input_to_cell(&input, sheet, at, &mut cx.wb)?,
|
||||
};
|
||||
let sh = cx.sheet_mut(sheet)?;
|
||||
@@ -1827,6 +1830,12 @@ mod tests {
|
||||
assert_eq!(get(&mut s, "A7")["value"], json!(2.5));
|
||||
assert!(s.execute("range.setValues", json!({"range": "A8", "parse": "no", "values": [["x"]]})).is_err());
|
||||
assert!(s.execute("range.setValues", json!({"range": "A8", "parse": 0, "values": [["x"]]})).is_err());
|
||||
// A line break still turns on Wrap Text.
|
||||
s.execute("range.setValues", json!({"range": "A9", "parse": false, "values": [["one\ntwo"]]})).unwrap();
|
||||
assert_eq!(get(&mut s, "A9")["value"], json!("one\ntwo"));
|
||||
let d = s.doc().unwrap();
|
||||
let sh = d.wb.active().unwrap();
|
||||
assert!(d.wb.styles.get(sh.style_id(CellRef::parse("A9").unwrap())).align.wrap);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -1127,7 +1127,10 @@ pub(super) const EXTRA: &[(&str, &str)] = &[
|
||||
("Sunburst", "サンバースト"),
|
||||
("Stock", "株価"),
|
||||
("Bar", "横棒"),
|
||||
("Drag to fill cells. Drag from inside a cell to select a range.", "ドラッグしてセルを塗りつぶします。セルの内側からドラッグすると範囲を選択します。"),
|
||||
(
|
||||
"Drag to fill cells. Drag from inside a cell to select a range.",
|
||||
"ドラッグしてセルをオートフィルします。セルの内側からドラッグすると範囲を選択します。",
|
||||
),
|
||||
];
|
||||
|
||||
/// Translates an interface label; `None` for a label the catalog does not know, so `i18n.rs` can
|
||||
|
||||
Reference in New Issue
Block a user