[gnome-builder/wip/vim] vim: rename function to match similar functions
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/vim] vim: rename function to match similar functions
- Date: Thu, 2 Oct 2014 07:54:44 +0000 (UTC)
commit 5f559217d61650076d1ed0008dcd56eb3a755c58
Author: Christian Hergert <christian hergert me>
Date: Thu Oct 2 00:54:32 2014 -0700
vim: rename function to match similar functions
So similar to the others, the naming should match and be placed near
them for convenience.
src/editor/gb-editor-vim.c | 74 ++++++++++++++++++++++----------------------
1 files changed, 37 insertions(+), 37 deletions(-)
---
diff --git a/src/editor/gb-editor-vim.c b/src/editor/gb-editor-vim.c
index 18f6be4..9d2bfb4 100644
--- a/src/editor/gb-editor-vim.c
+++ b/src/editor/gb-editor-vim.c
@@ -675,6 +675,42 @@ gb_editor_vim_move_forward_word (GbEditorVim *vim)
gtk_text_view_scroll_mark_onscreen (vim->priv->text_view, insert);
}
+static void
+gb_editor_vim_move_forward_word_end (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);
+ 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,
+ * move back one character so the cursor is "on-top" of the character just
+ * like in VIM.
+ */
+ if (!gtk_text_iter_forward_char (&iter) ||
+ !gtk_text_iter_forward_word_end (&iter))
+ gtk_text_buffer_get_end_iter (buffer, &iter);
+ else if (!has_selection)
+ gtk_text_iter_backward_char (&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);
+}
+
static gboolean
is_single_line_selection (const GtkTextIter *begin,
const GtkTextIter *end)
@@ -1310,42 +1346,6 @@ gb_editor_vim_move_to_end (GbEditorVim *vim)
}
static void
-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);
- 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,
- * move back one character so the cursor is "on-top" of the character just
- * like in VIM.
- */
- if (!gtk_text_iter_forward_char (&iter) ||
- !gtk_text_iter_forward_word_end (&iter))
- gtk_text_buffer_get_end_iter (buffer, &iter);
- else if (!has_selection)
- gtk_text_iter_backward_char (&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);
-}
-
-static void
gb_editor_vim_yank (GbEditorVim *vim)
{
GtkTextBuffer *buffer;
@@ -2508,7 +2508,7 @@ gb_editor_vim_cmd_forward_word_end (GbEditorVim *vim,
count = MAX (1, count);
for (i = 0; i < count; i++)
- gb_editor_vim_move_end_of_word (vim);
+ gb_editor_vim_move_forward_word_end (vim);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]