From 69127b30999b223773f29458ecf2e12239eca95e Mon Sep 17 00:00:00 2001 From: Jonathan Krebs Date: Fri, 14 Jun 2019 15:24:13 +0200 Subject: treat output as utf8 when limiting width. fixes #374 --- command/command.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'command') diff --git a/command/command.c b/command/command.c index f62f2325..fe791f4c 100644 --- a/command/command.c +++ b/command/command.c @@ -23,9 +23,9 @@ */ #include -#include #include +#include #include #include #include @@ -348,9 +348,9 @@ process_command_output (CommandApplet *command_applet, gchar *output) g_strstrip (output); /* check output length */ - if (strlen (output) > command_applet->width) + if (g_utf8_strlen (output, strlen(output)) > command_applet->width) { - output[command_applet->width] = '\0'; + *g_utf8_offset_to_pointer(output, command_applet->width) = '\0'; } gtk_label_set_text (command_applet->label, output); -- cgit v1.2.1