summaryrefslogtreecommitdiff
path: root/spotify-widget/spotify.lua
diff options
context:
space:
mode:
authorCliford <clifordjo@gmail.com>2021-10-08 19:51:35 +0530
committerCliford <clifordjo@gmail.com>2021-10-08 19:51:35 +0530
commit773b371cb4084720f3e729c2b4fc6a95a5547c09 (patch)
tree79dfbe78ebce88f7a991c1b070e95283c84665a7 /spotify-widget/spotify.lua
parent8c5a58c93c0549c26f76cb199cd307f8ef7026bd (diff)
fixed unicode truncation bug
Diffstat (limited to 'spotify-widget/spotify.lua')
-rw-r--r--spotify-widget/spotify.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/spotify-widget/spotify.lua b/spotify-widget/spotify.lua
index bd2309f..0eb302a 100644
--- a/spotify-widget/spotify.lua
+++ b/spotify-widget/spotify.lua
@@ -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