Fix spacing edges in serialized launch args

This commit is contained in:
rudolf-blue 2026-10-08 22:40:36 -04:00
parent 2dc9687573
commit e6423bc05c
2 changed files with 14 additions and 3 deletions

View file

@ -685,11 +685,11 @@ class EdgeWidths:
if self.left is not None:
yield f'--spacing={prefix}-left={self.left}'
if self.right is not None:
yield f'--spacing={prefix}-left={self.right}'
yield f'--spacing={prefix}-right={self.right}'
if self.top is not None:
yield f'--spacing={prefix}-left={self.top}'
yield f'--spacing={prefix}-top={self.top}'
if self.bottom is not None:
yield f'--spacing={prefix}-left={self.bottom}'
yield f'--spacing={prefix}-bottom={self.bottom}'
class GlobalWatchers:

View file

@ -7,6 +7,7 @@ from kitty.fast_data_types import BOTTOM_EDGE, LEFT_EDGE, RIGHT_EDGE, TOP_EDGE,
from kitty.layout.base import blank_rects_for_window, layout_dimension, lgd
from kitty.layout.interface import Fat, Grid, Horizontal, Splits, Stack, Tall, Vertical
from kitty.layout.splits import Pair, SplitsLayoutOpts
from kitty.rc.set_spacing import parse_spacing_settings
from kitty.types import WindowGeometry
from kitty.window import EdgeWidths
from kitty.window_list import WindowList, reset_group_id_counter
@ -1566,3 +1567,13 @@ class TestProportionalSplits(BaseTest):
self.check_weights(q, dict.fromkeys((1, 2, 3), 1 / 3))
self.ae(q.balanced_add_window(4).horizontal, q.pairs_root.horizontal)
self.check_weights(q, dict.fromkeys((1, 2, 3, 4), 0.25))
class TestWindowHelpers(BaseTest):
def test_edge_widths_launch_args(self):
ew = EdgeWidths({'left': 1, 'right': 2, 'top': 3, 'bottom': 4})
for prefix in ('padding', 'margin'):
args = list(ew.as_launch_args(prefix))
self.ae(len(set(args)), 4)
self.ae(parse_spacing_settings(a.partition('=')[2] for a in args), {
f'{prefix}-left': 1, f'{prefix}-right': 2, f'{prefix}-top': 3, f'{prefix}-bottom': 4})