diff options
author | Lauris Kaplinski <lauris@src.gnome.org> | 2000-08-23 10:56:59 +0800 |
---|---|---|
committer | Lauris Kaplinski <lauris@src.gnome.org> | 2000-08-23 10:56:59 +0800 |
commit | b906c345f9c03db2c3786e6570d3728c12a00be9 (patch) | |
tree | 007fc5e5c368642a2aa711fae952186227ac07ad /widgets | |
parent | 049c61546b2ec5910b85f8dc059aba5f0b0fcada (diff) | |
download | gsoc2013-evolution-b906c345f9c03db2c3786e6570d3728c12a00be9.tar.gz gsoc2013-evolution-b906c345f9c03db2c3786e6570d3728c12a00be9.tar.zst gsoc2013-evolution-b906c345f9c03db2c3786e6570d3728c12a00be9.zip |
UTF-8 in contact editor + some fixes for dealing with illegal strings
svn path=/trunk/; revision=4976
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/e-text/e-text.c | 5 | ||||
-rw-r--r-- | widgets/text/e-text.c | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/widgets/e-text/e-text.c b/widgets/e-text/e-text.c index d30d1cb716..ea2a655932 100644 --- a/widgets/e-text/e-text.c +++ b/widgets/e-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; } 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; } |