[gnome-builder] source-view: smart-backspace was merged upstream



commit 64b2299aa5f2160022f1873bbc69359658bfa8fa
Author: Paolo Borelli <pborelli gnome org>
Date:   Sun Jun 21 14:13:07 2015 +0200

    source-view: smart-backspace was merged upstream
    
    https://bugzilla.gnome.org/show_bug.cgi?id=751277

 configure.ac                             |    2 +-
 doc/reference/libide/libide-sections.txt |    2 -
 libide/ide-source-view.c                 |  164 ------------------------------
 libide/ide-source-view.h                 |    3 -
 4 files changed, 1 insertions(+), 170 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d32441d..7687c3e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -139,7 +139,7 @@ dnl Check for Required Packages
 dnl ***********************************************************************
 m4_define([gtk_required_version], [3.17.1])
 m4_define([glib_required_version], [2.45.1])
-m4_define([gtksourceview_required_version], [3.17.2])
+m4_define([gtksourceview_required_version], [3.17.3])
 m4_define([ggit_required_version], [0.22.9])
 m4_define([gjs_required_version], [1.42.0])
 m4_define([pygobject_required_version], [3.0.0])
diff --git a/doc/reference/libide/libide-sections.txt b/doc/reference/libide/libide-sections.txt
index 372fabc..8b8b9c1 100644
--- a/doc/reference/libide/libide-sections.txt
+++ b/doc/reference/libide/libide-sections.txt
@@ -1071,7 +1071,6 @@ ide_source_view_get_show_line_changes
 ide_source_view_get_show_line_diagnostics
 ide_source_view_get_show_search_bubbles
 ide_source_view_get_show_search_shadow
-ide_source_view_get_smart_backspace
 ide_source_view_get_snippet_completion
 ide_source_view_get_visible_rect
 ide_source_view_jump
@@ -1092,7 +1091,6 @@ ide_source_view_set_show_line_changes
 ide_source_view_set_show_line_diagnostics
 ide_source_view_set_show_search_bubbles
 ide_source_view_set_show_search_shadow
-ide_source_view_set_smart_backspace
 ide_source_view_set_snippet_completion
 ide_source_view_set_back_forward_list
 ide_source_view_move_mark_onscreen
diff --git a/libide/ide-source-view.c b/libide/ide-source-view.c
index fa14197..1e31f16 100644
--- a/libide/ide-source-view.c
+++ b/libide/ide-source-view.c
@@ -145,7 +145,6 @@ typedef struct
   guint                        show_line_diagnostics : 1;
   guint                        show_search_bubbles : 1;
   guint                        show_search_shadow : 1;
-  guint                        smart_backspace : 1;
   guint                        snippet_completion : 1;
   guint                        waiting_for_capture : 1;
 } IdeSourceViewPrivate;
@@ -183,7 +182,6 @@ enum {
   PROP_SHOW_LINE_DIAGNOSTICS,
   PROP_SHOW_SEARCH_BUBBLES,
   PROP_SHOW_SEARCH_SHADOW,
-  PROP_SMART_BACKSPACE,
   PROP_SNIPPET_COMPLETION,
   LAST_PROP,
 
@@ -1982,124 +1980,6 @@ is_modifier_key (GdkEventKey *event)
 }
 
 static gboolean
-ide_source_view_do_smart_backspace (IdeSourceView *self,
-                                    GdkEventKey   *event)
-{
-  GtkTextBuffer *buffer;
-  GtkTextIter insert;
-  GtkTextIter end;
-  GtkTextIter tmp;
-  guint visual_column;
-  gint indent_width;
-  gint tab_width;
-
-  IDE_ENTRY;
-
-  g_assert (IDE_IS_SOURCE_VIEW (self));
-  g_assert (event);
-  g_assert (event->type == GDK_KEY_PRESS);
-
-  buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self));
-
-  ide_buffer_get_selection_bounds (IDE_BUFFER (buffer), &insert, &end);
-
-  if (!gtk_text_iter_equal (&insert, &end))
-    IDE_RETURN (FALSE);
-
-  if ((event->state & GDK_CONTROL_MASK) != 0)
-    {
-      /*
-       * A <Control>BackSpace at the beginning of the line should only move us to the
-       * end of the previous line. Anything more than that is non-obvious because it requires
-       * looking in a position other than where the cursor is.
-       */
-      if ((gtk_text_iter_get_line_offset (&insert) == 0) && (gtk_text_iter_get_line (&insert) > 0))
-        {
-          gtk_text_buffer_begin_user_action (buffer);
-          gtk_text_iter_backward_char (&insert);
-          gtk_text_buffer_delete (buffer, &insert, &end);
-          gtk_text_buffer_end_user_action (buffer);
-
-          IDE_RETURN (TRUE);
-        }
-    }
-
-#define GET_VISUAL_COLUMN(iter) gtk_source_view_get_visual_column(GTK_SOURCE_VIEW(self),iter)
-
-  /* if the line isn't empty up to our cursor, ignore */
-  tmp = insert;
-  while (TRUE)
-    {
-      gunichar ch;
-
-      ch = gtk_text_iter_get_char (&tmp);
-
-      if ((ch != 0) && !g_unichar_isspace (ch))
-        IDE_RETURN (FALSE);
-
-      if (gtk_text_iter_starts_line (&tmp))
-        break;
-
-      gtk_text_iter_backward_char (&tmp);
-    }
-
-  /*
-   * If <Control>BackSpace was specified, delete up to the zero position.
-   */
-  if ((event->state & GDK_CONTROL_MASK) != 0)
-    {
-      gtk_text_buffer_begin_user_action (buffer);
-      gtk_text_iter_set_line_offset (&insert, 0);
-      gtk_text_buffer_delete (buffer, &insert, &end);
-      gtk_text_buffer_end_user_action (buffer);
-
-      IDE_RETURN (TRUE);
-    }
-
-  visual_column = GET_VISUAL_COLUMN (&insert);
-  indent_width = gtk_source_view_get_indent_width (GTK_SOURCE_VIEW (self));
-  tab_width = gtk_source_view_get_tab_width (GTK_SOURCE_VIEW (self));
-  if (indent_width <= 0)
-    indent_width = tab_width;
-
-  if (visual_column < indent_width)
-    IDE_RETURN (FALSE);
-
-  if ((visual_column % indent_width) == 0)
-    {
-      gint target_column = visual_column - indent_width;
-      gunichar ch;
-
-      g_assert (target_column >= 0);
-
-      while (GET_VISUAL_COLUMN (&insert) > target_column)
-        {
-          gtk_text_iter_backward_char (&insert);
-          ch = gtk_text_iter_get_char (&insert);
-
-          if (!g_unichar_isspace (ch))
-            IDE_RETURN (FALSE);
-        }
-
-      ch = gtk_text_iter_get_char (&insert);
-      if (!g_unichar_isspace (ch))
-        IDE_RETURN (FALSE);
-
-      gtk_text_buffer_begin_user_action (buffer);
-      gtk_text_buffer_delete (buffer, &insert, &end);
-      while (GET_VISUAL_COLUMN (&insert) < target_column)
-        gtk_text_buffer_insert (buffer, &insert, " ", 1);
-      gtk_text_buffer_end_user_action (buffer);
-
-      IDE_RETURN (TRUE);
-    }
-
-#undef GET_VISUAL_COLUMN
-
-  IDE_RETURN (FALSE);
-}
-
-static gboolean
 ide_source_view_key_press_event (GtkWidget   *widget,
                                  GdkEventKey *event)
 {
@@ -2203,8 +2083,6 @@ ide_source_view_key_press_event (GtkWidget   *widget,
     {
       if (ide_source_view_maybe_delete_match (self, event))
         return TRUE;
-      else if (priv->smart_backspace && ide_source_view_do_smart_backspace (self, event))
-        return TRUE;
     }
 
   /*
@@ -5028,10 +4906,6 @@ ide_source_view_get_property (GObject    *object,
       g_value_set_boolean (value, ide_source_view_get_show_search_shadow (self));
       break;
 
-    case PROP_SMART_BACKSPACE:
-      g_value_set_boolean (value, ide_source_view_get_smart_backspace (self));
-      break;
-
     case PROP_SNIPPET_COMPLETION:
       g_value_set_boolean (value, ide_source_view_get_snippet_completion (self));
       break;
@@ -5125,10 +4999,6 @@ ide_source_view_set_property (GObject      *object,
       ide_source_view_set_show_search_shadow (self, g_value_get_boolean (value));
       break;
 
-    case PROP_SMART_BACKSPACE:
-      ide_source_view_set_smart_backspace (self, g_value_get_boolean (value));
-      break;
-
     case PROP_SNIPPET_COMPLETION:
       ide_source_view_set_snippet_completion (self, g_value_get_boolean (value));
       break;
@@ -5357,13 +5227,6 @@ ide_source_view_class_init (IdeSourceViewClass *klass)
                           FALSE,
                           (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
-  gParamSpecs [PROP_SMART_BACKSPACE] =
-    g_param_spec_boolean ("smart-backspace",
-                         _("Smart Backspace"),
-                         _("If smart Backspace should be used."),
-                         FALSE,
-                         (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
   gParamSpecs [PROP_SNIPPET_COMPLETION] =
     g_param_spec_boolean ("snippet-completion",
                           _("Snippet Completion"),
@@ -7056,33 +6919,6 @@ ide_source_view_set_show_search_shadow (IdeSourceView *self,
     }
 }
 
-gboolean
-ide_source_view_get_smart_backspace (IdeSourceView *self)
-{
-  IdeSourceViewPrivate *priv = ide_source_view_get_instance_private (self);
-
-  g_return_val_if_fail (IDE_IS_SOURCE_VIEW (self), FALSE);
-
-  return priv->smart_backspace;
-}
-
-void
-ide_source_view_set_smart_backspace (IdeSourceView *self,
-                                     gboolean       smart_backspace)
-{
-  IdeSourceViewPrivate *priv = ide_source_view_get_instance_private (self);
-
-  g_return_if_fail (IDE_IS_SOURCE_VIEW (self));
-
-  smart_backspace = !!smart_backspace;
-
-  if (smart_backspace != priv->smart_backspace)
-    {
-      priv->smart_backspace = smart_backspace;
-      g_object_notify_by_pspec (G_OBJECT (self), gParamSpecs [PROP_SMART_BACKSPACE]);
-    }
-}
-
 /**
  * ide_source_view_get_file_settings:
  * @self: A #IdeSourceView.
diff --git a/libide/ide-source-view.h b/libide/ide-source-view.h
index 708d061..2e6cac9 100644
--- a/libide/ide-source-view.h
+++ b/libide/ide-source-view.h
@@ -288,7 +288,6 @@ gboolean                    ide_source_view_get_show_line_changes     (IdeSource
 gboolean                    ide_source_view_get_show_line_diagnostics (IdeSourceView              *self);
 gboolean                    ide_source_view_get_show_search_bubbles   (IdeSourceView              *self);
 gboolean                    ide_source_view_get_show_search_shadow    (IdeSourceView              *self);
-gboolean                    ide_source_view_get_smart_backspace       (IdeSourceView              *self);
 gboolean                    ide_source_view_get_snippet_completion    (IdeSourceView              *self);
 void                        ide_source_view_get_visible_rect          (IdeSourceView              *self,
                                                                        GdkRectangle               
*visible_rect);
@@ -326,8 +325,6 @@ void                        ide_source_view_set_show_search_bubbles   (IdeSource
                                                                        gboolean                    
show_search_bubbles);
 void                        ide_source_view_set_show_search_shadow    (IdeSourceView              *self,
                                                                        gboolean                    
show_search_bubbles);
-void                        ide_source_view_set_smart_backspace       (IdeSourceView              *self,
-                                                                       gboolean                    
smart_backspace);
 void                        ide_source_view_set_snippet_completion    (IdeSourceView              *self,
                                                                        gboolean                    
snippet_completion);
 void                        ide_source_view_set_back_forward_list     (IdeSourceView              *self,


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