Use spaces to compute indentation
parent
17966b9fe2
commit
2ddeaf535d
|
@ -3269,9 +3269,8 @@ update_tab_width (MooTextView *view)
|
||||||
{
|
{
|
||||||
PangoTabArray *tabs;
|
PangoTabArray *tabs;
|
||||||
PangoLayout *layout;
|
PangoLayout *layout;
|
||||||
guint tab_width;
|
int tab_width;
|
||||||
int layout_width;
|
char *string;
|
||||||
const char *string = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
|
|
||||||
|
|
||||||
if (!GTK_WIDGET_REALIZED (view))
|
if (!GTK_WIDGET_REALIZED (view))
|
||||||
return;
|
return;
|
||||||
|
@ -3279,9 +3278,9 @@ update_tab_width (MooTextView *view)
|
||||||
g_return_if_fail (view->priv->tab_width > 0);
|
g_return_if_fail (view->priv->tab_width > 0);
|
||||||
g_return_if_fail (GTK_WIDGET (view)->style != NULL);
|
g_return_if_fail (GTK_WIDGET (view)->style != NULL);
|
||||||
|
|
||||||
|
string = g_strnfill (view->priv->tab_width, ' ');
|
||||||
layout = gtk_widget_create_pango_layout (GTK_WIDGET (view), string);
|
layout = gtk_widget_create_pango_layout (GTK_WIDGET (view), string);
|
||||||
pango_layout_get_size (layout, &layout_width, NULL);
|
pango_layout_get_size (layout, &tab_width, NULL);
|
||||||
tab_width = (layout_width * view->priv->tab_width) / strlen (string);
|
|
||||||
|
|
||||||
tabs = pango_tab_array_new (2, FALSE);
|
tabs = pango_tab_array_new (2, FALSE);
|
||||||
pango_tab_array_set_tab (tabs, 0, PANGO_TAB_LEFT, 0);
|
pango_tab_array_set_tab (tabs, 0, PANGO_TAB_LEFT, 0);
|
||||||
|
@ -3291,6 +3290,7 @@ update_tab_width (MooTextView *view)
|
||||||
|
|
||||||
pango_tab_array_free (tabs);
|
pango_tab_array_free (tabs);
|
||||||
g_object_unref (layout);
|
g_object_unref (layout);
|
||||||
|
g_free (string);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue