summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Bicha <jbicha@ubuntu.com>2017-04-27 20:52:26 -0400
committerJeremy Bicha <jbicha@ubuntu.com>2017-05-04 04:37:59 -0400
commit23467b5913acefe14addbf6e042e7d30cf501d9b (patch)
treea0147a3f35ba76fc8c3295f7fec321c9f146e71c
parent5ec9b5cd12a037eedaf99706563dd61b1946343e (diff)
downloadnautilus-23467b5913acefe14addbf6e042e7d30cf501d9b.tar.gz
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
-rw-r--r--src/nautilus-canvas-item.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/nautilus-canvas-item.c b/src/nautilus-canvas-item.c
index a103d34a4..97672001f 100644
--- a/src/nautilus-canvas-item.c
+++ b/src/nautilus-canvas-item.c
@@ -1457,12 +1457,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,
const char *text)
@@ -1492,12 +1486,10 @@ create_label_layout (NautilusCanvasItem *item,
{
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);
}
}