Open Reyhn3 opened 1 month ago
Thank you for opening an issue 😁
I've created a new release in which the previous screen won't be cleared after clock-rs
has finished.
Since I'm using the alternate screen mode for that, your issue could be resolved in the new update.
Are you able to reproduce this in verson 0.1.2? You can use cargo install clock-rs --force
to update.
I appreciated the fast response!
I need some help, though, with verifying this. I'm completely new to Rust, and I can't get the new version to run even though everything looks alright.
I've pulled the latest main branch:
❯ git status
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean
I can see that I have the changes you pushed a few hours ago. And then I build:
❯ cargo install clock-rs --force
Updating crates.io index
Installing clock-rs v0.1.2
...
Compiling clock-rs v0.1.2
Finished `release` profile [optimized] target(s) in 1m 33s
Replacing C:\Users\reyhn\.cargo\bin\clock-rs.exe
Replaced package `clock-rs v0.1.1` with `clock-rs v0.1.2` (executable `clock-rs.exe`)
But when I run the clock, it's still the old version number, and the time is still flickering:
❯ C:\Users\reyhn\.cargo\bin\clock-rs.exe --version
clock-rs v0.1.0, (C) 2024 Oughie
I'm guessing that either your fix didn't work and the build didn't update the version number, which seems unlikely, or something has gone wrong during the compilation. Do you have any idea?
(Also, I can see that the binary reports version 0.1.0
, but the previous version that was replaced with the cargo install
command was version 0.1.1
, which is odd. I am certain that I checked out this repo for the very first time yesterday 2024-08-06, installed rust and executed cargo install
yesterday, so it should have been version 0.1.1
since that commit is from 2024-07-27. I don't know if this is a clue to what's going on...)
Also, I noticed a few other things as well:
clock-rs.exe
does not have the version number embedded in its file propertiesI'm sorry I couldn't just confirm this fix, but right now I'm stuck due too little experience with rust. ):
My fault, just some typos I made!
In my code, I had forgotten to update clock-rs v0.1.0, (C) 2024 Oughie
to clock-rs v0.1.2, (C) 2024 Oughie
. Also, I now got rid of the horrific typo in Cargo.toml
.
You did everything right, it's just the typos I accidentally made. Since you correctly installed the new version of the project which is still flickering, using the alternate screen seemed to not help resolve this issue. I'm on Linux using the kitty terminal where it does work fine (on Alacritty as well), so I sadly cannot test it in the Windows Terminal! For now, I'll push the fixes for the typos (v0.1.201) and I will try to fix this issue, but I can't promise that I will be able to!
Does it still flicker with a small (minimal) terminal size?
Also, have you used the original tty-clock
? Does it also flicker?
That explains a lot (:
Unfortunately, I cannot say that the fix solved the flickering. ):
I have not tried tty-clock
but I have tried clock-rs
version 0.1.201
and it still flickers on Windows:
I've tried these terminals in a fresh Windows 10 VM with the same 120 x 30 size, and they all flicker.
However, most surprisingly, the standard Windows Command Prompt is the most stable one! It only starts to flicker when the terminal is resized. Maybe this is a clue, or another bug (that buffer resizes are not handled)?
Alacritty is the second most stable, because it flickers more occasionally, whereas the other terminals flicker on each refresh. Also, in Alacritty, the cursor is visible.
I just created issue #3 for a different problem. I have tested both of these issues on a Windows 10 laptop and in a virtual Windows 10 running inside that laptop. The VM gives me more confidence in that it is not only my environment, but it would be helpful to have another Windows-user corroborate my findings. As of now, I couldn't say if it is related to Windows specifically or not. Currently, I'm not able to test on any other machine or OS (and won't be for some time).
@Reyhn3 I've published clock-rs v0.1.205
. Apart from multiple clean-ups and other small changes, I changed it to only clear the screen on terminal resize, pausing or restarting the stopwatch / timer, meaning your issue could be resolved. Could you upgrade clock-rs
using $ cargo install clock-rs --force
and see if the issue still persists? Thank you 😄
Running the basic command
clock-rs
will display the clock, but it flickers twice a second. If increasing the interval to e.g.the rendering will flicker ten times per second.
I've had the same issue in my own C#-applications, and that has been because I have tried filling the entire screen with characters. The solution (in Windows) is to use alternate screen buffer. This is using virtual terminal escape codes, so this solution should work here as well. I'm not an expert in this, but it might be a hint to where to start looking.
Details: OS: Windows 10 Terminal: Windows Terminal Console size: 120 x 31 clock-rs: Cloned 2024-08-06 rustc: 1.80.0 (051478957 2024-07-21)