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

@@ -23,3 +23,10 @@ sendline(
expect_prompt()
sendline("echo one \"two three\" four'five six'{7} 'eight~")
expect_prompt("\r\n@GUARD:2@\r\n(.*)\r\n@/GUARD:2@\r\n")
# Check that we don't infinitely loop here.
sendline("function fish_mode_prompt; commandline -f repaint; end")
expect_prompt()
sendline("echo foo")
expect_prompt("foo")