[gitg] Do not move to next line if already at line end



commit 146900b2bcf596ffe68a39b8ac080deef260411a
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Sun Dec 20 21:33:32 2015 +0100

    Do not move to next line if already at line end

 libgitg/gitg-diff-view-file-selectable.vala |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/libgitg/gitg-diff-view-file-selectable.vala b/libgitg/gitg-diff-view-file-selectable.vala
index 8399c74..32c8648 100644
--- a/libgitg/gitg-diff-view-file-selectable.vala
+++ b/libgitg/gitg-diff-view-file-selectable.vala
@@ -295,7 +295,10 @@ class Gitg.DiffViewFileSelectable : Object
                real_start.order(real_end);
                real_start.set_line_offset(0);
 
-               real_end.forward_to_line_end();
+               if (!real_end.ends_line())
+               {
+                       real_end.forward_to_line_end();
+               }
 
                var start_line = real_start.get_line();
                var end_line = real_end.get_line();
@@ -316,7 +319,11 @@ class Gitg.DiffViewFileSelectable : Object
                                        buffer.create_source_mark(null, d_selection_category, current);
 
                                        var line_end = current;
-                                       line_end.forward_to_line_end();
+
+                                       if (!line_end.ends_line())
+                                       {
+                                               line_end.forward_to_line_end();
+                                       }
 
                                        buffer.apply_tag(d_selection_tag, current, line_end);
                                }


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