rusync
rusync copied to clipboard
ConsoleProgressInfo sometimes writes too long strings
Steps to reproduce:
- create a file:
b'test/src/Chopin - Piano\xe3\x80\x80Concerto\xe3\x80\x80No.1.mp3 - try to rusync from
test/srctotest/destin a smallish window - your terminal gets flooded instead of the progress staying on one line
Found the bug: turns out the string contains a IDEOGRAPHIC SPACE character, so the terminal does what it is supposed to do.
This is hard to fix. We may try to guess what the terminal would do by checking for codepoints that represent wide spacing. An other solution would be to talk to the terminal directly to get the "physical" size of the line.
None of it looks easy :/
Or ... don't use \r and tell the cursor to go up one line?
Hint: https://docs.rs/wcwidth/1.0.1/wcwidth/