mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-06 08:01:58 +02:00
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:
@@ -272,8 +272,8 @@ class 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 @@ class 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 @@ class 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 @@ class 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:
|
||||
|
||||
Reference in New Issue
Block a user