From b16309d6ab170ddc182ff7fdbf708b3aedc96aba Mon Sep 17 00:00:00 2001 From: raveit65 Date: Sat, 21 Dec 2019 14:52:34 +0100 Subject: editable-label: Don't hyphenate filenames more fixes for https://github.com/mate-desktop/caja/issues/1284 Pango 1.44 got the ability to automatically hyphenate on line breaks, which is on by default, but can be set off by a new attribute. As a result, we now hyphenate filenames, which is confusing, because a filename may already include hyphens. To restore the previous behavior, let's not insert hyphens when breaking filenames in multiple lines. Inspired by https://gitlab.gnome.org/GNOME/nautilus/commit/9738d85 --- eel/eel-editable-label.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'eel/eel-editable-label.c') diff --git a/eel/eel-editable-label.c b/eel/eel-editable-label.c index 0b2cef59..6683b476 100644 --- a/eel/eel-editable-label.c +++ b/eel/eel-editable-label.c @@ -41,6 +41,14 @@ #include #include +#ifndef PANGO_CHECK_VERSION +#define PANGO_CHECK_VERSION(major, minor, micro) \ + (PANGO_VERSION_MAJOR > (major) || \ + (PANGO_VERSION_MAJOR == (major) && PANGO_VERSION_MINOR > (minor)) || \ + (PANGO_VERSION_MAJOR == (major) && PANGO_VERSION_MINOR == (minor) && \ + PANGO_VERSION_MICRO >= (micro))) +#endif + enum { @@ -1005,6 +1013,9 @@ eel_editable_label_ensure_layout (EelEditableLabel *label, if (label->font_desc != NULL) pango_layout_set_font_description (label->layout, label->font_desc); + #if PANGO_CHECK_VERSION (1, 44, 0) + pango_attr_list_insert (tmp_attrs, pango_attr_insert_hyphens_new (FALSE)); + #endif pango_layout_set_attributes (label->layout, tmp_attrs); if (preedit_string) -- cgit v1.2.1