From e2af5111968383a11fc4576efc25eefd4a849852 Mon Sep 17 00:00:00 2001 From: Jonathan Slenders Date: Mon, 29 Aug 2016 18:19:22 +0200 Subject: [PATCH 1/5] Expose Shift+arrow keys for key bindings. --- pymux/key_mappings.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pymux/key_mappings.py b/pymux/key_mappings.py index d4e7805..dd5c99a 100644 --- a/pymux/key_mappings.py +++ b/pymux/key_mappings.py @@ -102,6 +102,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, ), From ddfb0a25259032d06bf9d3db61010755f82c3d22 Mon Sep 17 00:00:00 2001 From: Jonathan Slenders Date: Tue, 30 Aug 2016 22:12:35 +0200 Subject: [PATCH 2/5] Send \r instead of \n to the application when enter has been pressed. --- pymux/key_mappings.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pymux/key_mappings.py b/pymux/key_mappings.py index dd5c99a..7f34454 100644 --- a/pymux/key_mappings.py +++ b/pymux/key_mappings.py @@ -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' From ec7263532c9f9e88fb2bdf4f49e642a244dcc987 Mon Sep 17 00:00:00 2001 From: Jonathan Slenders Date: Thu, 6 Oct 2016 21:44:05 +0200 Subject: [PATCH 3/5] Only do datetime formatting if the string actually contains a %-sign. --- pymux/format.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pymux/format.py b/pymux/format.py index 3c6abda..d5ca6e3 100644 --- a/pymux/format.py +++ b/pymux/format.py @@ -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 = '' + 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 = '' # Apply '#' formatting. for symbol, f in format_table.items(): From 9838bce748c501d7c3eb468b507cc49f03279482 Mon Sep 17 00:00:00 2001 From: Jonathan Slenders Date: Thu, 6 Oct 2016 21:45:37 +0200 Subject: [PATCH 4/5] Renamed pane-status to pane-border-status. (Similar to tmux.) --- pymux/options.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymux/options.py b/pymux/options.py index 83cf1ff..b07bcdd 100644 --- a/pymux/options.py +++ b/pymux/options.py @@ -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( From 077451d227386b68523a54911dc04998ff7ecabc Mon Sep 17 00:00:00 2001 From: Jonathan Slenders Date: Thu, 6 Oct 2016 21:46:12 +0200 Subject: [PATCH 5/5] prompt_toolkit compatibility: call_from_executor expects _max_postpone_until to be a 'time.time()' float. (requires latest development version of prompt_toolkit.) --- pymux/process.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pymux/process.py b/pymux/process.py index 57e2c45..b734ae5 100644 --- a/pymux/process.py +++ b/pymux/process.py @@ -19,7 +19,6 @@ import sys import time import traceback -import datetime __all__ = ( 'Process', @@ -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)