Skip to content

Commit dbeb554

Browse files
committed
Window(split): Clean up signature, use direction
1 parent ffd9b74 commit dbeb554

File tree

1 file changed

+10
-24
lines changed

1 file changed

+10
-24
lines changed

src/libtmux/window.py

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from libtmux.common import has_gte_version, tmux_cmd
1616
from libtmux.constants import (
1717
RESIZE_ADJUSTMENT_DIRECTION_FLAG_MAP,
18+
PaneDirection,
1819
ResizeAdjustmentDirection,
1920
WindowDirection,
2021
)
@@ -201,7 +202,8 @@ def split(
201202
target: t.Optional[t.Union[int, str]] = None,
202203
start_directory: t.Optional[str] = None,
203204
attach: bool = False,
204-
vertical: bool = True,
205+
direction: t.Optional[PaneDirection] = None,
206+
full_window_split: t.Optional[bool] = None,
205207
shell: t.Optional[str] = None,
206208
size: t.Optional[t.Union[str, int]] = None,
207209
environment: t.Optional[t.Dict[str, str]] = None,
@@ -215,8 +217,10 @@ def split(
215217
True.
216218
start_directory : str, optional
217219
specifies the working directory in which the new window is created.
218-
vertical : str
219-
split vertically
220+
direction : PaneDirection, optional
221+
split in direction. If none is specified, assume down.
222+
full_window_split: bool, optional
223+
split across full window width or height, rather than active pane.
220224
shell : str, optional
221225
execute a command on splitting the window. The pane will close
222226
when the command exits.
@@ -228,31 +232,13 @@ def split(
228232
Cell/row or percentage to occupy with respect to current window.
229233
environment: dict, optional
230234
Environmental variables for new pane. tmux 3.0+ only. Passthrough to ``-e``.
231-
232-
Notes
233-
-----
234-
:term:`tmux(1)` will move window to the new pane if the
235-
``split-window`` target is off screen. tmux handles the ``-d`` the
236-
same way as ``new-window`` and ``attach`` in
237-
:class:`Session.new_window`.
238-
239-
By default, this will make the window the pane is created in
240-
active. To remain on the same window and split the pane in another
241-
target window, pass in ``attach=False``.
242-
243-
.. versionchanged:: 0.28.0
244-
245-
``attach`` default changed from ``True`` to ``False``.
246-
247-
.. deprecated:: 0.28.0
248-
249-
``percent=25`` deprecated in favor of ``size="25%"``.
250235
"""
251236
active_pane = self.active_pane or self.panes[0]
252237
return active_pane.split(
253238
start_directory=start_directory,
254239
attach=attach,
255-
vertical=vertical,
240+
direction=direction,
241+
full_window_split=full_window_split,
256242
shell=shell,
257243
size=size,
258244
environment=environment,
@@ -863,7 +849,7 @@ def split_window(
863849
target=target,
864850
start_directory=start_directory,
865851
attach=attach,
866-
vertical=vertical,
852+
direction=PaneDirection.Below if vertical else PaneDirection.Right,
867853
shell=shell,
868854
size=size,
869855
environment=environment,

0 commit comments

Comments
 (0)