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)
| 2 | |
| 3 | |
| 4 | def 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 |
no outgoing calls
no test coverage detected