[gnome-builder] libide: jump to offset of 0 if there was only whitespace



commit 79eb92b896131efe82fa725e383acdc26df49695
Author: Christian Hergert <christian hergert me>
Date:   Wed Mar 4 20:21:16 2015 -0800

    libide: jump to offset of 0 if there was only whitespace
    
    This fixes support for <ctrl>u 2x on the same line.

 libide/ide-source-view-movements.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/libide/ide-source-view-movements.c b/libide/ide-source-view-movements.c
index 8608ffa..5e2dec4 100644
--- a/libide/ide-source-view-movements.c
+++ b/libide/ide-source-view-movements.c
@@ -209,6 +209,13 @@ ide_source_view_movements_first_nonspace_char (IdeSourceView         *self,
          g_unichar_isspace (ch))
     gtk_text_iter_forward_char (&insert);
 
+  /*
+   * if we are at the line end, there was only whitespace.
+   * instead let's jump to the beginning of the line.
+   */
+  if (gtk_text_iter_ends_line (&insert))
+    gtk_text_iter_set_line_offset (&insert, 0);
+
   ide_source_view_movements_select_range (self, &insert, &selection, extend_selection);
 }
 


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