Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose Shift+arrow keys for key bindings. #54

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions pymux/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,15 @@ def literal():
}

# Date/time formatting.
try:
if six.PY2:
string = datetime.datetime.now().strftime(
string.encode('utf-8')).decode('utf-8')
else:
string = datetime.datetime.now().strftime(string)
except ValueError: # strftime format ends with raw %
string = '<ValueError>'
if '%' in string:
try:
if six.PY2:
string = datetime.datetime.now().strftime(
string.encode('utf-8')).decode('utf-8')
else:
string = datetime.datetime.now().strftime(string)
except ValueError: # strftime format ends with raw %
string = '<ValueError>'

# Apply '#' formatting.
for symbol, f in format_table.items():
Expand Down
10 changes: 10 additions & 0 deletions pymux/key_mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ def prompt_toolkit_key_to_vt100_key(key, application_mode=False):
Keys.Down: '\x1bOB',
}

if key == Keys.ControlJ:
# Required for redis-cli. This can be removed when prompt_toolkit stops
# replacing \r by \n.
return '\r'

if key == '\n':
return '\r'

Expand Down Expand Up @@ -102,6 +107,11 @@ def prompt_toolkit_key_to_vt100_key(key, application_mode=False):
'C-Down': (Keys.ControlDown, ),
'C-\\': (Keys.ControlBackslash, ),

'S-Left': (Keys.ShiftLeft, ),
'S-Right': (Keys.ShiftRight, ),
'S-Up': (Keys.ShiftUp, ),
'S-Down': (Keys.ShiftDown, ),

'M-C-a': (Keys.Escape, Keys.ControlA, ),
'M-C-b': (Keys.Escape, Keys.ControlB, ),
'M-C-c': (Keys.Escape, Keys.ControlC, ),
Expand Down
2 changes: 1 addition & 1 deletion pymux/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def set_value(self, pymux, cli, value):
'prefix': KeyPrefixOption(),
'remain-on-exit': OnOffOption('remain_on_exit'),
'status': OnOffOption('enable_status'),
'pane-status': OnOffOption('enable_pane_status'),
'pane-border-status': OnOffOption('enable_pane_status'),
'status-keys': KeysOption('status_keys_vi_mode'),
'mode-keys': KeysOption('mode_keys_vi_mode'),
'default-terminal': StringOption(
Expand Down
3 changes: 1 addition & 2 deletions pymux/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import sys
import time
import traceback
import datetime

__all__ = (
'Process',
Expand Down Expand Up @@ -297,7 +296,7 @@ def do_asap():
# that we will process max 1k/1s in case of saturation.
# That should be enough to prevent the UI from feeling
# unresponsive.
timestamp = datetime.datetime.now() + datetime.timedelta(seconds=1)
timestamp = time.time() + 1

self.eventloop.call_from_executor(
do_asap, _max_postpone_until=timestamp)
Expand Down