yaspin icon indicating copy to clipboard operation
yaspin copied to clipboard

Long messages or messages with new line char print on every line for each frame

Open cchaffatt opened this issue 3 years ago • 2 comments

Thanks for this fun lib. I noticed messages will be repeated if any of the below triggers are encountered.

[notes] version = 1.5.0 machine = mac (catalina)

[triggers]

  • very long message (longer than buffer width ie resized window)
  • messages with '\n' (new line character)

[screenshot] Screen Shot 2021-05-11 at 6 42 14 PM

cchaffatt avatar May 11 '21 22:05 cchaffatt

Hi @cchaffatt

The behavior triggered by \n symbol is kind of expected. Yaspin tries to avoid interfering with user input, otherwise handling all possible terminal escape sequences would make code much more complicated. It is expected that yaspin receives sanitized text.

The case with long messages is interesting, I'll investigate that.

Thanks for reporting this!

pavdmyt avatar May 16 '21 16:05 pavdmyt

I have the same issue! Especially when I'm getting eager and drop a lot of status info in sp.text I pretty much get the picture above. What we could do here is figure out what the current terminal width is and then either crop or marquee the current text status. One option that would apparently also be more or less platform independent would be shutil.get_terminal_size(). Cropping terminal output would increase the user experience already, but having the text as a marquee banner would be really nice, as everything would be visible then.

sebageek avatar Jun 08 '21 23:06 sebageek