mirror of
https://github.com/streetturtle/awesome-wm-widgets.git
synced 2024-11-15 19:48:04 +01:00
Merge pull request #302 from clifordjoshy/master
Fixes issue while printing song names containing certain unicode characters.
This commit is contained in:
commit
173ef2fab3
1 changed files with 2 additions and 2 deletions
|
@ -16,8 +16,8 @@ local GET_SPOTIFY_STATUS_CMD = 'sp status'
|
||||||
local GET_CURRENT_SONG_CMD = 'sp current'
|
local GET_CURRENT_SONG_CMD = 'sp current'
|
||||||
|
|
||||||
local function ellipsize(text, length)
|
local function ellipsize(text, length)
|
||||||
return (text:len() > length and length > 0)
|
return (utf8.len(text) > length and length > 0)
|
||||||
and text:sub(0, length - 3) .. '...'
|
and text:sub(0, utf8.offset(text, length - 2) - 1) .. '...'
|
||||||
or text
|
or text
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue