Skip to content

Commit 9b3e2e5

Browse files
document added leading space in Pane.send_keys
1 parent b8adcf9 commit 9b3e2e5

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

doc/quickstart_python.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,11 +345,13 @@ As long as you have the object, or are iterating through a list of them, you can
345345
>>> pane = window.split_window(attach=False)
346346
>>> pane.send_keys('echo hey', enter=False)
347347
348-
See the other window, notice that :meth:`Pane.send_keys` has ``echo hey`` written,
349-
*still in the prompt*.
348+
See the other window, notice that :meth:`Pane.send_keys` has " ``echo hey``" written,
349+
*still in the prompt*. Note the leading space character so the command won't be added
350+
to the user's history. Use `pane.tmux('send-keys', text)` to send keys without this
351+
leading space.
350352

351353
``enter=False`` can be used to send keys without pressing return. In this case,
352-
you may leave it to the user to press return themselves, or complete a command
354+
you may leave it to the user to press return themselves, or complete a command
353355
using :meth:`Pane.enter()`:
354356

355357
.. code-block:: python

tmuxp/pane.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ def tmux(self, cmd, *args, **kwargs):
7575
def send_keys(self, cmd, enter=True):
7676
"""``$ tmux send-keys`` to the pane.
7777
78+
A leading space character is added to cmd to avoid polluting the
79+
user's history.
80+
7881
:param cmd: Text or input into pane
7982
:type cmd: str
8083
:param enter: Send enter after sending the input.

0 commit comments

Comments
 (0)