Merge PR #2001: Formula editing: arrow pointing restarts from the edited cell after typing (#1949)

This commit is contained in:
aiongg
2026-10-22 02:35:18 +00:00
2 changed files with 19 additions and 0 deletions
+2
View File
@@ -325,6 +325,8 @@ pub fn editor_widget(app: &mut SheetApp, ui: &mut egui::Ui, id: egui::Id, font:
ed.completion = crate::editor::column_completion(sh, ed.cell, &ed.text);
}
ed.point = None;
// Typing ends the pointing: the next arrow starts again from the edited cell, as in Excel.
ed.point_cell = None;
let names: Vec<String> = function_names()
.iter()
.map(|name| {
+17
View File
@@ -159,3 +159,20 @@ fn formula_point_drag_keeps_the_sheet_qualifier() {
h.state_mut().session.execute("sheet.activate", json!({"sheet": "Sheet1"})).unwrap();
assert_eq!(cells(&h), before);
}
#[test]
fn formula_arrow_pointing_restarts_from_the_edited_cell_after_typing() {
let mut h = harness("B4");
h.state_mut().begin_edit(Some("=".into()), false);
h.run_steps(2);
h.key_press(egui::Key::ArrowUp);
h.run_steps(1);
h.key_press(egui::Key::ArrowUp);
h.run_steps(1);
assert_eq!(h.state().editor.as_ref().unwrap().text, "=B2");
frame(&mut h, Event::Text("+".into()));
h.run_steps(1);
h.key_press(egui::Key::ArrowUp);
h.run_steps(1);
assert_eq!(h.state().editor.as_ref().unwrap().text, "=B2+B3");
}