Splits layout: Fix variable shadowing in layout_pair causing corrupted pane positions
The for loops iterating over edge_border() results in layout_pair() used top, bottom, left, right as loop variable names, which shadowed the function's local variables tracking current layout position. This caused sibling panes to be positioned at incorrect offsets when splitting a pane that was itself a nested Pair (e.g. splitting the left pane horizontally would cause the right pane to shift down half the screen). Rename loop variables to etop, ebottom, eleft, eright to avoid shadowing.
This commit is contained in:
parent
3281a8d634
commit
d5e45cf8d3
1 changed files with 8 additions and 8 deletions
|
|
@ -272,8 +272,8 @@ def layout_pair(
|
|||
if isinstance(self.one, Pair):
|
||||
self.one.layout_pair(left, top, w1, height, id_window_map, layout_object)
|
||||
if bw:
|
||||
for top, bottom, window_id in self.one.edge_border(RIGHT_EDGE, id_window_map):
|
||||
one.append(BorderLine(Edges(bleft, top, bleft + bw, bottom), window_id=window_id))
|
||||
for etop, ebottom, window_id in self.one.edge_border(RIGHT_EDGE, id_window_map):
|
||||
one.append(BorderLine(Edges(bleft, etop, bleft + bw, ebottom), window_id=window_id))
|
||||
else:
|
||||
wg = id_window_map[self.one]
|
||||
yl = next(layout_object.ylayout(iter((wg,)), start=top, size=height, border_mult=border_mult))
|
||||
|
|
@ -287,8 +287,8 @@ def layout_pair(
|
|||
if isinstance(self.two, Pair):
|
||||
self.two.layout_pair(left, top, w2, height, id_window_map, layout_object)
|
||||
if bw:
|
||||
for top, bottom, window_id in self.two.edge_border(LEFT_EDGE, id_window_map):
|
||||
two.append(BorderLine(Edges(left - bw, top, left, bottom), window_id=window_id))
|
||||
for etop, ebottom, window_id in self.two.edge_border(LEFT_EDGE, id_window_map):
|
||||
two.append(BorderLine(Edges(left - bw, etop, left, ebottom), window_id=window_id))
|
||||
else:
|
||||
wg = id_window_map[self.two]
|
||||
if bw:
|
||||
|
|
@ -310,8 +310,8 @@ def layout_pair(
|
|||
if isinstance(self.one, Pair):
|
||||
self.one.layout_pair(left, top, width, h1, id_window_map, layout_object)
|
||||
if bw:
|
||||
for left, right, window_id in self.one.edge_border(BOTTOM_EDGE, id_window_map):
|
||||
one.append(BorderLine(Edges(left, btop, right, btop + bw), window_id=window_id))
|
||||
for eleft, eright, window_id in self.one.edge_border(BOTTOM_EDGE, id_window_map):
|
||||
one.append(BorderLine(Edges(eleft, btop, eright, btop + bw), window_id=window_id))
|
||||
else:
|
||||
wg = id_window_map[self.one]
|
||||
xl = next(layout_object.xlayout(iter((wg,)), start=left, size=width, border_mult=border_mult))
|
||||
|
|
@ -325,8 +325,8 @@ def layout_pair(
|
|||
if isinstance(self.two, Pair):
|
||||
self.two.layout_pair(left, top, width, h2, id_window_map, layout_object)
|
||||
if bw:
|
||||
for left, right, window_id in self.two.edge_border(TOP_EDGE, id_window_map):
|
||||
two.append(BorderLine(Edges(left, top - bw, right, top), window_id=window_id))
|
||||
for eleft, eright, window_id in self.two.edge_border(TOP_EDGE, id_window_map):
|
||||
two.append(BorderLine(Edges(eleft, top - bw, eright, top), window_id=window_id))
|
||||
else:
|
||||
wg = id_window_map[self.two]
|
||||
if bw:
|
||||
|
|
|
|||
Loading…
Reference in a new issue