[gnome-builder/wip/vim] vim: use gtk_text_buffer_get_has_selection()



commit 60b090d6cefd1c586050bd73166f6724fc8d11f4
Author: Christian Hergert <christian hergert me>
Date:   Mon Sep 29 23:32:38 2014 -0700

    vim: use gtk_text_buffer_get_has_selection()
    
    Don't reinvent our own.

 src/editor/gb-editor-vim.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/src/editor/gb-editor-vim.c b/src/editor/gb-editor-vim.c
index f42dd9e..ca59be1 100644
--- a/src/editor/gb-editor-vim.c
+++ b/src/editor/gb-editor-vim.c
@@ -855,18 +855,14 @@ gb_editor_vim_move_to_end (GbEditorVim *vim)
 }
 
 static gboolean
-gb_editor_vim_has_selection (GbEditorVim *vim)
+gb_editor_vim_get_has_selection (GbEditorVim *vim)
 {
   GtkTextBuffer *buffer;
-  GtkTextIter begin;
-  GtkTextIter end;
 
   g_assert (GB_IS_EDITOR_VIM (vim));
 
   buffer = gtk_text_view_get_buffer (vim->priv->text_view);
-  gtk_text_buffer_get_selection_bounds (buffer, &begin, &end);
-
-  return !gtk_text_iter_equal (&begin, &end);
+  return gtk_text_buffer_get_has_selection (buffer);
 }
 
 static gboolean
@@ -1039,7 +1035,7 @@ gb_editor_vim_handle_normal (GbEditorVim *vim,
       /*
        * If we have a selection, try to indent it.
        */
-      if (gb_editor_vim_has_selection (vim) &&
+      if (gb_editor_vim_get_has_selection (vim) &&
           GB_IS_SOURCE_VIEW (vim->priv->text_view))
         {
           GbSourceView *view = GB_SOURCE_VIEW (vim->priv->text_view);
@@ -1053,7 +1049,7 @@ gb_editor_vim_handle_normal (GbEditorVim *vim,
       /*
        * If we have a selection, try to unindent it.
        */
-      if (gb_editor_vim_has_selection (vim) &&
+      if (gb_editor_vim_get_has_selection (vim) &&
           GB_IS_SOURCE_VIEW (vim->priv->text_view))
         {
           GbSourceView *view = GB_SOURCE_VIEW (vim->priv->text_view);


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