Implement ^K for command mode

This commit is contained in:
Anthony Sottile
2019-12-25 09:09:38 -08:00
parent ae5e619124
commit 68ee9eafa6
2 changed files with 14 additions and 0 deletions

View File

@@ -360,6 +360,8 @@ class Status:
elif isinstance(key.wch, str) and key.wch.isprintable():
set_buf(buf()[:pos] + key.wch + buf()[pos:])
pos += 1
elif key.keyname == b'^K':
set_buf(buf()[:pos])
elif key.keyname == b'^R':
reverse_s = ''
reverse_idx = lst_pos

View File

@@ -63,6 +63,18 @@ def test_key_navigation_in_command_mode():
h.press('Enter')
def test_command_mode_ctrl_k(tmpdir):
with run() as h, and_exit(h):
trigger_command_mode(h)
h.press('hello world')
h.await_text('\nhello world\n')
for _ in range(6): # TODO: ^Left
h.press('Left')
h.press('^K')
h.await_text('\nhello\n')
h.press('Enter')
def test_save_via_command_mode(tmpdir):
f = tmpdir.join('f')