Don't enqueue a repaint in the middle of one

This can easily lead to an infinite loop, if a variable handler
triggers a repaint and the variable is set in the prompt, e.g. some of
the git variables.

A simple way to reproduce:

    function fish_mode_prompt
        commandline -f repaint
    end

Repainting executes the mode prompt, which triggers a repaint, which
triggers the mode prompt, ....

So we just set a flag and check it.

Fixes #7324.
This commit is contained in:
Fabian Homborg
2020-09-11 19:23:26 +02:00
parent c6cdc06a5b
commit 30b2dc2b97
4 changed files with 26 additions and 0 deletions

View File

@@ -151,6 +151,10 @@ struct library_data_t {
/// Number of recursive calls to builtin_complete().
uint32_t builtin_complete_recursion_level{0};
/// If we're currently repainting the commandline.
/// Useful to stop infinite loops.
bool is_repaint{false};
/// Whether we called builtin_complete -C without parameter.
bool builtin_complete_current_commandline{false};