Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ $ pip install --user --upgrade --pre libtmux

<!-- Maintainers and contributors: Insert change notes for the next release above -->

### Improvement

- pane, window commands: Impove parsing of option values that return numbers
(#520)

### Tests

- pytest: Fix `usefixture` warning (#519)
Expand Down
2 changes: 1 addition & 1 deletion src/libtmux/pane.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def cmd(self, cmd: str, *args: t.Any, **kwargs: t.Any) -> tmux_cmd:
Specifying ``('-t', 'custom-target')`` or ``('-tcustom_target')`` in
``args`` will override using the object's ``pane_id`` as target.
"""
if not any(arg.startswith("-t") for arg in args):
if not any("-t" in str(x) for x in args):
args = ("-t", self.pane_id, *args)

return self.server.cmd(cmd, *args, **kwargs)
Expand Down
7 changes: 5 additions & 2 deletions src/libtmux/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def cmd(self, cmd: str, *args: t.Any, **kwargs: t.Any) -> tmux_cmd:
Specifying ``('-t', 'custom-target')`` or ``('-tcustom_target')`` in
``args`` will override using the object's ``window_id`` as target.
"""
if not any(arg.startswith("-t") for arg in args):
if not any("-t" in str(x) for x in args):
args = ("-t", self.window_id, *args)

return self.server.cmd(cmd, *args, **kwargs)
Expand Down Expand Up @@ -389,7 +389,10 @@ def show_window_options(self, g: t.Optional[bool] = False) -> "WindowOptionDict"

window_options: "WindowOptionDict" = {}
for item in output:
key, val = shlex.split(item)
try:
key, val = shlex.split(item)
except ValueError:
logger.exception(f"Error extracting option: {item}")
assert isinstance(key, str)
assert isinstance(val, str)

Expand Down