Diff
1diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp
2index 193cb34c44c53887804bd53ac8127f0171795cdb..ea8cae11335a252c9415ad91c4d4916ab2e7a90a 100644
3--- a/src/Hy3Layout.cpp
4+++ b/src/Hy3Layout.cpp
5@@ -1187,10 +1187,10 @@ Hy3Node* Hy3Layout::shiftOrGetFocus(Hy3Node& node, ShiftDirection direction, boo
6 if (!((!shiftIsForward(direction) && group.children.front() == break_origin)
7 || (shiftIsForward(direction) && group.children.back() == break_origin)))
8 break;
9+ } else {
10+ has_broken_once = true;
11 }
12
13- has_broken_once = true;
14-
15 if (break_parent->parent == nullptr) {
16 if (!shift) return nullptr;
17
18@@ -1198,7 +1198,10 @@ Hy3Node* Hy3Layout::shiftOrGetFocus(Hy3Node& node, ShiftDirection direction, boo
19 // there's no reason to wrap the root group.
20 if (shiftMatchesLayout(group.layout, direction)) break;
21
22- if (group.layout != Hy3GroupLayout::Tabbed && group.children.size() == 2) {
23+ if (group.layout != Hy3GroupLayout::Tabbed
24+ && group.children.size() == 2
25+ && std::find(group.children.begin(), group.children.end(), &node) != group.children.end()
26+ ) {
27 group.layout = shiftIsVertical(direction) ? Hy3GroupLayout::SplitV : Hy3GroupLayout::SplitH;
28 } else {
29 // wrap the root group in another group