aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'widgets')
-rw-r--r--widgets/ChangeLog4
-rw-r--r--widgets/e-text/e-text.c10
-rw-r--r--widgets/text/e-text.c10
3 files changed, 14 insertions, 10 deletions
diff --git a/widgets/ChangeLog b/widgets/ChangeLog
index 09425c22f6..00226f5cb0 100644
--- a/widgets/ChangeLog
+++ b/widgets/ChangeLog
@@ -1,3 +1,7 @@
+2000-09-08 Lauris Kaplinski <lauris@helixcode.com>
+
+ * e-text/e-text.c (calc_line_widths): Fix byte/char confusion
+
2000-08-30 Federico Mena Quintero <federico@helixcode.com>
* e-paned/e-hpaned.c (e_hpaned_motion): Do not flicker while
diff --git a/widgets/e-text/e-text.c b/widgets/e-text/e-text.c
index ed87f21c95..cb064c9c40 100644
--- a/widgets/e-text/e-text.c
+++ b/widgets/e-text/e-text.c
@@ -683,8 +683,8 @@ calc_line_widths (EText *text)
{
struct line *lines;
int i;
- int j;
gdouble clip_width;
+ gchar *p;
/* Make sure line has been split */
if (text->text && text->num_lines == 0)
@@ -721,10 +721,10 @@ calc_line_widths (EText *text)
clip_width >= 0) {
if (text->font) {
lines->ellipsis_length = 0;
- for (j = 0; j < lines->length; j++ ) {
- if (e_font_utf8_text_width (text->font, E_FONT_PLAIN, lines->text, j) + text->ellipsis_width
- <= clip_width)
- lines->ellipsis_length = j;
+ for (p = lines->text; p && *p && (p - lines->text) < lines->length; p = unicode_next_utf8 (p)) {
+ if (e_font_utf8_text_width (text->font, E_FONT_PLAIN, lines->text, p - lines->text) +
+ text->ellipsis_width <= clip_width)
+ lines->ellipsis_length = p - lines->text;
else
break;
}
diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c
index ed87f21c95..cb064c9c40 100644
--- a/widgets/text/e-text.c
+++ b/widgets/text/e-text.c
@@ -683,8 +683,8 @@ calc_line_widths (EText *text)
{
struct line *lines;
int i;
- int j;
gdouble clip_width;
+ gchar *p;
/* Make sure line has been split */
if (text->text && text->num_lines == 0)
@@ -721,10 +721,10 @@ calc_line_widths (EText *text)
clip_width >= 0) {
if (text->font) {
lines->ellipsis_length = 0;
- for (j = 0; j < lines->length; j++ ) {
- if (e_font_utf8_text_width (text->font, E_FONT_PLAIN, lines->text, j) + text->ellipsis_width
- <= clip_width)
- lines->ellipsis_length = j;
+ for (p = lines->text; p && *p && (p - lines->text) < lines->length; p = unicode_next_utf8 (p)) {
+ if (e_font_utf8_text_width (text->font, E_FONT_PLAIN, lines->text, p - lines->text) +
+ text->ellipsis_width <= clip_width)
+ lines->ellipsis_length = p - lines->text;
else
break;
}