Skip to content

Commit 0f6e581

Browse files
Handling of the insert key.
1 parent 949390c commit 0f6e581

File tree

5 files changed

+9
-0
lines changed

5 files changed

+9
-0
lines changed

prompt_toolkit/key_binding/bindings/basic.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ def load_basic_bindings(registry, filter=Always()):
9999
@handle(Keys.ControlRight)
100100
@handle(Keys.ControlUp)
101101
@handle(Keys.ControlDown)
102+
@handle(Keys.Insert)
102103
def _(event):
103104
"""
104105
First, for any of these keys, Don't do anything by default. Also don't

prompt_toolkit/key_binding/bindings/vi.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,11 @@ def _(event):
229229

230230
# List of navigation commands: http://hea-www.harvard.edu/~fine/Tech/vi.html
231231

232+
@handle(Keys.Insert, filter=navigation_mode)
233+
def _(event):
234+
" Presing the Insert key. "
235+
vi_state.input_mode = InputMode.INSERT
236+
232237
@handle('a', filter=navigation_mode & ~IsReadOnly())
233238
# ~IsReadOnly, because we want to stay in navigation mode for
234239
# read-only buffers.

prompt_toolkit/keys.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class Keys(object):
6868
PageUp = Key('<PageUp>')
6969
PageDown = Key('<PageDown>')
7070
BackTab = Key('<BackTab>') # shift + tab
71+
Insert = Key('<Insert>')
7172

7273
Tab = ControlI
7374
Backspace = ControlH

prompt_toolkit/terminal/vt100_input.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ class _Flush(object):
9898
'\x1b[7~': Keys.Home, # xrvt
9999
'\x1b[8~': Keys.End, # xrvt
100100
'\x1b[Z': Keys.BackTab, # shift + tab
101+
'\x1b[2~': Keys.Insert,
101102

102103
'\x1bOP': Keys.F1,
103104
'\x1bOQ': Keys.F2,

prompt_toolkit/terminal/win32_input.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class ConsoleInputReader(object):
6969
39: Keys.Right,
7070
40: Keys.Down,
7171

72+
45: Keys.Insert,
7273
46: Keys.Delete,
7374

7475
# F-keys.

0 commit comments

Comments
 (0)