jacquesh / foo_openlyrics

An open-source lyric display panel for foobar2000
MIT License
429 stars 24 forks source link

Don't erase carriage returns #145

Closed brucemblue closed 2 years ago

brucemblue commented 2 years ago

Carriage returns are different characters from newlines. They are still associated with the previous line. They are useful for adding extra information to the previous line. In my case, I'd like to use them for translated lyrics.

For example, if a song is in Spanish and I want to see the English translation, the lyrics might look something like this: [03:42.61]Ja Ja Ja! (Ha Ha Ha!)

The current behavior of the plugin is that it will completely erase anything after the carriage return (regardless of whether it's a newline or carriage return). The line becomes: [03:42.61]Ja Ja Ja!

The request is for the plugin to treat the carriage return as part of the previous line, similar to a space or other characters. Except, of course, starting on a new line.

edit: I see in parsers.h that duplicate timestamps are allowed. I have tested this with some lyrics, and this is a good workaround for now.

jacquesh commented 2 years ago

Carriage return represents a reset of the text position to the beginning of the line without advancing to the next line. So "abcd\ref\nghi" would produce "efcd\nghi".

It may be that openlyrics is not handling CR correctly and the behaviour should be different, but it will not be what you describe.

I recommend using duplicate timestamps, as you have discovered.

Also, how would you even enter just a CR without either a hex editor or some niche text editor feature? Admittedly I've not had any need to, but I don't know of a way to do this with a widely-used text editor. Is there some other existing lyric source that is producing this?