Implement ^K for command mode
This commit is contained in:
2
babi.py
2
babi.py
@@ -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
|
||||
|
||||
@@ -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')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user