Skip to content

Commit a3e178c

Browse files
committed
Do not insert hyphens at intra-word line breaks (Bug #15856)
1 parent 2731686 commit a3e178c

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

thunar/thunar-pango-extensions.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,31 @@ thunar_pango_attr_list_bold (void)
118118

119119

120120

121+
/**
122+
* thunar_pango_attr_disable_hyphens:
123+
*
124+
* Returns a #PangoAttrList for not inserting hyphens at intra-word line breaks.
125+
* The returned list is owned by the callee and must
126+
* not be freed or modified by the caller.
127+
*
128+
* Return value: a #PangoAttrList for not inserting hyphens at intra-word line
129+
* breaks.
130+
**/
131+
PangoAttrList*
132+
thunar_pango_attr_disable_hyphens (void)
133+
{
134+
static PangoAttrList *attr_list = NULL;
135+
136+
#ifdef PANGO_VERSION_1_44
137+
if (G_UNLIKELY (attr_list == NULL))
138+
attr_list = thunar_pango_attr_list_wrap (pango_attr_insert_hyphens_new (FALSE), NULL);
139+
#endif
140+
141+
return attr_list;
142+
}
143+
144+
145+
121146
/**
122147
* thunar_pango_attr_list_italic:
123148
*

thunar/thunar-pango-extensions.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ G_BEGIN_DECLS;
2727
PangoAttrList *thunar_pango_attr_list_big (void) G_GNUC_CONST;
2828
PangoAttrList *thunar_pango_attr_list_big_bold (void) G_GNUC_CONST;
2929
PangoAttrList *thunar_pango_attr_list_bold (void) G_GNUC_CONST;
30+
PangoAttrList *thunar_pango_attr_disable_hyphens (void) G_GNUC_CONST;
3031
PangoAttrList *thunar_pango_attr_list_italic (void) G_GNUC_CONST;
3132
PangoAttrList *thunar_pango_attr_list_small_italic (void) G_GNUC_CONST;
3233
PangoAttrList *thunar_pango_attr_list_small (void) G_GNUC_CONST;

thunar/thunar-standard-view.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#include <thunar/thunar-icon-renderer.h>
4545
#include <thunar/thunar-marshal.h>
4646
#include <thunar/thunar-menu-util.h>
47+
#include <thunar/thunar-pango-extensions.h>
4748
#include <thunar/thunar-private.h>
4849
#include <thunar/thunar-properties-dialog.h>
4950
#include <thunar/thunar-renamer-dialog.h>
@@ -729,6 +730,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
729730

730731
/* setup the name renderer */
731732
standard_view->name_renderer = g_object_new (GTK_TYPE_CELL_RENDERER_TEXT,
733+
"attributes", thunar_pango_attr_disable_hyphens (),
732734
"alignment", PANGO_ALIGN_CENTER,
733735
"xalign", 0.5,
734736
FALSE);

0 commit comments

Comments
 (0)