mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-11-19 06:35:15 +00:00
Merge branch 'fix/session-option-boundary' of https://github.com/M-Hassan-Raza/kitty
This commit is contained in:
commit
c4e1a9572b
3 changed files with 21 additions and 4 deletions
|
|
@ -202,6 +202,8 @@ Detailed list of changes
|
|||
0.49.2 [future]
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
- Sessions: Expand launch option variables when an option value matches the command name
|
||||
|
||||
- Preserve transparent background colors when applying unrelated launch color overrides
|
||||
|
||||
- ssh kitten: Preserve SSH option values following a spaced :code:`--kitten` option
|
||||
|
|
|
|||
|
|
@ -131,10 +131,7 @@ class Session:
|
|||
spec = parse_launch_args(cmd)
|
||||
if needs_expandvars:
|
||||
assert isinstance(cmd, list)
|
||||
limit = len(cmd)
|
||||
if len(spec.args):
|
||||
with suppress(ValueError):
|
||||
limit = cmd.index(spec.args[0])
|
||||
limit = len(cmd) - len(spec.args)
|
||||
cmd = [(expand(x) if i < limit else x) for i, x in enumerate(cmd)]
|
||||
spec = parse_launch_args(cmd)
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,24 @@ class TestConfParsing(BaseTest):
|
|||
def test_font_size_clamping(self):
|
||||
font_size_clamping(self)
|
||||
|
||||
def test_session_launch_option_expansion(self) -> None:
|
||||
from kitty.launch import LaunchSpec
|
||||
from kitty.options.types import defaults
|
||||
from kitty.session import parse_session
|
||||
|
||||
for command in (
|
||||
'--title bash --cwd $SESSION_DIR bash $COMMAND_ARG',
|
||||
'--title=bash --cwd=$SESSION_DIR bash $COMMAND_ARG',
|
||||
'--title bash --cwd $SESSION_DIR -- bash $COMMAND_ARG',
|
||||
'--title other --cwd $SESSION_DIR bash $COMMAND_ARG',
|
||||
):
|
||||
with self.subTest(command=command):
|
||||
(session,) = parse_session(f'launch {command}', defaults, environ={'SESSION_DIR': '/tmp/session', 'COMMAND_ARG': 'expanded'})
|
||||
spec = session.tabs[0].windows[0].launch_spec
|
||||
assert isinstance(spec, LaunchSpec)
|
||||
self.ae(spec.opts.cwd, '/tmp/session')
|
||||
self.ae(spec.args, ['bash', '$COMMAND_ARG'])
|
||||
|
||||
def test_session_discovery(self):
|
||||
from unittest.mock import patch
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue