[gimp] Revert "app: item uniquefy algorithm allowing generic numbering schemes."
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Revert "app: item uniquefy algorithm allowing generic numbering schemes."
- Date: Thu, 19 Nov 2015 18:15:30 +0000 (UTC)
commit e12a520c9987a5e4a63b849e9decc762c5e3ffb3
Author: Jehan <jehan girinstud io>
Date: Thu Nov 19 18:58:31 2015 +0100
Revert "app: item uniquefy algorithm allowing generic numbering schemes."
This reverts commit 56b6dbaa87d441ab501195e9a771467cc19f3cc2.
It has been discussed and decided that the no-hash numbering scheme
would have unwanted side-effects for people using number-ending layer
names for other purposes than incrementation.
This revert has been modified to keep commit c402f10.
app/core/gimpitem.c | 2 +-
app/core/gimpitemtree.c | 13 ++++---------
2 files changed, 5 insertions(+), 10 deletions(-)
---
diff --git a/app/core/gimpitem.c b/app/core/gimpitem.c
index 4a17812..cd0a24d 100644
--- a/app/core/gimpitem.c
+++ b/app/core/gimpitem.c
@@ -546,7 +546,7 @@ gimp_item_real_duplicate (GimpItem *item,
if ((strlen (name) >= len &&
strcmp (&name[strlen (name) - len], _("copy")) == 0) ||
- g_regex_match_simple ("([0-9]+)\\s*$", name, 0, 0))
+ g_regex_match_simple ("#([0-9]+)\\s*$", name, 0, 0))
{
/* don't have redundant "copy"s */
new_name = g_strdup (name);
diff --git a/app/core/gimpitemtree.c b/app/core/gimpitemtree.c
index 78f082d..540e048 100644
--- a/app/core/gimpitemtree.c
+++ b/app/core/gimpitemtree.c
@@ -661,19 +661,15 @@ gimp_item_tree_uniquefy_name (GimpItemTree *tree,
gchar *new_name = NULL;
gint number = 0;
gint precision = 1;
- gboolean hashed = TRUE;
- GRegex *end_numbers = g_regex_new ("(^|[^0-9])([0-9]+)\\s*$", 0, 0, NULL);
+ GRegex *end_numbers = g_regex_new (" ?#([0-9]+)\\s*$", 0, 0, NULL);
GMatchInfo *match_info = NULL;
if (g_regex_match (end_numbers, name, 0, &match_info))
{
- /* Allow counting styles without a hash as alternative. */
gchar *match;
gint start_pos;
- hashed = FALSE;
-
- match = g_match_info_fetch (match_info, 2);
+ match = g_match_info_fetch (match_info, 1);
if (match && match[0] == '0')
{
precision = strlen (match);
@@ -681,7 +677,7 @@ gimp_item_tree_uniquefy_name (GimpItemTree *tree,
number = atoi (match);
g_free (match);
- g_match_info_fetch_pos (match_info, 2,
+ g_match_info_fetch_pos (match_info, 0,
&start_pos, NULL);
name[start_pos] = '\0';
}
@@ -694,9 +690,8 @@ gimp_item_tree_uniquefy_name (GimpItemTree *tree,
g_free (new_name);
- new_name = g_strdup_printf ("%s%s%.*d",
+ new_name = g_strdup_printf ("%s #%.*d",
name,
- hashed ? " #" : "",
precision,
number);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]