mirror of
https://github.com/streetturtle/awesome-wm-widgets.git
synced 2024-11-15 19:48:04 +01:00
fixed unicode truncation bug
This commit is contained in:
parent
8c5a58c93c
commit
773b371cb4
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 function ellipsize(text, length)
|
||||
return (text:len() > length and length > 0)
|
||||
and text:sub(0, length - 3) .. '...'
|
||||
return (utf8.len(text) > length and length > 0)
|
||||
and text:sub(0, utf8.offset(text, length - 2) - 1) .. '...'
|
||||
or text
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue