mirror of
https://github.com/storytold/gridcraft.git
synced 2026-10-24 10:46:50 -06:00
Integration: fix struct literals and call signatures after combining tracks (Series.quartiles, Comment.note_box, Image data Arc, signature language)
This commit is contained in:
@@ -681,7 +681,7 @@ mod tests {
|
||||
wb.sheet_mut(0).unwrap().images.push(gridcraft_model::Image {
|
||||
id: 1,
|
||||
anchor: gridcraft_model::Anchor { cell: CellRef::new(0, 0), dx: 0.0, dy: 0.0, width: 72.0, height: 36.0, mode: Default::default() },
|
||||
data: vec![1, 2, 3],
|
||||
data: vec![1, 2, 3].into(),
|
||||
mime: "image/png".into(),
|
||||
alt: "a \"logo\"".into(),
|
||||
});
|
||||
@@ -703,7 +703,7 @@ mod tests {
|
||||
sh.images.push(gridcraft_model::Image {
|
||||
id: 1,
|
||||
anchor: gridcraft_model::Anchor { cell: CellRef::new(3, 2), dx: 5.0, dy: 7.0, width: 10.0, height: 20.0, mode: Default::default() },
|
||||
data: vec![1],
|
||||
data: vec![1].into(),
|
||||
mime: "image/png".into(),
|
||||
alt: String::new(),
|
||||
});
|
||||
@@ -729,7 +729,7 @@ mod tests {
|
||||
height: 10.0,
|
||||
mode: Default::default(),
|
||||
},
|
||||
data: vec![1],
|
||||
data: vec![1].into(),
|
||||
mime: "image/png".into(),
|
||||
alt: String::new(),
|
||||
});
|
||||
|
||||
@@ -163,7 +163,7 @@ impl EditState {
|
||||
/// Ctrl+Shift+A, as in Excel: right after a function name, or after its `(`, inserts the
|
||||
/// argument names (optional ones without their brackets) and the closing parenthesis, and
|
||||
/// the `(` too when missing. Anywhere else nothing changes and it returns false.
|
||||
pub fn insert_argument_names(&mut self) -> bool {
|
||||
pub fn insert_argument_names(&mut self, language: crate::i18n::Language) -> bool {
|
||||
if !self.is_formula() {
|
||||
return false;
|
||||
}
|
||||
@@ -183,7 +183,7 @@ impl EditState {
|
||||
if name.is_empty() || name.starts_with(|c: char| c.is_ascii_digit()) {
|
||||
return false;
|
||||
}
|
||||
let Some(signature) = crate::formula_locale::signature(&name, self.locale) else { return false };
|
||||
let Some(signature) = crate::formula_locale::signature(&name, self.locale, language) else { return false };
|
||||
let sep = self.locale.list_separator();
|
||||
let inner = signature.split_once('(').map(|(_, rest)| rest.trim_end().trim_end_matches(')')).unwrap_or("");
|
||||
let args: Vec<&str> = inner.split(sep).map(|a| a.trim().trim_start_matches('[').trim_end_matches(']')).filter(|a| !a.is_empty()).collect();
|
||||
|
||||
@@ -278,7 +278,7 @@ pub fn editor_widget(app: &mut SheetApp, ui: &mut egui::Ui, id: egui::Id, font:
|
||||
// as in Excel, so it never falls through to the text's select-all.
|
||||
if ui.input_mut(|i| i.consume_key(egui::Modifiers::CTRL | egui::Modifiers::SHIFT, Key::A)) {
|
||||
let (text, caret) = (ed.text.clone(), ed.caret);
|
||||
if ed.insert_argument_names()
|
||||
if ed.insert_argument_names(app.ui.language)
|
||||
&& let Some(mut state) = egui::TextEdit::load_state(ui.ctx(), id)
|
||||
{
|
||||
// The text edit records an undo point only once typing pauses: mark the text
|
||||
|
||||
@@ -46,6 +46,7 @@ fn series(name: &str, values: &str) -> Series {
|
||||
kind: None,
|
||||
smooth: false,
|
||||
trendlines: Vec::new(),
|
||||
quartiles: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ fn workbook(categories: &str, values: &str) -> Workbook {
|
||||
kind: None,
|
||||
smooth: false,
|
||||
trendlines: Vec::new(),
|
||||
quartiles: Default::default(),
|
||||
}],
|
||||
legend: LegendPos::Bottom,
|
||||
data_labels: false,
|
||||
|
||||
@@ -790,6 +790,7 @@ fn cell_text_carriage_returns_survive_xlsx_roundtrip() {
|
||||
resolved: false,
|
||||
visible: false,
|
||||
dates: vec![],
|
||||
note_box: None,
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user