[meld/meld-3-20] ui.msgarea: Allow Infobar text to wrap at character boundaries (#432)



commit e7e8e1f1e52c194c63c8c6bb69b0dc39bc515fad
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Feb 23 10:18:02 2020 +1000

    ui.msgarea: Allow Infobar text to wrap at character boundaries (#432)
    
    While this could happen for any sufficiently long path name, this is
    mostly an issue for file paths on Windows, because Pango doesn't
    consider `\` to be a word break.

 meld/ui/msgarea.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/meld/ui/msgarea.py b/meld/ui/msgarea.py
index 909b178e..5b482c5a 100644
--- a/meld/ui/msgarea.py
+++ b/meld/ui/msgarea.py
@@ -19,7 +19,7 @@
 # newer GTK+.
 # Copyright (C) 2013 Kai Willadsen <kai willadsen gmail com>
 
-from gi.repository import Gtk
+from gi.repository import Gtk, Pango
 
 from meld.conf import _
 
@@ -33,6 +33,7 @@ def layout_text_and_icon(stockid, primary_text, secondary_text=None):
     primary_label = Gtk.Label(
         label="<b>{}</b>".format(primary_text),
         wrap=True,
+        wrap_mode=Pango.WrapMode.WORD_CHAR,
         use_markup=True,
         xalign=0,
         can_focus=True,
@@ -44,6 +45,7 @@ def layout_text_and_icon(stockid, primary_text, secondary_text=None):
         secondary_label = Gtk.Label(
             "<small>{}</small>".format(secondary_text),
             wrap=True,
+            wrap_mode=Pango.WrapMode.WORD_CHAR,
             use_markup=True,
             xalign=0,
             can_focus=True,


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