From b906c345f9c03db2c3786e6570d3728c12a00be9 Mon Sep 17 00:00:00 2001 From: Lauris Kaplinski Date: Wed, 23 Aug 2000 02:56:59 +0000 Subject: UTF-8 in contact editor + some fixes for dealing with illegal strings svn path=/trunk/; revision=4976 --- widgets/text/e-text.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'widgets/text') diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c index d30d1cb716..ea2a655932 100644 --- a/widgets/text/e-text.c +++ b/widgets/text/e-text.c @@ -2224,7 +2224,7 @@ _get_position_from_xy (EText *text, gint x, gint y) x += text->xofs_edit; xpos = get_line_xpos_item_relative (text, lines); - for (i = 0, p = lines->text; i < lines->length; i++, p = unicode_get_utf8 (p, &unival)) { + for (i = 0, p = lines->text; p && i < lines->length; i++, p = unicode_get_utf8 (p, &unival)) { int charwidth; charwidth = e_font_utf8_char_width (text->font, E_FONT_PLAIN, p); @@ -2235,6 +2235,9 @@ _get_position_from_xy (EText *text, gint x, gint y) } xpos += (charwidth + 1) / 2; } + + if (!p) return 0; + return p - text->text; } -- cgit