Skip to content

Commit 02da6a6

Browse files
HuXiaomaojonathanslenders
HuXiaomao
authored andcommitted
change filters's order to fix memory leak
1 parent 0151f23 commit 02da6a6

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Diff for: src/prompt_toolkit/layout/menus.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ def __init__(
289289
),
290290
# Show when there are completions but not at the point we are
291291
# returning the input.
292-
filter=has_completions & ~is_done & extra_filter,
292+
filter=extra_filter & has_completions & ~is_done,
293293
)
294294

295295

@@ -647,7 +647,7 @@ def __init__(
647647

648648
# Display filter: show when there are completions but not at the point
649649
# we are returning the input.
650-
full_filter = has_completions & ~is_done & extra_filter
650+
full_filter = extra_filter & has_completions & ~is_done
651651

652652
@Condition
653653
def any_completion_has_meta() -> bool:
@@ -676,7 +676,7 @@ def any_completion_has_meta() -> bool:
676676

677677
meta_window = ConditionalContainer(
678678
content=Window(content=_SelectedCompletionMetaControl()),
679-
filter=show_meta & full_filter & any_completion_has_meta,
679+
filter=full_filter & show_meta & any_completion_has_meta,
680680
)
681681

682682
# Initialise split.

Diff for: src/prompt_toolkit/shortcuts/prompt.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -571,9 +571,9 @@ def display_placeholder() -> bool:
571571
dont_extend_height=True,
572572
height=Dimension(min=1),
573573
),
574-
filter=~is_done
575-
& renderer_height_is_known
576-
& Condition(lambda: self.bottom_toolbar is not None),
574+
filter=Condition(lambda: self.bottom_toolbar is not None)
575+
& ~is_done
576+
& renderer_height_is_known,
577577
)
578578

579579
search_toolbar = SearchToolbar(

0 commit comments

Comments
 (0)