[gnome-builder/wip/vim] vim: make `e` command respec the current selection.
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/vim] vim: make `e` command respec the current selection.
- Date: Tue, 30 Sep 2014 23:44:34 +0000 (UTC)
commit fbc5a19a51e08ffdc6f2bfea524b3cdbee5b1af7
Author: Christian Hergert <christian hergert me>
Date: Tue Sep 30 16:44:20 2014 -0700
vim: make `e` command respec the current selection.
src/editor/gb-editor-vim.c | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/editor/gb-editor-vim.c b/src/editor/gb-editor-vim.c
index 82830de..266482f 100644
--- a/src/editor/gb-editor-vim.c
+++ b/src/editor/gb-editor-vim.c
@@ -1067,12 +1067,13 @@ gb_editor_vim_move_end_of_word (GbEditorVim *vim)
GtkTextBuffer *buffer;
GtkTextMark *insert;
GtkTextIter iter;
+ GtkTextIter selection;
+ gboolean has_selection;
g_return_if_fail (GB_IS_EDITOR_VIM (vim));
buffer = gtk_text_view_get_buffer (vim->priv->text_view);
- insert = gtk_text_buffer_get_insert (buffer);
- gtk_text_buffer_get_iter_at_mark (buffer, &iter, insert);
+ has_selection = gb_editor_vim_get_selection_bounds (vim, &iter, &selection);
/*
* Move forward to the end of the next word. If we successfully find it,
@@ -1082,11 +1083,17 @@ gb_editor_vim_move_end_of_word (GbEditorVim *vim)
if (!gtk_text_iter_forward_char (&iter) ||
!gtk_text_iter_forward_word_end (&iter))
gtk_text_buffer_get_end_iter (buffer, &iter);
- else
+ else if (!has_selection)
gtk_text_iter_backward_char (&iter);
- gtk_text_buffer_select_range (buffer, &iter, &iter);
+ if (has_selection)
+ gb_editor_vim_select_range (vim, &iter, &selection);
+ else
+ gtk_text_buffer_select_range (buffer, &iter, &iter);
+
+ insert = gtk_text_buffer_get_insert (buffer);
gtk_text_view_scroll_mark_onscreen (vim->priv->text_view, insert);
+
vim->priv->target_line_offset = gb_editor_vim_get_line_offset (vim);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]