Apple-Music-CLI-Player
Apple-Music-CLI-Player copied to clipboard
Fix for flickering output in np widget
By issuing the 'clear' command, depending on the terminal implementation, the screen can flicker if the terminal takes some time to draw the next characters.
The correct fix is not to clear the screen, but instead to manipulate the cursor to place it at the top, then simply re-draw. This avoids any flickering in the output.
This fix should address that for the terminal player.
Thanks again for making such a great, simple tool. It was easy to make this change.
Looks like this runs into some edge cases where song names change. Marking this as a draft for now.
Currently, similar to the concept of double buffering, I have clear called immediately before drawing (as part of the buffer to be drawn, and also in the case of text mode just before outputting the playback information).
So I think you'd want that escape sequence in the $art buffer, in place of clear. Currently in this diff it is just called for the case of the -t text mode flag. I don't know what effect this will have, but please feel free to update the pr if you see the issue resolve in terminal emulators with that change, I'd be thrilled to merge it in. But I haven't messed with that escape sequence myself.