summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Krebs <[email protected]>2019-06-14 15:24:13 +0200
committerraveit65 <[email protected]>2019-07-11 09:06:31 +0200
commit69127b30999b223773f29458ecf2e12239eca95e (patch)
treeeb5c5a87216415369bff665db6b647c84b5bb7af
parentda78059c5598bdf66828edd1081d3c1ca0f4805b (diff)
downloadmate-applets-69127b30999b223773f29458ecf2e12239eca95e.tar.bz2
mate-applets-69127b30999b223773f29458ecf2e12239eca95e.tar.xz
treat output as utf8 when limiting width.
fixes #374
-rw-r--r--command/command.c6
1 files changed, 3 insertions, 3 deletions
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 <config.h>
-#include <string.h>
#include <glib.h>
+#include <gmodule.h>
#include <glib/gi18n.h>
#include <gio/gio.h>
#include <gtk/gtk.h>
@@ -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);