summaryrefslogtreecommitdiff
path: root/spotify-widget
diff options
context:
space:
mode:
authorstreetturtle <streetturtle@users.noreply.github.com>2021-10-14 16:02:52 -0400
committerGitHub <noreply@github.com>2021-10-14 16:02:52 -0400
commit173ef2fab3997fabbc3b93a7df6798a9bd4c6f25 (patch)
tree0ce7cb945d80c84b94a12b4bff58c2a0ddb862ec /spotify-widget
parent63f33ff9ed00be3e36356f2cc85dd8fdfe8e4d22 (diff)
parent773b371cb4084720f3e729c2b4fc6a95a5547c09 (diff)
Merge pull request #302 from clifordjoshy/master
Fixes issue while printing song names containing certain unicode characters.
Diffstat (limited to 'spotify-widget')
-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