Skip to content

fix: LayoutToggle silent no-op when parent is not HSPLIT/VSPLIT#527

Open
mayconrcmello wants to merge 1 commit intoforge-ext:mainfrom
mayconrcmello:fix/layouttoggle-fallback-when-not-split
Open

fix: LayoutToggle silent no-op when parent is not HSPLIT/VSPLIT#527
mayconrcmello wants to merge 1 commit intoforge-ext:mainfrom
mayconrcmello:fix/layouttoggle-fallback-when-not-split

Conversation

@mayconrcmello
Copy link
Copy Markdown

Summary

LayoutToggle (the action behind con-split-layout-toggle, default Super+G) only swaps between HSPLIT and VSPLIT. Every other parent layout (TABBED, STACKED, or the bare MONITOR container) hits the implicit fallthrough and the action is a silent no-op — same shortcut, no feedback, no error.

Reproducible case

Three windows side-by-side where Forge nested them as:

HSPLIT
├── W1
└── HSPLIT-or-TABBED
    ├── W2
    └── W3
  • Focus W1 → parent = outer HSPLIT → Super+G works.
  • Focus W3 → parent = inner HSPLIT-or-VSPLIT → Super+G works.
  • Focus W2 with the inner container in tabbed mode → parent = TABBED → Super+G silently does nothing.

Reported on a multi-monitor setup as "the middle window won't toggle."

Fix

Fall back to determineSplitLayout() (which returns HSPLIT or VSPLIT depending on monitor orientation) when the current layout is anything other than a split. The binding then always has a visible effect — toggling out of tabbed/stacked/monitor mode into a sensible split.

       case "LayoutToggle":
         if (!focusNodeWindow) return;
         currentLayout = focusNodeWindow.parentNode.layout;
         if (currentLayout === LAYOUT_TYPES.HSPLIT) {
           focusNodeWindow.parentNode.layout = LAYOUT_TYPES.VSPLIT;
         } else if (currentLayout === LAYOUT_TYPES.VSPLIT) {
           focusNodeWindow.parentNode.layout = LAYOUT_TYPES.HSPLIT;
+        } else {
+          focusNodeWindow.parentNode.layout = this.determineSplitLayout();
         }

Test plan

  • node --check
  • In a workspace with 3 windows where the middle pair is in a tabbed container, focus the middle window and press Super+G → container becomes HSPLIT/VSPLIT.
  • In an HSPLIT container, Super+G still toggles to VSPLIT (and vice-versa), no regression.

`LayoutToggle` swaps HSPLIT↔VSPLIT but ignores every other parent
layout. In a tree with monitor-attached windows or tabbed/stacked
containers, the focused window's parent may not be a split — and
Super+G then does nothing without any feedback to the user.

Reproduced with three windows where the middle one sits inside a
tabbed sub-container: Super+G works on the first and last (their
parent is HSPLIT) but silently fails on the middle one (parent is
TABBED).

Fall back to `determineSplitLayout()` (HSPLIT or VSPLIT depending on
monitor orientation) when the current layout is anything else, so the
binding always has a visible effect.
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.

1 participant