Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

screen flickering with 3.2 update #7775

Closed
ipatch opened this issue Mar 3, 2021 · 8 comments
Closed

screen flickering with 3.2 update #7775

ipatch opened this issue Mar 3, 2021 · 8 comments
Labels
regression Something that used to work, but was broken, especially between releases
Milestone

Comments

@ipatch
Copy link

ipatch commented Mar 3, 2021

fish version,

fish, version 3.2.0

os,

ProductName:    Mac OS X
ProductVersion: 10.14.6
BuildVersion:   18G8022
Darwin rogue.local 18.7.0 Darwin Kernel Version 18.7.0: Tue Jan 12 22:04:47 PST 2021; root:xnu-4903.278.56~1/RELEASE_X86_64 x86_64
echo $TERM
tmux-256color

Please tell us if you tried fish without third-party customizations by executing this command and whether it affected the behavior you are reporting:

sh -c 'env HOME=$(mktemp -d) fish'

did not try above

basically updated to fish v3.2 today via homebrew on macos

after updating it appears i'm getting some "screen flickering" for certain terminal actions, ie. clearing the screen. it maybe more than likely be related to my prompt/theme, but just thought i'd report here.

i'm using my own theme neolambda, https://github.com/ipatch/theme-neolambda

and seems to be happening when inside tmux. i use alacritty as my terminal, and noticed the same behavior with iterm2 as well when inside tmux, i did not have this behavior before updating to fish v3.2 i was running 3.12 i believe and this was not an issue. attached video demonstrating issue.

exp2.mp4
@ipatch
Copy link
Author

ipatch commented Mar 3, 2021

more than likely it's related to how the git prompt is being rendered when in a directory that is a git repository.

@faho
Copy link
Member

faho commented Mar 3, 2021

This is a classic case of "narrow that thing down".

I have very little idea what about your prompt is supposed to trigger this. I can tell you that, for normal prompt drawing, fish just executes the functions (mode_prompt, prompt and right_prompt), once, and sets that as the output.

Then, whenever you have a repaint, it executes them again (which is the reason for the repaint-mode bind function, which just uses the mode_prompt if possible). Previous fish versions tried to "coalesce" that, 3.2 doesn't anymore.

So I would assume that something here is triggering multiple repaints, but I have no idea what.

@faho faho added the question label Mar 3, 2021
@zenobht
Copy link

zenobht commented Mar 4, 2021

I am facing this problem as well. Using alacrity 0.7.2, tmux 3.1c and fish 3.2.0. Here is the command prompt function I am using.

set __fish_git_prompt_show_informative_status
set __fish_git_prompt_showcolorhints 'yes'
set __fish_git_prompt_showupstream 'informative'
set __fish_git_prompt_showdirtystate 'yes'
set __fish_git_prompt_char_cleanstate '✔'
set __fish_git_prompt_char_dirtystate '◆'
set __fish_git_prompt_char_upstream_ahead '↑'
set __fish_git_prompt_char_upstream_behind '↓'
set __fish_git_prompt_char_upstream_diverged '<>'
set __fish_git_prompt_color_upstream cyan
set fish_color_cwd blue
set __fish_git_prompt_color_branch magenta

function fish_prompt --description 'Write out the prompt'
    set -l prompt ' ❯ '

    set -l prompt_color green
    if test $status -ne 0
        set prompt_color red
    end

    set -l pwd (prompt_pwd)

    set vcs (fish_vcs_prompt)

    echo -n -s (set_color $fish_color_cwd) $pwd $vcs (set_color $prompt_color) $prompt
end

@zenobht
Copy link

zenobht commented Mar 4, 2021

Commenting out these lines fixed it for me.

set __fish_git_prompt_showupstream 'informative'
set __fish_git_prompt_showdirtystate 'yes'
set __fish_git_prompt_char_cleanstate '✔'
set __fish_git_prompt_char_dirtystate '◆'
set __fish_git_prompt_char_upstream_ahead '↑'
set __fish_git_prompt_char_upstream_behind '↓'
set __fish_git_prompt_char_upstream_diverged '<>'
set __fish_git_prompt_color_upstream cyan

I am thinking it is set __fish_git_prompt_showupstream 'informative' that is causing it.

Commenting out this set __fish_git_prompt_show_informative_status will stop flicker

@ipatch
Copy link
Author

ipatch commented Mar 4, 2021

@1bharat

thanks, ill check my prompt config here in a bit and see if that is my issue as well.

@faho
Copy link
Member

faho commented Mar 4, 2021

Ah, I think I know what's going on.

Please run functions --erase __fish_git_prompt_repaint_char interactively and see if you can still reproduce this in that session.

@zenobht
Copy link

zenobht commented Mar 4, 2021

Thanks @faho

That seems to have fixed it. I didn't see any flickering yet with my old prompt.

@faho faho added regression Something that used to work, but was broken, especially between releases and removed question labels Mar 4, 2021
@faho faho added this to the fish 3.2.1 milestone Mar 4, 2021
@faho
Copy link
Member

faho commented Mar 4, 2021

Alright, the issue is that the git prompt tries to be smart and adds variable listeners for its configuration variables. They recompute the settings and trigger a repaint. And because we no longer coalesce repaints that will now run multiple times (I assume it's hitting the recursion depth at some point, which is why it's not an infinite loop), and your terminal renders that weirdly (it seems like the cursor is getting enabled somehow?).

As far as I can see, that repaint is not actually useful so we should just drop it (and honestly probably the listeners entirely, but that needs us to recompute the actual settings). If you run set interactively that will already trigger a new prompt, and if you run it from a prompt you're already inside one. The only change would be:

  • Currently you can set the variables after calling fish_git_prompt and it should repaint and show the new value - this is an awkward way to do it, just set the variables before
  • If you set it from a keybinding you'd have to add a repaint (but that's expected in bindings in general)

@faho faho closed this as completed in 76457bd Mar 4, 2021
faho added a commit that referenced this issue Mar 4, 2021
This was a handler for various prompt variables that called a repaint.

Unfortunately, if you set one of those *inside* the prompt (a logical
place for it), this would lead to something like #7775.

So, because this isn't actually *useful* as far as I can see (how do
you set these variables in a way that you're not already inside a
prompt or about to draw a prompt? in a key binding?), we remove it,
like we removed the repaint from git's variable handlers.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
regression Something that used to work, but was broken, especially between releases
Projects
None yet
Development

No branches or pull requests

3 participants