Unability to show songs with Unicode characters in the playlist
Altai-man opened this issue · comments
It seems mingus has trouble with unicode characters. I use UTF-8 as default encoding everywhere and mingus work perfectly until there are some Japanese characters in a song name. I can add such a song in the playlist and play it(by switching to playlist buffer and hitting enter), but playlist buffer goes blank(i.e. all text from buffer is erased).
In messages I found this: mingus-format-song-in-columns: Args out of range: 203, 269
.
My mpd version is 0.19.10
, emacs is 24.5(on gentoo, so I assume some flags maybe can do the trick), mingus is latest from melpa, i.e. 20160301.430
.
I can provide any logs/info you might need, but patching elisp is still hard.
I will look into this. Shouldn't be too hard to fix I guess. Something with multibyte characters probably. I am occupied this weekend, so at least not before tomorrow night.
btw if you have a sample song this would simplify fixing for me
I'm not in a hurry, so it's completely okay to wait. Anyway, your work is really great and I appreciate it.
You can download reproducible track, for example, from here. It's free and legal. The last track of album(終わりのない苦しみ
) will break playlist for me.
Commit b109a8e fixes the args out of range error by fontifying the substrings before concatenation.
Stuff with CJK scripts don't align properly in columns though; that may need some more work.
Just installed new version and it works, thank you. Don't know is it useful: not only columns don't aligned properly, but also you can't move in the buffer properly(as example: move to the end of the buffer with C-e and then try to go backward with C-b pressed - after some point cursor will be sended back to the end of line). Don't know is it a bug or feature, though.
I did some further research and the misalignment has to do with the Japanese font not being strictly monospace (or doublespace for that matter).
That does make mingus-format-song-in-columns
look disbehaved. I just tried it with Emacs in a terminal emulator and there the columns do align perfectly.
I have not been able to find a purely mono/double-spaced font and get it working in 'graphical' Emacs.
Note that if you prefer a non-column layout mingus-format-song-function
can be customized.
As to cursor jumping: do you use this gist?
If you did, that could be the (indirect) cause of it since redrawing indeed jumps the cursor (something that may need fixing but is another issue).
I just updated the gist so it does not redraw if the width of a window did not actually change.
Since the original bug is fixed I am closing this issue.
I've used new version of the gist and it helped. Also, I think for me it doesn't matter if columns aligned properly, since alignment works good enough with "normal" tracks. And unicode tracks are visible(and manageable) at least. Issue for sure can be closed.
Thanks for your efforts and quick fixing.