[gnome-builder/wip/vim] vim: clear selection upon `u` undo
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/vim] vim: clear selection upon `u` undo
- Date: Tue, 30 Sep 2014 21:45:33 +0000 (UTC)
commit 9eb6a170e81ff6e6c08ef32b1ebd54a0f74a3a86
Author: Christian Hergert <christian hergert me>
Date: Tue Sep 30 14:45:29 2014 -0700
vim: clear selection upon `u` undo
src/editor/gb-editor-vim.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/editor/gb-editor-vim.c b/src/editor/gb-editor-vim.c
index fe8780e..acc3a6c 100644
--- a/src/editor/gb-editor-vim.c
+++ b/src/editor/gb-editor-vim.c
@@ -709,6 +709,7 @@ gb_editor_vim_undo (GbEditorVim *vim)
GtkSourceUndoManager *undo;
GtkTextBuffer *buffer;
GtkTextMark *insert;
+ GtkTextIter iter;
g_assert (GB_IS_EDITOR_VIM (vim));
@@ -723,9 +724,16 @@ gb_editor_vim_undo (GbEditorVim *vim)
if (gtk_source_undo_manager_can_undo (undo))
gtk_source_undo_manager_undo (undo);
+ /*
+ * GtkSourceView might preserve the selection. So let's go ahead and
+ * clear it manually to the insert 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);
+
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]