[gnome-builder/wip/vim] vim: special work around for `y' when there is a selection.



commit a930703635244efa7113f1ec9c2be3006c875eb6
Author: Christian Hergert <christian hergert me>
Date:   Thu Oct 2 02:49:36 2014 -0700

    vim: special work around for `y' when there is a selection.

 src/editor/gb-editor-vim.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/editor/gb-editor-vim.c b/src/editor/gb-editor-vim.c
index 6ef6155..27eb511 100644
--- a/src/editor/gb-editor-vim.c
+++ b/src/editor/gb-editor-vim.c
@@ -1974,6 +1974,28 @@ gb_editor_vim_handle_normal (GbEditorVim *vim,
         }
       break;
 
+    case GDK_KEY_y:
+      {
+        GtkTextBuffer *buffer = gtk_text_view_get_buffer (vim->priv->text_view);
+
+        /*
+         * WORKAROUND:
+         *
+         * Special case workaround for `y', which in some cases has a modifier
+         * and in other cases does not. We should probably mark whether or not
+         * a command can be executed directly if there is a selection.
+         */
+        if (gtk_text_buffer_get_has_selection (buffer))
+          {
+            gb_editor_vim_clear_phrase (vim);
+            gb_editor_vim_yank (vim);
+            gb_editor_vim_clear_selection (vim);
+            return TRUE;
+          }
+
+        break;
+      }
+
     default:
       break;
     }


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