Ctrl+Shift+= on several whole-row areas still opens the Insert dialog

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas
2026-10-19 12:20:46 -04:00
co-authored by Claude Opus 5.5
parent 62e52004f8
commit f2473d1f33
+7 -1
View File
@@ -2462,7 +2462,8 @@ pub fn shortcut(app: &mut SheetApp, key: Key, m: Modifiers) {
None
}
},
Key::Plus | Key::Equals if shift => match whole_lines(app) {
// Insert works on one area at a time, so several areas still go through the dialog.
Key::Plus | Key::Equals if shift => match whole_lines(app).filter(|_| single_area(app)) {
Some(true) => Some(("home.insertRows", json!({}))),
Some(false) => Some(("home.insertColumns", json!({}))),
None => {
@@ -2525,6 +2526,11 @@ mod checkbox_on_tests {
}
}
/// Whether the selection is a single area.
fn single_area(app: &SheetApp) -> bool {
app.session.active().is_some_and(|d| d.selection.ranges.len() == 1)
}
/// `Some(true)` when every selected area is whole rows, `Some(false)` when every one is whole
/// columns, `None` otherwise (including the whole sheet).
fn whole_lines(app: &SheetApp) -> Option<bool> {