Skip to content

Commit d5afed9

Browse files
committed
refactor(Server.new_sesion): Use x and y for param names
1 parent b92637f commit d5afed9

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

CHANGES

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ $ pip install --user --upgrade --pre libtmux
1414

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

17-
- Server.new_session: Accept `window_height` and `window_width`, thanks
17+
### What's new
18+
19+
- Server.new_session: Accept `x` and `y`, thanks
1820
@rockandska (#469)
1921

2022
## libtmux 0.19.1 (2022-01-07)

src/libtmux/server.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,8 @@ def new_session(
351351
start_directory: t.Optional[str] = None,
352352
window_name: t.Optional[str] = None,
353353
window_command: t.Optional[str] = None,
354-
window_width: t.Optional[int] = None,
355-
window_height: t.Optional[int] = None,
354+
x: t.Optional[int] = None,
355+
y: t.Optional[int] = None,
356356
*args: t.Any,
357357
**kwargs: t.Any,
358358
) -> Session:
@@ -395,10 +395,10 @@ def new_session(
395395
when the command exits. NOTE: When this command exits the window
396396
will close. This feature is useful for long-running processes
397397
where the closing of the window upon completion is desired.
398-
window_width : int, optional
398+
x : int, optional
399399
Force the specified width instead of the tmux default for a
400400
dettached session
401-
window_height : int, optional
401+
y : int, optional
402402
Force the specified height instead of the tmux default for a
403403
dettached session
404404
@@ -463,11 +463,11 @@ def new_session(
463463
if window_name:
464464
tmux_args += ("-n", window_name)
465465

466-
if window_width is not None:
467-
tmux_args += ("-x", window_width)
466+
if x is not None:
467+
tmux_args += ("-x", x)
468468

469-
if window_height is not None:
470-
tmux_args += ("-y", window_height)
469+
if y is not None:
470+
tmux_args += ("-y", y)
471471

472472
if window_command:
473473
tmux_args += (window_command,)

tests/test_server.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,19 +127,16 @@ def test_new_session_shell(server: Server) -> None:
127127
assert pane_start_command == cmd
128128

129129

130-
@pytest.mark.skipif(
131-
has_version("3.2"),
132-
reason="Wrong width returned with 3.2"
133-
)
130+
@pytest.mark.skipif(has_version("3.2"), reason="Wrong width returned with 3.2")
134131
def test_new_session_width_height(server: Server) -> None:
135132
"""Server.new_session creates and returns valid session running with
136133
specified width /height"""
137134
cmd = "/usr/bin/env PS1='$ ' sh"
138135
mysession = server.new_session(
139136
"test_new_session_width_height",
140137
window_command=cmd,
141-
window_width=32,
142-
window_height=32,
138+
x=32,
139+
y=32,
143140
)
144141
window = mysession.windows[0]
145142
pane = window.panes[0]

0 commit comments

Comments
 (0)