cmus / cmus

Small, fast and powerful console music player for Unix-like operating systems.
https://cmus.github.io/
GNU General Public License v2.0
5.44k stars 467 forks source link

Rendering issues with emojis or "zalgo" text #997

Open bersLucas opened 3 years ago

bersLucas commented 3 years ago

1) uname -a:

Linux pop-os 5.4.0-7634-generic #38~1596560323~20.04~7719dbd-Ubuntu SMP Tue Aug 4 19:12:34 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

2) cmus --version:

cmus v2.8.0
Copyright 2004-2006 Timo Hirvonen
Copyright 2008-2016 Various Authors

3) cmus --plugins:

Input Plugins: /usr/lib/cmus/ip
  mad:
    Priority: 55
    File Types: mp3 mp2
    MIME Types: audio/mpeg audio/x-mp3 audio/x-mpeg
  cdio:
    Priority: 50
    File Types:
    MIME Types: x-content/audio-cdda
  opus:
    Priority: 50
    File Types: opus
    MIME Types:
  aac:
    Priority: 50
    File Types: aac
    MIME Types: audio/aac audio/aacp
  cue:
    Priority: 50
    File Types:
    MIME Types: application/x-cue
  vorbis:
    Priority: 50
    File Types: ogg oga ogx
    MIME Types: application/ogg audio/x-ogg
  flac:
    Priority: 50
    File Types: flac fla
    MIME Types:
  modplug:
    Priority: 50
    File Types: mod s3m xm it 669 amf ams dbm dmf dsm far mdl med mtm okt ptm stm ult umx mt2 psm
    MIME Types:
  wavpack:
    Priority: 50
    File Types: wv
    MIME Types: audio/x-wavpack
  mpc:
    Priority: 50
    File Types: mpc mpp mp+
    MIME Types: audio/x-musepack
  wav:
    Priority: 50
    File Types: wav
    MIME Types:
  ffmpeg:
    Priority: 30
    File Types: aa aac ac3 aif aifc aiff ape au fla flac m4a m4b mka mkv mp+ mp2 mp3 mp4 mpc mpp ogg shn tak tta wav webm wma wv
    MIME Types:

Output Plugins: /usr/lib/cmus/op
  pulse
  alsa
  jack
  ao

Given the following album: https://dismissyourself.bandcamp.com/album/000-deluxe-edition

The special charecters in the track and artist names causes some rendering issues when hovering over the artist name in the library view. I'm using Bash 5.0.17(1)-release on the Gnome terminal

cmus

jcpst commented 3 years ago

I'd like to report that I'm experiencing this same issue (rather than create a duplicate).

Without emoji

Screen Shot 2021-03-31 at 1 37 06 PM

With emoji

Screen Shot 2021-03-31 at 1 37 22 PM

1) uname -a:

Darwin KCMACLT1 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64

2) cmus --version:

cmus v2.9.1
Copyright 2004-2006 Timo Hirvonen
Copyright 2008-2016 Various Authors

3) cmus --plugins:

Input Plugins: /usr/local/Cellar/cmus/2.9.1/lib/cmus/ip
  mad:
    Priority: 55
    File Types: mp3 mp2
    MIME Types: audio/mpeg audio/x-mp3 audio/x-mpeg
  opus:
    Priority: 50
    File Types: opus
    MIME Types:
  wav:
    Priority: 50
    File Types: wav
    MIME Types:
  mp4:
    Priority: 50
    File Types: mp4 m4a m4b
    MIME Types:
  cue:
    Priority: 50
    File Types:
    MIME Types: application/x-cue
  aac:
    Priority: 50
    File Types: aac
    MIME Types: audio/aac audio/aacp
  flac:
    Priority: 50
    File Types: flac fla
    MIME Types:
  vorbis:
    Priority: 50
    File Types: ogg oga ogx
    MIME Types: application/ogg audio/x-ogg
  ffmpeg:
    Priority: 30
    File Types: aa aac ac3 aif aifc aiff ape au fla flac m4a m4b mka mkv mp+ mp2 mp3 mp4 mpc mpp ogg opus shn tak tta wav webm wma wv
    MIME Types:

Output Plugins: /usr/local/Cellar/cmus/2.9.1/lib/cmus/op
  coreaudio
nefthy commented 3 years ago

could you post the output of id3info your.mp3 for the mp3 with the smiley?

jcpst commented 3 years ago
*** Tag information for JPEGMAFIA - Veteran - 11 😱.m4a
nefthy commented 3 years ago

I think the problem here is that the smiley takes up two characters instead of one, which probably has to do with the font used. I'm not sure cmus can do much about that.

@pgaskin any ideas?

nefthy commented 3 years ago
*** Tag information for JPEGMAFIA - Veteran - 11 😱.m4a

id3info does not work for m4a files. exiftool -a file.m4a might do the trick.

pgaskin commented 3 years ago

I've seen this too, and I suspect it's something to do with the individual character width vs the combined character width, or that it's due to character width differences between Unicode versions (but I'd have to do some research about this, since I'm not completely familiar with it). It's also possible it's a terminal emulator or font issue, but that's less likely since this has happened on every one I use regularly. I'll have to play around with it a bit and do some research when I have time (I might spend a few minutes soon, but I won't be able to do anything major until I have more time).

jcpst commented 3 years ago

Thanks for the discussion and following up so far. Been a fan of this player for years 😃. Here's the result of running exiftool.

❯ exiftool -a JPEGMAFIA\ -\ Veteran\ -\ 11\ 😱.m4a
ExifTool Version Number         : 12.16
File Name                       : JPEGMAFIA - Veteran - 11 😱.m4a
Directory                       : .
File Size                       : 3.2 MiB
File Modification Date/Time     : 2021:04:01 13:37:37-05:00
File Access Date/Time           : 2021:04:01 13:37:37-05:00
File Inode Change Date/Time     : 2021:04:01 13:37:37-05:00
File Permissions                : rw-------
File Type                       : MP3
File Type Extension             : mp3
MIME Type                       : audio/mpeg
ID3 Size                        : 128
Title                           : 
Artist                          : 
Album                           : 
Year                            : 
Comment                         : 
Genre                           : None
pgaskin commented 3 years ago

I believe this is probably an issue with cmus' calculations (and partly caused by terminal emulators), but I'll need to do some testing to be sure.

Some helpful things I found:

nick87720z commented 2 years ago

Not sure, is it better to create new bug, as I got problem trying to use emojis in status, also experiencing problems with width. For now I tried two chars:

gavtroy commented 2 years ago

The problem is basically that the code has an extremely simplistic and limited awareness of unicode and which characters are wide or narrow. If we want to properly support everything we should find a library.

In the meantime I propose some simple changes in #1151 that mask the issue for the most part. To be clear, it won't fix every character.

gavtroy commented 2 years ago

For testing and reference, attaching a metadata-only version of the T€∆M M£K4NØ album demoed in the first post; emoji_zalgo_test_album.tar.gz

gavtroy commented 2 years ago

The latest proposed fix for this issue is #1198.

rfc-2549 commented 2 months ago

Have this issue in 2.10.0 image

rfc-2549 commented 2 months ago

Fixed by using latest commit. image