aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorMike Kestner <mkestner@ximian.com>2003-04-23 02:54:55 +0800
committerMike Kestner <mkestner@src.gnome.org>2003-04-23 02:54:55 +0800
commit1f8aee1ac65ffd2d4ac09c58072a74ed7718ee1b (patch)
tree9ad5eed9c61c6c865e913fbb0d9cf561ce9c92f0 /widgets
parent42a22586d2dc98cbae74db6a1281ff862167f930 (diff)
downloadgsoc2013-evolution-1f8aee1ac65ffd2d4ac09c58072a74ed7718ee1b.tar.gz
gsoc2013-evolution-1f8aee1ac65ffd2d4ac09c58072a74ed7718ee1b.tar.zst
gsoc2013-evolution-1f8aee1ac65ffd2d4ac09c58072a74ed7718ee1b.zip
use unicode ellipsis char for breaking lines. Use g_utf8_find_prev_char
2003-04-21 Mike Kestner <mkestner@ximian.com> * e-cell-text.c (build_layout): use unicode ellipsis char for breaking lines. Use g_utf8_find_prev_char and check for failure so that we don't tight loop for small cells that can't display any chars. svn path=/trunk/; revision=20924
Diffstat (limited to 'widgets')
-rw-r--r--widgets/table/e-cell-text.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c
index 4295862c32..8bfcf384d0 100644
--- a/widgets/table/e-cell-text.c
+++ b/widgets/table/e-cell-text.c
@@ -486,18 +486,23 @@ build_layout (ECellTextView *text_view, int row, const char *text, gint width)
pango_layout_set_width (layout, width * PANGO_SCALE);
pango_layout_set_wrap (layout, PANGO_WRAP_CHAR);
- while (pango_layout_get_line_count (layout) > 1) {
+ if (pango_layout_get_line_count (layout) > 1) {
PangoLayoutLine *line = pango_layout_get_line (layout, 0);
gchar *line_text = g_strdup (pango_layout_get_text (layout));
- gchar *last_char = g_utf8_prev_char (line_text + line->length - 1);
- gchar *new_text;
- while (*last_char == '.')
- last_char = g_utf8_prev_char (last_char);
- *last_char = '\0';
- new_text = g_strconcat (line_text, " ...", NULL);
- pango_layout_set_text (layout, new_text, g_utf8_strlen (new_text, -1));
+ gchar *last_char = g_utf8_find_prev_char (line_text, line_text + line->length - 1);
+ gchar ellipsis[7];
+ int len = g_unichar_to_utf8 (8230, ellipsis);
+ ellipsis[len] = '\0';
+ while (last_char && pango_layout_get_line_count (layout) > 1) {
+ gchar *new_text;
+ last_char = g_utf8_find_prev_char (line_text, last_char);
+ if (last_char)
+ *last_char = '\0';
+ new_text = g_strconcat (line_text, ellipsis, NULL);
+ pango_layout_set_text (layout, new_text, -1);
+ g_free (new_text);
+ }
g_free (line_text);
- g_free (new_text);
}
switch (ect->justify) {