Skip to content

Commit

Permalink
Add optional parameter literal to Pane.send_keys
Browse files Browse the repository at this point in the history
  • Loading branch information
ritiek committed Oct 14, 2018
1 parent 8119353 commit c1382b3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions libtmux/pane.py
Expand Up @@ -93,7 +93,7 @@ def cmd(self, cmd, *args, **kwargs):

return self.server.cmd(cmd, *args, **kwargs)

def send_keys(self, cmd, enter=True, suppress_history=True):
def send_keys(self, cmd, enter=True, suppress_history=True, literal=False):
"""
``$ tmux send-keys`` to the pane.
Expand All @@ -108,9 +108,15 @@ def send_keys(self, cmd, enter=True, suppress_history=True):
Send enter after sending the input, default True.
suppress_history : bool, optional
Don't add these keys to the shell history, default True.
literal : bool, optional
Send keys literally, default True.
"""
prefix = ' ' if suppress_history else ''
self.cmd('send-keys', prefix + cmd)

if literal:
self.cmd('send-keys', '-l', prefix + cmd)
else:
self.cmd('send-keys', prefix + cmd)

if enter:
self.enter()
Expand Down

0 comments on commit c1382b3

Please sign in to comment.