Skip to main content

grid_keys_enabled

Function grid_keys_enabled 

Source
fn grid_keys_enabled(editing: bool, other_focus: bool) -> bool
Expand description

Whether the grid’s single-key bindings (cursor motion, paging, measure cycling, undo/redo) should act this frame.

  • editing — a GRID CELL editor is open: the cell’s own text field owns the keyboard (its Enter/Esc are handled where it is rendered).
  • other_focus — some egui widget owns keyboard focus. While a cell is being edited that widget IS the cell editor, so the two flags overlap; either one suppresses the bindings. Any other focused widget (the formula editor, the new-measure name/formula fields, the CSV wizard’s text fields, the view-name box) must get the keystroke instead of the grid — otherwise typing n cycles measures and h/j/k/l moves the cursor mid-word.

A pure predicate so the decision is unit-testable without a window; the focus flag itself comes from egui::Memory::focused(), which is None again as soon as focus is released (so the gate is never sticky).