[gnome-builder] libide: add vim style movements by word start
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide: add vim style movements by word start
- Date: Mon, 23 Mar 2015 23:55:53 +0000 (UTC)
commit e2a61a0d6daa995b40e68e8acf853ac206e264a9
Author: Christian Hergert <christian hergert me>
Date: Wed Mar 4 16:29:32 2015 -0800
libide: add vim style movements by word start
libide/ide-source-view-movements.c | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/libide/ide-source-view-movements.c b/libide/ide-source-view-movements.c
index f81f764..1ca79dc 100644
--- a/libide/ide-source-view-movements.c
+++ b/libide/ide-source-view-movements.c
@@ -740,6 +740,40 @@ ide_source_view_movements_next_word_end (IdeSourceView *self,
}
static void
+ide_source_view_movements_next_word_start (IdeSourceView *self,
+ IdeSourceViewMovement movement,
+ gboolean extend_selection,
+ gint param)
+{
+ GtkTextIter insert;
+ GtkTextIter selection;
+
+ ide_source_view_movements_get_selection (self, &insert, &selection);
+
+ if (!_ide_source_iter_ends_full_word (&insert))
+ _ide_source_iter_forward_visible_word_end (&insert);
+
+ _ide_source_iter_forward_visible_word_end (&insert);
+ _ide_source_iter_backward_visible_word_start (&insert);
+
+ ide_source_view_movements_select_range (self, &insert, &selection, extend_selection);
+}
+
+static void
+ide_source_view_movements_previous_word_start (IdeSourceView *self,
+ IdeSourceViewMovement movement,
+ gboolean extend_selection,
+ gint param)
+{
+ GtkTextIter insert;
+ GtkTextIter selection;
+
+ ide_source_view_movements_get_selection (self, &insert, &selection);
+ _ide_source_iter_backward_visible_word_start (&insert);
+ ide_source_view_movements_select_range (self, &insert, &selection, extend_selection);
+}
+
+static void
ide_source_view_movements_previous_word_end (IdeSourceView *self,
IdeSourceViewMovement movement,
gboolean extend_selection,
@@ -804,9 +838,11 @@ _ide_source_view_apply_movement (IdeSourceView *self,
break;
case IDE_SOURCE_VIEW_MOVEMENT_PREVIOUS_WORD_START:
+ ide_source_view_movements_previous_word_start (self, movement, extend_selection, param);
break;
case IDE_SOURCE_VIEW_MOVEMENT_NEXT_WORD_START:
+ ide_source_view_movements_next_word_start (self, movement, extend_selection, param);
break;
case IDE_SOURCE_VIEW_MOVEMENT_PREVIOUS_WORD_END:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]