From 36128dc16f0c2f40c98836cd56343d6803d4f040 Mon Sep 17 00:00:00 2001 From: Harald Geyer Date: Tue, 1 Dec 2015 18:07:41 +0100 Subject: [PATCH 1/2] string widget: Allow multibyte characters Currently render_string() truncates the text after n bytes, where n is the number of characters from the start of the rendering position to the right margin. Since the API already requires drivers to take care of proper truncating, this is not necessary. Signed-off-by: Harald Geyer --- server/render.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/server/render.c b/server/render.c index 78119b4..92b5326 100644 --- a/server/render.c +++ b/server/render.c @@ -310,9 +310,6 @@ render_string(Widget *w, int left, int top, int right, int bottom, int fy) if ((w != NULL) && (w->text != NULL) && (w->x > 0) && (w->y > 0) && (w->y > fy) && (w->y <= bottom - top)) { - int length; - char str[BUFSIZE]; - /* * FIXME: Could be a bug here? w->x is recalculated (On first * call only? Is it preserved between calls?) and first @@ -320,10 +317,7 @@ render_string(Widget *w, int left, int top, int right, int bottom, int fy) * strings totally off-screen. Is this on purpose? (M. Dolze) */ w->x = min(w->x, right - left); - length = min(right - left - w->x + 1, sizeof(str)-1); - strncpy(str, w->text, length); - str[length] = '\0'; - drivers_string(w->x + left, w->y + top, str); + drivers_string(w->x + left, w->y + top, w->text); } return 0; } From 21cdb4c3eabfcf21c8b75cdd4f16df2f865fbacf Mon Sep 17 00:00:00 2001 From: Harald Geyer Date: Wed, 3 Aug 2016 14:08:32 +0200 Subject: [PATCH 2/2] Update change log Signed-off-by: Harald Geyer --- ChangeLog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog.md b/ChangeLog.md index 69309f4..e9a092c 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -7,6 +7,7 @@ v0.5dev (ongoing development) - [fixed] Cleanup I2C handling (https://github.com/lcdproc/lcdproc/pull/8) - [fixed] Add more patterns to .gitignore (https://github.com/lcdproc/lcdproc/pull/9) - [added] New driver for Olimex MOD-LCD1x9 + - [fixed] Allow multibyte characters (from string widget) v0.5.7 - [fixed] Fix using the left key to change the ring and checkbox menu items