Skip to content

Commit 465ab02

Browse files
vicalloyjonathanslenders
authored andcommitted
To fix the memory leak, move the inline condition filter emacs.is_arg out of function.
1 parent 8f31416 commit 465ab02

File tree

1 file changed

+6
-1
lines changed
  • src/prompt_toolkit/key_binding/bindings

1 file changed

+6
-1
lines changed

Diff for: src/prompt_toolkit/key_binding/bindings/emacs.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ def is_returnable() -> bool:
3838
return get_app().current_buffer.is_returnable
3939

4040

41+
@Condition
42+
def is_arg() -> bool:
43+
return get_app().key_processor.arg == "-"
44+
45+
4146
def load_emacs_bindings() -> KeyBindingsBase:
4247
"""
4348
Some e-macs extensions.
@@ -139,7 +144,7 @@ def _meta_dash(event: E) -> None:
139144
if event._arg is None:
140145
event.append_to_arg_count("-")
141146

142-
@handle("-", filter=Condition(lambda: get_app().key_processor.arg == "-"))
147+
@handle("-", filter=is_arg)
143148
def _dash(event: E) -> None:
144149
"""
145150
When '-' is typed again, after exactly '-' has been given as an

0 commit comments

Comments
 (0)