gimp r26456 - in branches/soc-2008-tagging: . app/widgets



Author: aurisj
Date: Fri Aug  8 22:05:02 2008
New Revision: 26456
URL: http://svn.gnome.org/viewvc/gimp?rev=26456&view=rev

Log:
2008-08-09  Aurimas JuÅka  <aurisj svn gnome org>

	* app/widgets/gimptagentry.c: multiple tag deletion.



Modified:
   branches/soc-2008-tagging/ChangeLog
   branches/soc-2008-tagging/app/widgets/gimptagentry.c

Modified: branches/soc-2008-tagging/app/widgets/gimptagentry.c
==============================================================================
--- branches/soc-2008-tagging/app/widgets/gimptagentry.c	(original)
+++ branches/soc-2008-tagging/app/widgets/gimptagentry.c	Fri Aug  8 22:05:02 2008
@@ -1239,8 +1239,14 @@
 
       case GDK_BackSpace:
             {
-              gint        position = gtk_editable_get_position (GTK_EDITABLE (widget));
-              if (gimp_tag_entry_select_jellybean (tag_entry, position, position, TAG_SEARCH_LEFT))
+              gint      selection_start;
+              gint      selection_end;
+
+              gtk_editable_get_selection_bounds (GTK_EDITABLE (tag_entry),
+                                                 &selection_start, &selection_end);
+              if (gimp_tag_entry_select_jellybean (tag_entry,
+                                                   selection_start, selection_end,
+                                                   TAG_SEARCH_LEFT))
                 {
                   return TRUE;
                 }
@@ -1249,8 +1255,14 @@
 
       case GDK_Delete:
             {
-              gint        position = gtk_editable_get_position (GTK_EDITABLE (widget));
-              if (gimp_tag_entry_select_jellybean (tag_entry, position, position, TAG_SEARCH_RIGHT))
+              gint      selection_start;
+              gint      selection_end;
+
+              gtk_editable_get_selection_bounds (GTK_EDITABLE (tag_entry),
+                                                 &selection_start, &selection_end);
+              if (gimp_tag_entry_select_jellybean (tag_entry,
+                                                   selection_start, selection_end,
+                                                   TAG_SEARCH_RIGHT))
                 {
                   return TRUE;
                 }
@@ -1365,27 +1377,45 @@
 
       case TAG_SEARCH_LEFT:
             {
-              while (tag_entry->mask->str[selection_start] != 't'
-                     && selection_start > 0)
-                {
-                  selection_start--;
+              if ((tag_entry->mask->str[selection_start] == 'w'
+                   || tag_entry->mask->str[selection_start] == 's')
+                  && selection_start > 0)
+                {
+                  while ((tag_entry->mask->str[selection_start] == 'w'
+                          || tag_entry->mask->str[selection_start] == 's')
+                         && selection_start > 0)
+                    {
+                      selection_start--;
+                    }
+                  selection_end = selection_start + 1;
                 }
-              selection_end = selection_start + 1;
             }
           break;
 
       case TAG_SEARCH_RIGHT:
             {
-              while (tag_entry->mask->str[selection_start] != 't'
-                     && selection_start < tag_entry->mask->len - 1)
-                {
-                  selection_start++;
+              if ((tag_entry->mask->str[selection_start] == 'w'
+                   || tag_entry->mask->str[selection_start] == 's')
+                  && selection_start < tag_entry->mask->len - 1)
+                {
+                  while ((tag_entry->mask->str[selection_start] == 'w'
+                          || tag_entry->mask->str[selection_start] == 's')
+                         && selection_start < tag_entry->mask->len - 1)
+                    {
+                      selection_start++;
+                    }
+                  selection_end = selection_start + 1;
                 }
-              selection_end = selection_start + 1;
             }
           break;
     }
 
+  if (selection_start < tag_entry->mask->len
+      && selection_start == selection_end)
+    {
+      selection_end = selection_start + 1;
+    }
+
   gtk_editable_get_selection_bounds (GTK_EDITABLE (tag_entry),
                                      &prev_selection_start,
                                      &prev_selection_end);



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