mirror of
https://github.com/storytold/gridcraft.git
synced 2026-10-31 07:38:32 +00:00
Merge PR #2851
This commit is contained in:
commit
ecd72eccc4
2 files changed
+18
No files matched your search
@@ -55,6 +55,15 @@ impl SheetApp {
|
||||
// Requests the command made (a dialog, a draft) belong to the window it left active.
|
||||
self.follow_active_window();
|
||||
self.after_engine();
|
||||
if id == "formulas.autoSum"
|
||||
&& let Some(ed) = self.editor.as_mut()
|
||||
&& ed.text.starts_with('=')
|
||||
&& ed.text.ends_with("()")
|
||||
{
|
||||
ed.caret = ed.text.chars().count().saturating_sub(1);
|
||||
ed.anchor = ed.caret;
|
||||
ed.sync_caret = true;
|
||||
}
|
||||
if id == "view.arrangeAll"
|
||||
&& self.native_windows
|
||||
&& let Ok(r) = &r
|
||||
|
||||
@@ -140,6 +140,15 @@ fn locale_preserves_text_cells_and_existing_entry_conveniences() {
|
||||
assert_eq!(app.editor.as_ref().unwrap().text, "=SUM(1,2)");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn empty_cell_autosum_places_caret_inside_parentheses() {
|
||||
let mut app = app();
|
||||
app.run("formulas.autoSum", json!({"enter": false})).unwrap();
|
||||
let ed = app.editor.as_ref().unwrap();
|
||||
assert_eq!(ed.text, "=SUM()");
|
||||
assert_eq!(ed.caret, ed.text.chars().count() - 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
/// Insert Function and AutoSum use `=SUMA(`, while user-supplied formula text is not translated twice.
|
||||
fn canonical_engine_templates_enter_the_selected_formula_language() {
|
||||
|
||||
Reference in new issue
Block a user