Skip to content

fix(keyboard): Ctrl with the numpad's + inserts rows, columns or cells, as in Excel - #2769

Merged
h-a-n-a-s-h-i merged 2 commits into
storytold:mainfrom
RomanLis91:fix/ctrl-numpad-plus-insert
Oct 30, 2026
Merged

h-a-n-a-s-h-i merged 2 commits into
storytold:mainfrom
RomanLis91:fix/ctrl-numpad-plus-insert

Conversation

@RomanLis91

@RomanLis91 RomanLis91 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Change

In Excel, Ctrl with the numpad's + does the same as Ctrl+Shift+=: with whole rows or columns selected it inserts them, otherwise it opens the Insert dialog. In GridCraft it did nothing.

The cause is that egui-winit reports NumpadAdd as Key::Plus without Shift, and ribbon::shortcut only matched Key::Plus | Key::Equals when Shift was held. Now Key::Plus matches with or without Shift. Key::Equals still needs Shift, so Ctrl+= stays unbound.

Reading the code, this probably also reaches layouts whose main block types + without Shift (Nordic, or a German keyboard with Cmd on a Mac), where Ctrl with that key now inserts too. German Excel uses Strg++ for Insert too (#1440's table), so I kept that, but I have not tried a non-US layout. This implements the numpad item of #1440. #1385 is related: its us_key maps a typed + to Shift+=, but it does not cover the numpad's Key::Plus.

  • crates/ui-egui/src/ribbon/shortcuts.rs: the guard is now shift || key == Key::Plus.
  • crates/ui-egui/tests/it/whole_line_shortcuts.rs: numpad_plus_inserts_without_shift (whole row 2 selected, Ctrl+Plus with no Shift inserts a row) and unshifted_equals_inserts_nothing.
  • docs/ui-parity.md: the shortcut row, the timestamp line and a revision history line.

Testing

  • cargo test -p gridcraft-ui-egui --test it -- whole_line keyboard_shortcuts: 18 passed.
  • With the guard put back to if shift, numpad_plus_inserts_without_shift fails and the other tests pass, so the new test does catch the bug.
  • cargo fmt --all -- --check is clean. cargo clippy -p gridcraft-ui-egui --all-targets reports no lint warnings.
  • Not run: the full cargo xtask ci, or a manual check with a physical numpad in a built app.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QJaF5jevKidVoJcnTyBFub

Summary by CodeRabbit

  • New Features
    • Ctrl+numpad-plus now inserts a row or column when the selection supports whole-line insertion, or opens the insert-cells dialog for other selections.
  • Bug Fixes
    • Corrected shortcut handling so unshifted Ctrl+= leaves the selected row unchanged; Ctrl+= still requires Shift for insertion.
  • Documentation
    • Updated the UI shortcut reference to include Ctrl+numpad-plus for inserting rows, columns, or cells.

…s, as in Excel

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QJaF5jevKidVoJcnTyBFub
@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between a8e03ef and 0688e83.

Files selected for processing: 1
  • docs/ui-parity.md
Files skipped from review as they are similar to previous changes: 1
  • docs/ui-parity.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

The insert-rows/columns shortcut now accepts Ctrl+numpad-plus without Shift. Existing whole-row, whole-column, and single-area routing remains in place. Tests and the UI parity document cover the shortcut.

Changes: Insertion shortcut

Layer / File(s) Summary
Shortcut handling and coverage
crates/ui-egui/src/ribbon/shortcuts.rs, crates/ui-egui/tests/it/whole_line_shortcuts.rs, docs/ui-parity.md
The handler accepts unshifted Key::Plus while Key::Equals still requires Shift. Tests cover row insertion and confirm that unshifted Ctrl+= leaves the selected row unchanged. The parity document lists Ctrl+numpad-plus as an insertion shortcut.

Priority: Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: aiongg

Merge Risk: Minimal · up to 0688e

The shortcut change appears mergeable after normal checks. A physical-numpad check remains useful but is not an established blocker.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: Ctrl+numpad+ now inserts rows, columns, or cells.
Docstring Coverage Passed Docstring coverage is inconclusive: files from earlier reviews still need to be rechecked within the check's analysis limits. Not blocking.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@h-a-n-a-s-h-i
h-a-n-a-s-h-i merged commit da3e387 into storytold:main Oct 30, 2026
1 check passed
@echelon

echelon commented Oct 30, 2026

Copy link
Copy Markdown
Member

Landed in main (75f7056). Thank you for the contribution, @RomanLis91! If you haven't already, come join us on Discord: https://discord.gg/artcraft

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants