rusync icon indicating copy to clipboard operation
rusync copied to clipboard

ConsoleProgressInfo sometimes writes too long strings

Open dmerejkowsky opened this issue 6 years ago • 4 comments

Steps to reproduce:

  • create a file: b'test/src/Chopin - Piano\xe3\x80\x80Concerto\xe3\x80\x80No.1.mp3
  • try to rusync from test/src to test/dest in a smallish window
  • your terminal gets flooded instead of the progress staying on one line

dmerejkowsky avatar May 08 '19 13:05 dmerejkowsky

Found the bug: turns out the string contains a IDEOGRAPHIC SPACE character, so the terminal does what it is supposed to do.

dmerejkowsky avatar May 10 '19 15:05 dmerejkowsky

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 :/

dmerejkowsky avatar May 11 '19 11:05 dmerejkowsky

Or ... don't use \r and tell the cursor to go up one line?

dmerejkowsky avatar May 11 '19 11:05 dmerejkowsky

Hint: https://docs.rs/wcwidth/1.0.1/wcwidth/

dmerejkowsky avatar May 27 '19 15:05 dmerejkowsky