resize-os-window: fix '--incremental' option of 'os-panel' action

This commit addresses a few issues with the implementation of
'--incremental':
    - Unspecified settings are reset to their default value, which
      defeats the purpose of the option.
    - It is assumed that the names of options in 'LayerCLIOptions' map
      one to one with the names of fields in 'LayerShellConfig' but this
      isn't true. For example: The 'margin_top' cli option sets the
      'requested_top_margin' layer shell config.
    - When some options are set to a certain value, they force other
      options to be some value. The current implementation doesn't
      account for this.
    - The documentation is contradictory.
This commit is contained in:
alex-huff
2025-09-21 23:41:48 -05:00
parent b401e12fd9
commit 0daab6ab43
4 changed files with 40 additions and 17 deletions

View File

@@ -5,7 +5,7 @@ import os
import sys
from contextlib import suppress
from functools import partial
from typing import Iterable, Mapping, Sequence
from typing import Any, Iterable, Mapping, Sequence
from kitty.cli import parse_args
from kitty.cli_stub import PanelCLIOptions
@@ -46,7 +46,7 @@ def panel_kitten_options_spec() -> str:
return ans
def parse_panel_args(args: list[str], track_seen_options: set[str] | None = None) -> tuple[PanelCLIOptions, list[str]]:
def parse_panel_args(args: list[str], track_seen_options: dict[str, Any] | None = None) -> tuple[PanelCLIOptions, list[str]]:
return parse_args(
args, panel_kitten_options_spec, usage, help_text, 'kitty +kitten panel',
result_class=PanelCLIOptions, track_seen_options=track_seen_options)