MCPcopy Create free account
hub / github.com/dbcli/mycli / safe_invalidate_display

Function safe_invalidate_display

mycli/packages/ptoolkit/utils.py:4–23  ·  view source on GitHub ↗

fzf can confuse the terminal/app when certain values are set in environment variable FZF_DEFAULT_OPTS. The same could happen after running other external programs. This function invalidates the prompt_toolkit display, causing a refresh of the prompt message and pending user in

(app: Application)

Source from the content-addressed store, hash-verified

2
3
4def safe_invalidate_display(app: Application) -> None:
5 """
6 fzf can confuse the terminal/app when certain values are set in
7 environment variable FZF_DEFAULT_OPTS.
8
9 The same could happen after running other external programs.
10
11 This function invalidates the prompt_toolkit display, causing a
12 refresh of the prompt message and pending user input, without
13 leading to exceptions at exit time, as the built-in
14 app.invalidate() does.
15 """
16
17 def print_empty_string():
18 app.print_text('')
19
20 try:
21 run_in_terminal(print_empty_string)
22 except RuntimeError:
23 pass

Callers 2

_Function · 0.90
search_historyFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected