Skip to content

Fix incorrect window labels when 10 or more windows are open - #554

Merged
lambdalisue merged 1 commit into
lambdalisue:mainfrom
hwblx:fix-labeling
Jul 26, 2026
Merged

lambdalisue merged 1 commit into
lambdalisue:mainfrom
hwblx:fix-labeling

Conversation

@hwblx

@hwblx hwblx commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes incorrect window labels when 10 or more windows are open.

Description

When selecting a file through fern, window statuslines are labeled in alphabetical order (a, b, c ... i). When there are 10 or more windows, the labels become incorrect (b, c, d ... j, a).

Cause

The previous implementation relied on iterating over keys(store), which could produce an ordering different from a:winnrs. As a result, labels could be assigned to the wrong windows.

Solution

Iterate over a:winnrs directly when assigning and restoring window labels, preserving the intended correspondence between window numbers and label characters.

Testing

Reproduced the issue with 10 or more windows and verified that each window now receives the correct label.

Summary by CodeRabbit

  • Bug Fixes
    • Improved window selection indicators so labels consistently appear in the correct windows.
    • Ensured original window status and toolbar displays are reliably restored after selection, including when popup windows are unavailable.
    • Improved consistency of the window selector across different window layouts and configurations.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: dfa45783-1fc6-4828-93e4-ef5088176b29

📥 Commits

Reviewing files that changed from the base of the PR and between 3d58035 and f5b65f6.

📒 Files selected for processing (1)
  • autoload/vital/_fern/App/WindowSelector.vim

📝 Walkthrough

Walkthrough

The window selector now updates and restores non-popup window-local UI values by iterating through the input window list, preserving positional correspondence between windows and indicator characters.

Changes

Window selector updates

Layer / File(s) Summary
Indexed indicator assignment and restoration
autoload/vital/_fern/App/WindowSelector.vim
Non-popup indicators use the corresponding input-list character, and cleanup restores each window’s saved value directly.

Estimated code review effort: 1 (Trivial) | ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: fixing incorrect window labels when many windows are open.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes window indicator label misalignment in fern’s window selector when 10+ windows are open by ensuring label assignment/restoration follows the explicit a:winnrs ordering rather than relying on dictionary key iteration order.

Changes:

  • Assign statusline/winbar indicator labels by iterating a:winnrs in-order, ensuring correct window-to-label correspondence.
  • Restore original statusline/winbar values by iterating a:winnrs, keeping restoration consistent with the windows that were modified.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lambdalisue
lambdalisue merged commit 3bbca3c into lambdalisue:main Jul 26, 2026
13 checks passed
@lambdalisue

Copy link
Copy Markdown
Owner

Thanks 👍

@hwblx
hwblx deleted the fix-labeling branch July 27, 2026 05:44
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