I have created the matrix style terminal as a small project. Every time the screen is resized, some of the characters from the previous buffer leak out of the terminal window and just float outside of it until the window is moved, resized or quit.
Below is the link to the GitHub repository to the project, only main.cpp is full of the code, rest are files created by visual studio.
https://github.com/EliteGamerSiddhu/Matrix-terminal
Whenever I am trying to take a screenshot, the issue disappears. I think it has something to do with how the background of windows is refreshing.
Should I be worried of this issue ? Or is it just something ignore able for a small project ?
I certainly wouldn't say that what you're seeing is totally out of the ordinary. When you're resizing the console buffer, depending on the exact content currently on the screen, the console's going to have to scroll some of that up into the history/scrollback. It does this to try and prevent any useful information being lost on a resize.
However, might I recommend that if you're making a "full screen" console application, use the
\x1b[?1049hescape sequence to enable the "alternate screen buffer", at the start of your app's launch?This is the mode that apps like
vim,emacs,tmux, etc use, so that they can fully draw to the whole console viewport, then clear the whole thing neatly when the app exits. (You'll want to usex\1b[?1049lto exit the alt buffer).(you may need to first enable
ENABLE_VIRTUAL_TERMINAL_PROCESSINGwithSetConsoleMode)More reading: Alternate Screen Buffer