[gnome-builder/wip/vim] vim: match vim when `Vx` on an empty line.



commit d328c582befb3a9fccc2675350a7228502609a33
Author: Christian Hergert <christian hergert me>
Date:   Mon Sep 29 18:39:09 2014 -0700

    vim: match vim when `Vx` on an empty line.

 src/editor/gb-editor-vim.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/editor/gb-editor-vim.c b/src/editor/gb-editor-vim.c
index 1731fee..5de7fc1 100644
--- a/src/editor/gb-editor-vim.c
+++ b/src/editor/gb-editor-vim.c
@@ -433,11 +433,17 @@ gb_editor_vim_delete_selection (GbEditorVim *vim)
   /*
    * If there is no selection to delete, try to remove the next character
    * in the line. If there is no next character, delete the last character
-   * in the line.
+   * in the line. It might look like there is no selection of the line
+   * was empty.
    */
   if (gtk_text_iter_equal (&begin, &end))
     {
-      if (!gtk_text_iter_ends_line (&end))
+      if (gtk_text_iter_starts_line (&begin) && gtk_text_iter_ends_line (&end))
+        {
+          if (!gtk_text_iter_forward_char (&end))
+            gtk_text_iter_backward_char (&begin);
+        }
+      else if (!gtk_text_iter_ends_line (&end))
         {
           if (!gtk_text_iter_forward_char (&end))
             return;


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