[nautilus/gnome-3-20] canvas-item: Don't wrap after . immediately followed by numbers



commit a08702c22936937d2712803d91236de80159ddf0
Author: Jeremy Bicha <jbicha ubuntu com>
Date:   Thu May 4 04:50:17 2017 -0400

    canvas-item: Don't wrap after . immediately followed by numbers
    
    Nautilus allowed line wrapping for filenames after a . or _
    The code made an exception for version numbers, but it
    was too rigid and broke things like Ubuntu's 12.04 version
    numbering. This relaxes the exception so that the line isn't
    wrapped for a . or _ immediately followed by any numbers.
    
    https://launchpad.net/bugs/942539
    
    https://bugzilla.gnome.org/show_bug.cgi?id=781875

 libnautilus-private/nautilus-canvas-item.c |   11 ++---------
 1 files changed, 2 insertions(+), 9 deletions(-)
---
diff --git a/libnautilus-private/nautilus-canvas-item.c b/libnautilus-private/nautilus-canvas-item.c
index 6eebea1..d1227c8 100644
--- a/libnautilus-private/nautilus-canvas-item.c
+++ b/libnautilus-private/nautilus-canvas-item.c
@@ -1324,11 +1324,6 @@ nautilus_canvas_item_draw (EelCanvasItem *item,
 
 #define ZERO_WIDTH_SPACE "\xE2\x80\x8B"
 
-#define ZERO_OR_THREE_DIGITS(p)                        \
-       (!g_ascii_isdigit (*(p)) ||             \
-        (g_ascii_isdigit (*(p+1)) &&           \
-         g_ascii_isdigit (*(p+2))))
-
 
 static PangoLayout *
 create_label_layout (NautilusCanvasItem *item,
@@ -1357,11 +1352,9 @@ create_label_layout (NautilusCanvasItem *item,
                for (p = text; *p != '\0'; p++) {
                        str = g_string_append_c (str, *p);
 
-                       if (*p == '_' || *p == '-' || (*p == '.' && ZERO_OR_THREE_DIGITS (p+1))) {
+                       if (*p == '_' || *p == '-' || (*p == '.' && !g_ascii_isdigit(*(p+1)))) {
                                /* Ensure that we allow to break after '_' or '.' characters,
-                                * if they are not likely to be part of a version information, to
-                                * not break wrapping of foobar-0.0.1.
-                                * Wrap before IPs and long numbers, though. */
+                                * if they are not followed by a number */
                                str = g_string_append (str, ZERO_WIDTH_SPACE);
                        }
                }


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