Skip to content

Commit 6215bdb

Browse files
committed
fix(split): Passthrough target correctly
1 parent 7916d66 commit 6215bdb

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/libtmux/pane.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ def select_pane(self) -> "Pane":
491491
def split(
492492
self,
493493
/,
494+
target: t.Optional[t.Union[int, str]] = None,
494495
start_directory: t.Optional[str] = None,
495496
attach: bool = False,
496497
direction: t.Optional[PaneDirection] = None,
@@ -504,6 +505,8 @@ def split(
504505
505506
Parameters
506507
----------
508+
target : optional
509+
Optional, custom *target-pane*, used by :meth:`Window.split`.
507510
attach : bool, optional
508511
make new window the current window after creating it, default
509512
True.
@@ -617,6 +620,9 @@ def split(
617620
if not attach:
618621
tmux_args += ("-d",)
619622

623+
if target is not None:
624+
tmux_args += (f"-t{target}",)
625+
620626
if environment:
621627
if has_gte_version("3.0"):
622628
for k, v in environment.items():
@@ -807,6 +813,7 @@ def at_right(self) -> bool:
807813
#
808814
def split_window(
809815
self,
816+
target: t.Optional[t.Union[int, str]] = None,
810817
attach: bool = False,
811818
start_directory: t.Optional[str] = None,
812819
vertical: bool = True,
@@ -844,6 +851,7 @@ def split_window(
844851
if size is None and percent is not None:
845852
size = f'{str(percent).rstrip("%")}%'
846853
return self.split(
854+
target=target,
847855
attach=attach,
848856
start_directory=start_directory,
849857
direction=PaneDirection.Below if vertical else PaneDirection.Right,

src/libtmux/window.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ def split(
239239
"""
240240
active_pane = self.active_pane or self.panes[0]
241241
return active_pane.split(
242+
target=target,
242243
start_directory=start_directory,
243244
attach=attach,
244245
direction=direction,

0 commit comments

Comments
 (0)