[gnome-builder/wip/libide] libide: implement line_end movement



commit e8132015b388c16555185d706dc6bc648b2f59cf
Author: Christian Hergert <christian hergert me>
Date:   Fri Mar 6 11:45:25 2015 -0800

    libide: implement line_end movement
    
    Inclusive will select the newline as well, exclusive will put you at the
    iter containing the newline.

 libide/ide-source-view-movements.c |   12 +++++++++++-
 libide/ide-source-view.h           |    2 +-
 2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/libide/ide-source-view-movements.c b/libide/ide-source-view-movements.c
index 99c4573..0140c43 100644
--- a/libide/ide-source-view-movements.c
+++ b/libide/ide-source-view-movements.c
@@ -223,6 +223,16 @@ ide_source_view_movements_line_chars (Movement *mv)
 }
 
 static void
+ide_source_view_movements_line_end (Movement *mv)
+{
+  if (!gtk_text_iter_ends_line (&mv->insert))
+    gtk_text_iter_forward_to_line_end (&mv->insert);
+
+  if (!mv->exclusive)
+    gtk_text_iter_forward_char (&mv->insert);
+}
+
+static void
 ide_source_view_movements_middle_char (Movement *mv)
 {
   GtkTextView *text_view = GTK_TEXT_VIEW (mv->self);
@@ -935,7 +945,7 @@ _ide_source_view_apply_movement (IdeSourceView         *self,
       break;
 
     case IDE_SOURCE_VIEW_MOVEMENT_LINE_END:
-      //ide_source_view_movements_line_end (&mv);
+      ide_source_view_movements_line_end (&mv);
       break;
 
     case IDE_SOURCE_VIEW_MOVEMENT_HALF_PAGE_UP:
diff --git a/libide/ide-source-view.h b/libide/ide-source-view.h
index 2ea874b..0e63cf1 100644
--- a/libide/ide-source-view.h
+++ b/libide/ide-source-view.h
@@ -97,7 +97,7 @@ typedef enum
  *   space if any. otherwise, the line break will be selected.
  * @IDE_SOURCE_VIEW_MOVEMENT_LINE_END: This will move you to the location of the newline at the
  *   end of the current line. It does not support exclusive will not select the newline, while
- *   invlusive will select the newline.
+ *   inclusive will select the newline.
  * @IDE_SOURCE_VIEW_MOVEMENT_HALF_PAGE_UP: move half a page up.
  * @IDE_SOURCE_VIEW_MOVEMENT_HALF_PAGE_DOWN: move half a page down.
  * @IDE_SOURCE_VIEW_MOVEMENT_PAGE_UP: move a full page up.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]