Skip to content

Commit c8c30bc

Browse files
committed
chore(Window): Window.split_window() -> Window.split()
1 parent cd7519d commit c8c30bc

File tree

6 files changed

+47
-47
lines changed

6 files changed

+47
-47
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ Grab remaining tmux window:
182182

183183
```python
184184
>>> window = session.active_window
185-
>>> window.split_window(attach=False)
185+
>>> window.split(attach=False)
186186
Pane(%2 Window(@1 1:... Session($1 ...)))
187187
```
188188

@@ -196,14 +196,14 @@ Window(@1 1:libtmuxower, Session($1 ...))
196196
Split window (create a new pane):
197197

198198
```python
199-
>>> pane = window.split_window()
200-
>>> pane = window.split_window(attach=False)
199+
>>> pane = window.split()
200+
>>> pane = window.split(attach=False)
201201
>>> pane.select()
202202
Pane(%3 Window(@1 1:..., Session($1 ...)))
203203
>>> window = session.new_window(attach=False, window_name="test")
204204
>>> window
205205
Window(@2 2:test, Session($1 ...))
206-
>>> pane = window.split_window(attach=False)
206+
>>> pane = window.split(attach=False)
207207
>>> pane
208208
Pane(%5 Window(@2 2:test, Session($1 ...)))
209209
```

docs/quickstart.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ Create a pane from a window:
149149
'%2'
150150
```
151151

152-
Raw output directly to a {class}`Pane` (in practice, you'd use {meth}`Window.split_window()`):
152+
Raw output directly to a {class}`Pane` (in practice, you'd use {meth}`Window.split()`):
153153

154154
```python
155155
>>> Pane.from_pane_id(pane_id=window.cmd('split-window', '-P', '-F#{pane_id}').stdout[0], server=window.server)
@@ -312,10 +312,10 @@ to grab our current window.
312312

313313
`window` now has access to all of the objects inside of {class}`Window`.
314314

315-
Let's create a pane, {meth}`Window.split_window`:
315+
Let's create a pane, {meth}`Window.split`:
316316

317317
```python
318-
>>> window.split_window(attach=False)
318+
>>> window.split(attach=False)
319319
Pane(%2 Window(@1 ...:..., Session($1 ...)))
320320
```
321321

@@ -341,15 +341,15 @@ You have two ways you can move your cursor to new sessions, windows and panes.
341341
For one, arguments such as `attach=False` can be omittted.
342342

343343
```python
344-
>>> pane = window.split_window()
344+
>>> pane = window.split()
345345
```
346346

347347
This gives you the {class}`Pane` along with moving the cursor to a new window. You
348348
can also use the `.select_*` available on the object, in this case the pane has
349349
{meth}`Pane.select()`.
350350

351351
```python
352-
>>> pane = window.split_window(attach=False)
352+
>>> pane = window.split(attach=False)
353353
```
354354

355355
```python
@@ -371,7 +371,7 @@ As long as you have the object, or are iterating through a list of them, you can
371371

372372
```python
373373
>>> window = session.new_window(attach=False, window_name="test")
374-
>>> pane = window.split_window(attach=False)
374+
>>> pane = window.split(attach=False)
375375
>>> pane.send_keys('echo hey', enter=False)
376376
```
377377

tests/test_dataclasses.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ def test_pane(
4141
assert __session is not None
4242

4343
__window = __session.active_window
44-
__window.split_window()
45-
__pane = __window.split_window()
44+
__window.split()
45+
__pane = __window.split()
4646
__window.select_layout("main-vertical")
4747

4848
assert __pane is not None
@@ -125,12 +125,12 @@ def test_pane(
125125
#
126126

127127
# Window-level
128-
new_pane = window.split_window()
128+
new_pane = window.split()
129129
assert new_pane.pane_id != pane.pane_id
130130
assert new_pane.window_id == window.window_id
131131

132132
# Pane-level
133-
new_pane_2 = new_pane.split_window()
133+
new_pane_2 = new_pane.split()
134134
assert new_pane_2.pane_id != new_pane.pane_id
135135
assert new_pane_2.window_id == new_pane.window_id
136136

tests/test_pane.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def test_send_keys(session: Session) -> None:
2828
def test_set_height(session: Session) -> None:
2929
"""Verify Pane.set_height()."""
3030
window = session.new_window(window_name="test_set_height")
31-
window.split_window()
31+
window.split()
3232
pane1 = window.active_pane
3333
assert pane1 is not None
3434
pane1_height = pane1.pane_height
@@ -42,7 +42,7 @@ def test_set_height(session: Session) -> None:
4242
def test_set_width(session: Session) -> None:
4343
"""Verify Pane.set_width()."""
4444
window = session.new_window(window_name="test_set_width")
45-
window.split_window()
45+
window.split()
4646

4747
window.select_layout("main-vertical")
4848
pane1 = window.active_pane
@@ -144,8 +144,8 @@ def test_resize_pane(
144144
session.cmd("detach-client", "-s")
145145

146146
window = session.active_window
147-
pane = window.split_window(attach=False)
148-
window.split_window(vertical=True, attach=False)
147+
pane = window.split(attach=False)
148+
window.split(vertical=True, attach=False)
149149

150150
assert pane is not None
151151

tests/test_tmuxobject.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def test_find_where_multiple_infos(server: Server, session: Session) -> None:
9999
def test_where(server: Server, session: Session) -> None:
100100
"""Test self.where() returns matching objects."""
101101
window = session.active_window
102-
window.split_window() # create second pane
102+
window.split() # create second pane
103103

104104
for session in server.sessions:
105105
session_id = session.session_id
@@ -156,7 +156,7 @@ def test_filter(server: Server) -> None:
156156
sess = server.new_session("test")
157157
window = sess.active_window
158158

159-
window.split_window() # create second pane
159+
window.split() # create second pane
160160

161161
for session in server.sessions:
162162
session_id = session.session_id

tests/test_window.py

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def test_fresh_window_data(session: Session) -> None:
7272
window = session.active_window
7373
assert isinstance(window, Window)
7474
assert len(session.active_window.panes) == 1
75-
window.split_window()
75+
window.split()
7676

7777
active_window = session.active_window
7878
assert active_window is not None
@@ -104,12 +104,12 @@ def test_newest_pane_data(session: Session) -> None:
104104
window = session.new_window(window_name="test", attach=True)
105105
assert isinstance(window, Window)
106106
assert len(window.panes) == 1
107-
window.split_window(attach=True)
107+
window.split(attach=True)
108108

109109
assert len(window.panes) == 2
110-
# note: the below used to accept -h, removing because split_window now
110+
# note: the below used to accept -h, removing because split now
111111
# has attach as its only argument now
112-
window.split_window(attach=True)
112+
window.split(attach=True)
113113
assert len(window.panes) == 3
114114

115115

@@ -119,11 +119,11 @@ def test_active_pane(session: Session) -> None:
119119
assert isinstance(window.active_pane, Pane)
120120

121121

122-
def test_split_window(session: Session) -> None:
123-
"""Window.split_window() splits window, returns new Pane, vertical."""
122+
def test_split(session: Session) -> None:
123+
"""Window.split() splits window, returns new Pane, vertical."""
124124
window_name = "test split window"
125125
window = session.new_window(window_name=window_name, attach=True)
126-
pane = window.split_window()
126+
pane = window.split()
127127
assert len(window.panes) == 2
128128
assert isinstance(pane, Pane)
129129

@@ -134,12 +134,12 @@ def test_split_window(session: Session) -> None:
134134
assert float(first_pane.pane_height) <= ((float(window.window_width) + 1) / 2)
135135

136136

137-
def test_split_window_shell(session: Session) -> None:
138-
"""Window.split_window() splits window, returns new Pane, vertical."""
137+
def test_split_shell(session: Session) -> None:
138+
"""Window.split() splits window, returns new Pane, vertical."""
139139
window_name = "test split window"
140140
cmd = "sleep 1m"
141141
window = session.new_window(window_name=window_name, attach=True)
142-
pane = window.split_window(shell=cmd)
142+
pane = window.split(shell=cmd)
143143
assert len(window.panes) == 2
144144
assert isinstance(pane, Pane)
145145

@@ -156,11 +156,11 @@ def test_split_window_shell(session: Session) -> None:
156156
assert pane.pane_start_command == cmd
157157

158158

159-
def test_split_window_horizontal(session: Session) -> None:
160-
"""Window.split_window() splits window, returns new Pane, horizontal."""
159+
def test_split_horizontal(session: Session) -> None:
160+
"""Window.split() splits window, returns new Pane, horizontal."""
161161
window_name = "test split window"
162162
window = session.new_window(window_name=window_name, attach=True)
163-
pane = window.split_window(vertical=False)
163+
pane = window.split(vertical=False)
164164
assert len(window.panes) == 2
165165
assert isinstance(pane, Pane)
166166

@@ -189,22 +189,22 @@ def test_split_percentage(session: Session) -> None:
189189
assert pane.pane_height == str(int(window_height_before * 0.1))
190190

191191

192-
def test_split_window_size(session: Session) -> None:
193-
"""Window.split_window() respects size."""
192+
def test_split_size(session: Session) -> None:
193+
"""Window.split() respects size."""
194194
window = session.new_window(window_name="split window size")
195195
window.resize(height=100, width=100)
196196

197197
if has_gte_version("3.1"):
198-
pane = window.split_window(size=10)
198+
pane = window.split(size=10)
199199
assert pane.pane_height == "10"
200200

201-
pane = window.split_window(vertical=False, size=10)
201+
pane = window.split(vertical=False, size=10)
202202
assert pane.pane_width == "10"
203203

204-
pane = window.split_window(size="10%")
204+
pane = window.split(size="10%")
205205
assert pane.pane_height == "8"
206206

207-
pane = window.split_window(vertical=False, size="10%")
207+
pane = window.split(vertical=False, size="10%")
208208
assert pane.pane_width == "8"
209209
else:
210210
window_height_before = (
@@ -213,10 +213,10 @@ def test_split_window_size(session: Session) -> None:
213213
window_width_before = (
214214
int(window.window_width) if isinstance(window.window_width, str) else 0
215215
)
216-
pane = window.split_window(size="10%")
216+
pane = window.split(size="10%")
217217
assert pane.pane_height == str(int(window_height_before * 0.1))
218218

219-
pane = window.split_window(vertical=False, size="10%")
219+
pane = window.split(vertical=False, size="10%")
220220
assert pane.pane_width == str(int(window_width_before * 0.1))
221221

222222

@@ -405,16 +405,16 @@ def test_empty_window_name(session: Session) -> None:
405405
{"ENV_VAR_1": "pane_1", "ENV_VAR_2": "pane_2"},
406406
],
407407
)
408-
def test_split_window_with_environment(
408+
def test_split_with_environment(
409409
session: Session,
410410
environment: t.Dict[str, str],
411411
) -> None:
412412
"""Verify splitting window with environment variables."""
413413
env = shutil.which("env")
414414
assert env is not None, "Cannot find usable `env` in Path."
415415

416-
window = session.new_window(window_name="split_window_with_environment")
417-
pane = window.split_window(
416+
window = session.new_window(window_name="split_with_environment")
417+
pane = window.split(
418418
shell=f"{env} PS1='$ ' sh",
419419
environment=environment,
420420
)
@@ -430,16 +430,16 @@ def test_split_window_with_environment(
430430
has_gte_version("3.0"),
431431
reason="3.0 has the -e flag on split-window",
432432
)
433-
def test_split_window_with_environment_logs_warning_for_old_tmux(
433+
def test_split_with_environment_logs_warning_for_old_tmux(
434434
session: Session,
435435
caplog: pytest.LogCaptureFixture,
436436
) -> None:
437437
"""Verify splitting window with environment variables warns if tmux too old."""
438438
env = shutil.which("env")
439439
assert env is not None, "Cannot find usable `env` in Path."
440440

441-
window = session.new_window(window_name="split_window_with_environment")
442-
window.split_window(
441+
window = session.new_window(window_name="split_with_environment")
442+
window.split(
443443
shell=f"{env} PS1='$ ' sh",
444444
environment={"ENV_VAR": "pane"},
445445
)

0 commit comments

Comments
 (0)