Skip to content

Commit 21d1fe9

Browse files
committed
Fixed key binding toggle
1 parent 20a83e8 commit 21d1fe9

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

awsshell/app.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from prompt_toolkit.interface import AbortAction, AcceptAction
1818
from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
1919
from prompt_toolkit.history import InMemoryHistory, FileHistory
20+
from prompt_toolkit.enums import EditingMode
2021

2122
from awsshell.ui import create_default_layout
2223
from awsshell.config import Config
@@ -417,7 +418,13 @@ def create_application(self, completer, history,
417418
'clidocs': Buffer(read_only=True)
418419
}
419420

421+
if self.enable_vi_bindings:
422+
editing_mode = EditingMode.VI
423+
else:
424+
editing_mode = EditingMode.EMACS
425+
420426
return Application(
427+
editing_mode=editing_mode,
421428
layout=self.create_layout(display_completions_in_columns, toolbar),
422429
mouse_support=False,
423430
style=style_factory.style,

tests/integration/test_keys.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,20 @@ def test_F3(self):
4646
enable_vi_bindings = self.aws_shell.enable_vi_bindings
4747
with self.assertRaises(InputInterrupt):
4848
self.feed_key(Keys.F3)
49-
assert enable_vi_bindings != self.aws_shell.enable_vi_bindings
49+
assert enable_vi_bindings != self.aws_shell.enable_vi_bindings
5050

5151
def test_F4(self):
5252
show_completion_columns = self.aws_shell.show_completion_columns
5353
with self.assertRaises(InputInterrupt):
5454
self.feed_key(Keys.F4)
55-
assert show_completion_columns != \
56-
self.aws_shell.show_completion_columns
55+
assert show_completion_columns != \
56+
self.aws_shell.show_completion_columns
5757

5858
def test_F5(self):
5959
show_help = self.aws_shell.show_help
6060
with self.assertRaises(InputInterrupt):
6161
self.feed_key(Keys.F5)
62-
assert show_help != self.aws_shell.show_help
62+
assert show_help != self.aws_shell.show_help
6363

6464
def test_F10(self):
6565
self.feed_key(Keys.F10)

0 commit comments

Comments
 (0)