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

Windows: prompt is flickering #84

Open
Tracked by #35
certik opened this issue Sep 8, 2024 · 6 comments
Open
Tracked by #35

Windows: prompt is flickering #84

certik opened this issue Sep 8, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@certik
Copy link
Collaborator

certik commented Sep 8, 2024

This is hard to show in a screenshot, but especially when hitting TAB, the prompt is flickering. It didn't used to do that. It also happens when hitting Backspace.

When redrawing it, one must not erase the old stuff, just write new stuff over it.

A separate issue is that when hitting enter, the cursor goes to the left quickly, which again must be fixed, for example by turning the cursor off, drawing, turning it on.

This is a big usability bug. :)

@certik certik added the bug Something isn't working label Sep 8, 2024
@certik
Copy link
Collaborator Author

certik commented Sep 8, 2024

I used the latest main for a while, and this is very annoying, that I will have to revert to an older version that didn't do that.

Update: Older version does it too. Maybe this bug was there from the beginning, I just didn't notice until now.

The flicker does not happen on Linux. So it's a Window specific issue.

@certik certik pinned this issue Sep 8, 2024
@Hofer-Julian
Copy link
Contributor

Can you try nushell and see if you experience the same? I and many others had similar problems on Windows.

Undortunately nobody seems to have an idea where it comes from, but it’s especially bad on Windows Terminal

@certik
Copy link
Collaborator Author

certik commented Sep 8, 2024

I just tested nushell installed using conda and it flickers as well.

Generally such flicker in any terminal comes from erasing the line and redrawing, as well as possibly from not turning off the cursor when redrawing.

Our C++ terminal multi-line prompt does not flicker: https://github.com/lfortran/lfortran/tree/79e7444ca0e58adbaa06db5e839b91d5e9eb915f/src/bin/tpl/cpp-terminal, so we can use it. However the system behind it is really simple, so we just need to write our own Rust version of it, or fix the upstream codes. This is terminal 101. :) Such basic issues must be resolved from the beginning. :)

@Hofer-Julian
Copy link
Contributor

Seems like something has been fixed recently: microsoft/terminal#16769

Maybe we don't have to do anything to fix it :)

@certik
Copy link
Collaborator Author

certik commented Sep 8, 2024

That particular fix was done in March, which means I am already running it. The fact that my prompt works shows that it is possible to make it work well in Windows Terminal. I'll try to write a demo using Rust that works. A simple fix is to not update the whole line, but only what changed. But even updating a line that didn't change should not flicker generally. However if you first put spaces (to clear old contents) and then redraw, it will flicker in some terminals.

My point is that we should not depend on a particular implementation of a terminal. We have to write the shell in such a way to work in all terminals and not flicker. Since I have code that works, it's simply our own bug that we should fix. In addition, there might be some bug in the Terminal that would allow even imperfect code to not flicker, but we don't want to depend on it.

@certik
Copy link
Collaborator Author

certik commented Sep 9, 2024

On another machine, the following Windows Terminal version does NOT flicker:

Windows Terminal
Version: 1.20.11781.0

The first machine where it flickers is:

Windows Terminal
Version: 1.20.11781.0

So the same version.

@certik certik unpinned this issue Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants