diff options
author | Jonathan Slenders <jonathan@slenders.be> | 2016-08-29 18:10:47 +0200 |
---|---|---|
committer | Jonathan Slenders <jonathan@slenders.be> | 2016-08-29 18:16:54 +0200 |
commit | 6c76f472c76c35c70ea03f6fe6328d41b6fc6c3d (patch) | |
tree | 26c213ded4d699a07abf2a5cae4f3fd24a5855cd | |
parent | ea814060014e25fd6379cca3529641df3de666d0 (diff) |
Added shift+left/up/down/right keys.
-rw-r--r-- | prompt_toolkit/key_binding/bindings/basic.py | 4 | ||||
-rw-r--r-- | prompt_toolkit/keys.py | 6 | ||||
-rw-r--r-- | prompt_toolkit/terminal/vt100_input.py | 5 |
3 files changed, 15 insertions, 0 deletions
diff --git a/prompt_toolkit/key_binding/bindings/basic.py b/prompt_toolkit/key_binding/bindings/basic.py index cd8cb946..2d9de77c 100644 --- a/prompt_toolkit/key_binding/bindings/basic.py +++ b/prompt_toolkit/key_binding/bindings/basic.py @@ -89,6 +89,10 @@ def load_basic_bindings(registry, filter=Always()): @handle(Keys.Down) @handle(Keys.Right) @handle(Keys.Left) + @handle(Keys.ShiftUp) + @handle(Keys.ShiftDown) + @handle(Keys.ShiftRight) + @handle(Keys.ShiftLeft) @handle(Keys.Home) @handle(Keys.End) @handle(Keys.Delete) diff --git a/prompt_toolkit/keys.py b/prompt_toolkit/keys.py index 3c6f4d78..d5df9bff 100644 --- a/prompt_toolkit/keys.py +++ b/prompt_toolkit/keys.py @@ -61,6 +61,12 @@ class Keys(object): Down = Key('<Down>') Right = Key('<Right>') Left = Key('<Left>') + + ShiftLeft = Key('<ShiftLeft>') + ShiftUp = Key('<ShiftUp>') + ShiftDown = Key('<ShiftDown>') + ShiftRight = Key('<ShiftRight>') + Home = Key('<Home>') End = Key('<End>') Delete = Key('<Delete>') diff --git a/prompt_toolkit/terminal/vt100_input.py b/prompt_toolkit/terminal/vt100_input.py index 6b74e7ba..2efaf1a6 100644 --- a/prompt_toolkit/terminal/vt100_input.py +++ b/prompt_toolkit/terminal/vt100_input.py @@ -152,6 +152,11 @@ ANSI_SEQUENCES = { '\x1b[1;5C': Keys.ControlRight, # Cursor Mode '\x1b[1;5D': Keys.ControlLeft, # Cursor Mode + '\x1b[1;2A': Keys.ShiftUp, + '\x1b[1;2B': Keys.ShiftDown, + '\x1b[1;2C': Keys.ShiftRight, + '\x1b[1;2D': Keys.ShiftLeft, + # Tmux sends following keystrokes when control+arrow is pressed, but for # Emacs ansi-term sends the same sequences for normal arrow keys. Consider # it a normal arrow press, because that's more important. |