[gnome-builder] vim: Clear selection to selection-bound after undo



commit ce0da9d691f10820a418389e6458e0a58e0ce0b6
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon Oct 6 08:48:56 2014 +0200

    vim: Clear selection to selection-bound after undo
    
    This will leave the cursor at the start of the changed text rather
    than the end, which matches vim's behavior.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=737975

 src/editor/gb-editor-vim.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/editor/gb-editor-vim.c b/src/editor/gb-editor-vim.c
index cdd01b6..630a347 100644
--- a/src/editor/gb-editor-vim.c
+++ b/src/editor/gb-editor-vim.c
@@ -1379,14 +1379,14 @@ gb_editor_vim_undo (GbEditorVim *vim)
 
   /*
    * GtkSourceView might preserve the selection. So let's go ahead and
-   * clear it manually to the insert mark position.
+   * clear it manually to the selection-bound mark position.
    */
-  insert = gtk_text_buffer_get_insert (buffer);
-  gtk_text_buffer_get_iter_at_mark (buffer, &iter, insert);
-  gtk_text_buffer_select_range (buffer, &iter, &iter);
+  if (gb_editor_vim_get_selection_bounds (vim, NULL, &iter))
+    gtk_text_buffer_select_range (buffer, &iter, &iter);
 
   vim->priv->target_line_offset = gb_editor_vim_get_line_offset (vim);
 
+  insert = gtk_text_buffer_get_insert (buffer);
   gtk_text_view_scroll_mark_onscreen (vim->priv->text_view, insert);
 }
 


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