Skip to content

Conversation

@majiayu000
Copy link

Summary

This PR fixes #5127 by preserving the current screen mode (normal, half, or full) when navigating in and out of submodules.

Problem

Previously, when a user changed the screen mode (by pressing + or _) and then navigated into a submodule, the screen mode would reset to normal. Similarly, when exiting back to the parent repo, the screen mode would reset again. This was jarring for users who frequently switch between a submodule and its parent repo.

Changes

  1. Modified EnterSubmodule in repos_helper.go: Now captures the current screen mode before entering a submodule and passes it to the new DispatchSwitchToRepoWithScreenMode method
  2. Added DispatchSwitchToRepoWithScreenMode method: New method that accepts a screen mode parameter and converts it to a string for passing to onNewRepo
  3. Added screenModeToString helper function: Converts the screen mode enum to its string representation ("normal", "half", or "full")
  4. Updated Escape action in quit_actions.go: When exiting a submodule, now preserves the current screen mode by capturing it and passing it to DispatchSwitchToRepoWithScreenMode

Testing

  • All existing unit tests pass
  • Project builds successfully
  • The changes follow the existing code patterns in the codebase

Screenshots

As shown in the original issue, the screen mode is now preserved when:

  1. Entering a submodule from the parent repo
  2. Exiting a submodule back to the parent repo

Generated with Claude Code

majiayu000 and others added 2 commits December 30, 2025 14:36
When entering a submodule, the current screen mode is now preserved
instead of being reset to the default. This makes navigation between
parent repos and submodules less jarring, as the user's screen mode
preference is maintained.

The fix captures the current screen mode before switching to the
submodule and passes it to the new repo initialization, while
worktrees and regular repo switches continue to use the default
behavior.

Fixes jesseduffield#5127

Signed-off-by: majiayu000 <[email protected]>
This fix ensures that the current screen mode (normal, half, or full) is
preserved when entering and exiting submodules. Previously, the screen mode
would reset to normal when navigating into or out of a submodule, which was
jarring for users who frequently switch between a submodule and its parent repo.

Changes:
- Modified EnterSubmodule to capture and pass the current screen mode
- Added DispatchSwitchToRepoWithScreenMode method to handle screen mode preservation
- Updated Escape action to preserve screen mode when exiting submodules
- Added screenModeToString helper to convert screen mode enum to string

Fixes jesseduffield#5127

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Signed-off-by: majiayu000 <[email protected]>
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.

Screen mode not preserved in submodules

1 participant