[gnome-builder/wip/vim] vim: make `^` command respect selections.
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/vim] vim: make `^` command respect selections.
- Date: Tue, 30 Sep 2014 22:51:02 +0000 (UTC)
commit 469ef884a87e05487b9ce9bfe432b44e1996346c
Author: Christian Hergert <christian hergert me>
Date: Tue Sep 30 15:50:18 2014 -0700
vim: make `^` command respect selections.
src/editor/gb-editor-vim.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/src/editor/gb-editor-vim.c b/src/editor/gb-editor-vim.c
index d68ac32..3e56017 100644
--- a/src/editor/gb-editor-vim.c
+++ b/src/editor/gb-editor-vim.c
@@ -264,18 +264,15 @@ gb_editor_vim_select_range (GbEditorVim *vim,
static void
gb_editor_vim_move_line_start (GbEditorVim *vim)
{
- GbEditorVimPrivate *priv;
GtkTextBuffer *buffer;
- GtkTextMark *insert;
GtkTextIter iter;
+ GtkTextIter selection;
+ gboolean has_selection;
g_assert (GB_IS_EDITOR_VIM (vim));
- priv = vim->priv;
-
- buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->text_view));
- insert = gtk_text_buffer_get_insert (buffer);
- gtk_text_buffer_get_iter_at_mark (buffer, &iter, insert);
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (vim->priv->text_view));
+ has_selection = gb_editor_vim_get_selection_bounds (vim, &iter, &selection);
gtk_text_buffer_get_iter_at_line (buffer, &iter,
gtk_text_iter_get_line (&iter));
@@ -285,7 +282,10 @@ gb_editor_vim_move_line_start (GbEditorVim *vim)
if (!gtk_text_iter_forward_char (&iter))
break;
- 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);
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]