diff --git a/crates/ui-egui/src/grid.rs b/crates/ui-egui/src/grid.rs index fa3f94b..557afe4 100644 --- a/crates/ui-egui/src/grid.rs +++ b/crates/ui-egui/src/grid.rs @@ -1940,14 +1940,12 @@ fn keyboard(app: &mut SheetApp, ctx: &egui::Context, resp: &egui::Response, geo: app.copy_to_clipboard(ctx, "edit.cut"); } egui::Event::Paste(text) => app.paste_external(text), - egui::Event::Text(text) => { - if text.chars().all(|c| !c.is_control()) && !text.is_empty() { - app.begin_edit(Some(text), false); - if let Some(ed) = app.editor.as_mut() { - ed.caret = ed.text.chars().count(); - } - return; + egui::Event::Text(text) if text.chars().all(|c| !c.is_control()) && !text.is_empty() => { + app.begin_edit(Some(text), false); + if let Some(ed) = app.editor.as_mut() { + ed.caret = ed.text.chars().count(); } + return; } egui::Event::Key { key, physical_key, pressed: true, modifiers: m, .. } => { use egui::Key; @@ -2075,12 +2073,7 @@ fn filter_menu(app: &mut SheetApp, ui: &mut egui::Ui, geo: &Geo, was_open: bool) let Some(sh) = wb.sheet(si) else { return }; let _ = geo; // Tables get an autofilter on demand. - let table_range = sh - .tables - .iter() - .find(|t| t.range.start.row <= at.y as u32 || true) - .filter(|t| col >= t.range.start.col && col <= t.range.end.col) - .map(|t| t.range); + let table_range = sh.tables.first().filter(|t| col >= t.range.start.col && col <= t.range.end.col).map(|t| t.range); if sh.autofilter.is_none() && let Some(r) = table_range { diff --git a/crates/xlsx/src/sheet_read.rs b/crates/xlsx/src/sheet_read.rs index 11363bc..b2868b4 100644 --- a/crates/xlsx/src/sheet_read.rs +++ b/crates/xlsx/src/sheet_read.rs @@ -142,26 +142,24 @@ pub fn read_sheet(cx: &mut Ctx<'_>, part: &str, name: &str) -> Result sheet.print.row_breaks = e.kids("brk").filter_map(|b| b.attr_u32("id")).filter(|&r| r > 0 && r < MAX_ROWS).collect(), "colBreaks" => sheet.print.col_breaks = e.kids("brk").filter_map(|b| b.attr_u32("id")).filter(|&c| c > 0 && c < MAX_COLS).collect(), - "sheetProtection" => { - if e.flag("sheet", false) { - if e.attr("password").is_some() || e.attr("hashValue").is_some() { - cx.warn(format!("sheet \"{name}\": the protection password was not imported")); - } - sheet.protection = Some(SheetProtection { - password_hash: None, - select_locked: !e.flag("selectLockedCells", false), - select_unlocked: !e.flag("selectUnlockedCells", false), - format_cells: !e.flag("formatCells", true), - format_columns: !e.flag("formatColumns", true), - format_rows: !e.flag("formatRows", true), - insert_columns: !e.flag("insertColumns", true), - insert_rows: !e.flag("insertRows", true), - delete_columns: !e.flag("deleteColumns", true), - delete_rows: !e.flag("deleteRows", true), - sort: !e.flag("sort", true), - autofilter: !e.flag("autoFilter", true), - }); + "sheetProtection" if e.flag("sheet", false) => { + if e.attr("password").is_some() || e.attr("hashValue").is_some() { + cx.warn(format!("sheet \"{name}\": the protection password was not imported")); } + sheet.protection = Some(SheetProtection { + password_hash: None, + select_locked: !e.flag("selectLockedCells", false), + select_unlocked: !e.flag("selectUnlockedCells", false), + format_cells: !e.flag("formatCells", true), + format_columns: !e.flag("formatColumns", true), + format_rows: !e.flag("formatRows", true), + insert_columns: !e.flag("insertColumns", true), + insert_rows: !e.flag("insertRows", true), + delete_columns: !e.flag("deleteColumns", true), + delete_rows: !e.flag("deleteRows", true), + sort: !e.flag("sort", true), + autofilter: !e.flag("autoFilter", true), + }); } "drawing" => { if let Some(rel) = e.attr("id").and_then(|id| rels.iter().find(|r| r.id == id)) {