Minor bug in labels + fix



Hi,

Small bug in labels with multiple lines - the newline character is included
when calculating string widths, so justification doesn't work correctly.


A little patch is included (2 lines changed).


Damon



--- gtklabel.c.orig Sun Apr  5 13:51:10 1998
+++ gtklabel.c Sun Apr  5 13:57:25 1998
@@ -258,7 +258,7 @@
       if (row->next)
      width = MAX (width,
                        gdk_text_width (GTK_WIDGET (label)->style->font,
row->data,
-                                       (gchar*) row->next->data - (gchar*)
row->data));
+                                       (gchar*) row->next->data - (gchar*)
row->data - 1));
       else
         width = MAX (width, gdk_string_width (GTK_WIDGET
(label)->style->font, row->data));
       row = row->next;
@@ -315,7 +315,7 @@
       row = label->row;
       while (row && row->next)
  {
-   len = (gchar*) row->next->data - (gchar*) row->data;
+   len = (gchar*) row->next->data - (gchar*) row->data - 1;
    offset = 0;

    if (label->jtype == GTK_JUSTIFY_CENTER)







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]