Skip to content

Home with frozen columns goes to the first unfrozen column (fixes #2044) - #2083

Open
dantebertuzzi wants to merge 1 commit into
storytold:mainfrom
dantebertuzzi:fix/home-frozen-panes
Open

dantebertuzzi wants to merge 1 commit into
storytold:mainfrom
dantebertuzzi:fix/home-frozen-panes

Conversation

@dantebertuzzi

@dantebertuzzi dantebertuzzi commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #2044.

Cause

Key::Home in crates/ui-egui/src/grid.rs always selected column A. With frozen columns, A lives in the frozen pane and is always visible, so ensure_visible had nothing to scroll: the scrolling pane stayed at the far-away column (e.g. BB) and Home looked like it did nothing.

Fix

Like Excel, Home now goes to the first unfrozen column (freeze.1), the same rule Ctrl+Home already follows, and the pane scrolls back to it. Without frozen panes it still goes to column A.

Tests

home_with_frozen_columns_goes_to_the_first_unfrozen_column in crates/ui-egui/tests/selection_scroll.rs: freeze the first column, Ctrl+Right to CV1, Home → B1 is active and visible; without freeze Home → A1. Fails before the fix, passes after. cargo fmt --check, cargo clippy -p gridcraft-ui-egui --all-targets -D warnings and cargo test -p gridcraft-ui-egui pass.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Updated Home key navigation to select the first unfrozen column on the active row.
    • Preserved expected behavior when no columns are frozen by selecting the first column.
    • Improved scrolling so the selected cell is brought into view.
  • Tests

    • Added coverage for Home navigation with and without frozen columns.

…rytold#2044)

Home selected column A, which sits in the frozen pane, so the scrolling
pane never moved back and the view stayed at the far-away column. Like
Excel, Home now lands on the first unfrozen column and scrolls to it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: storytold/gridcraft/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7ffdb6e1-ffe6-4b47-9bc7-8e0a5ed60bea
📥 Commits

Reviewing files that changed from the base of the PR and between 68e58a2 and 2f86aa8.

📒 Files selected for processing: 2
  • crates/ui-egui/src/grid.rs
  • crates/ui-egui/tests/selection_scroll.rs

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 non-command Home key now selects the first unfrozen column on the active row. When no columns are frozen, it selects column A. The grid remains marked for visibility adjustment.

Changes: Home key navigation

Layer / File(s) Summary
Home selection and scroll behavior
crates/ui-egui/src/grid.rs, crates/ui-egui/tests/selection_scroll.rs
The keyboard handler selects the frozen-column boundary on the active row. Tests verify that Home selects and scrolls to B1 when column A is frozen, and selects and displays A1 when no columns are frozen.

Priority: ⬇️ Low

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

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: echelon, msaulc

Merge Risk: ⚪ Minimal · up to 2f86a

Home navigation behaves as intended for frozen and unfrozen panes, with no actionable merge-blocking risk identified.

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: Home navigation now targets the first unfrozen column when columns are frozen. It also identifies the related issue.
Linked Issues check Passed Issue #2044 requires Home to move from a distant column to the first unfrozen column when columns are frozen, and to column A without frozen columns. The change uses `sh.freeze.map(|f| f.1).unwrap_or(…
Out of Scope Changes check Passed The diff contains only the Key::Home behavior change in crates/ui-egui/src/grid.rs and focused regression coverage in crates/ui-egui/tests/selection_scroll.rs. Both changes directly support issu…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files.
Full details: Linked Issues check

Explanation

Issue #2044 requires Home to move from a distant column to the first unfrozen column when columns are frozen, and to column A without frozen columns. The change uses sh.freeze.map(|f| f.1).unwrap_or(0) for Key::Home and keeps app.grid.ensure_visible = true. The new test covers frozen column A, movement from CV1 to B1, visibility, and the no-freeze A1 case.

Full details: Out of Scope Changes check

Explanation

The diff contains only the Key::Home behavior change in crates/ui-egui/src/grid.rs and focused regression coverage in crates/ui-egui/tests/selection_scroll.rs. Both changes directly support issue #2044.

✨ 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.

@dantebertuzzi

Copy link
Copy Markdown
Contributor Author

Small request, unrelated to this fix: could a maintainer regenerate contributors/contributors.json when convenient? It was last generated at 90b3c41 (2026-10-10), so it doesn't yet include PRs merged since then (e.g. my #720, #739, #1768 and #1769). Thanks!

This branch has not been deployed

No deployments
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.

Home key does not jump back to the first columns when panes are frozen

1 participant