[gnome-builder] comment code plugin: fix selection in commenting



commit 12a2da87ee6208400bb4bf6d2c91b857a6e35df5
Author: Sebastien Lafargue <slafargue gnome org>
Date:   Mon Feb 29 12:01:36 2016 +0100

    comment code plugin: fix selection in commenting
    
    When having a selection and the end iter is at start of a line,
    don't comment the last line

 plugins/comment-code/gbp-comment-code-view-addin.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/plugins/comment-code/gbp-comment-code-view-addin.c 
b/plugins/comment-code/gbp-comment-code-view-addin.c
index 8615754..aab74ce 100644
--- a/plugins/comment-code/gbp-comment-code-view-addin.c
+++ b/plugins/comment-code/gbp-comment-code-view-addin.c
@@ -320,6 +320,10 @@ gbp_comment_code_view_addin_comment_action (GSimpleAction *action,
   gtk_text_buffer_get_selection_bounds (buffer, &begin, &end);
   gtk_text_iter_order (&begin, &end);
 
+  if (!gtk_text_iter_equal (&begin, &end) &&
+      gtk_text_iter_starts_line (&end))
+    gtk_text_iter_backward_char (&end);
+
   start_line = gtk_text_iter_get_line (&begin);
   end_line = gtk_text_iter_get_line (&end);
 


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