[latexila] Comment selected lines: comment empty lines too



commit b6184fab0e7a961c874ec25be25ea205ebfbdda9
Author: SÃbastien Wilmet <swilmet gnome org>
Date:   Fri Oct 19 23:11:29 2012 +0200

    Comment selected lines: comment empty lines too
    
    Empty lines have a meaning in LaTeX. Not commenting them can cause the
    next paragraph to be indented, for example.

 src/document.vala |   18 +++++-------------
 1 files changed, 5 insertions(+), 13 deletions(-)
---
diff --git a/src/document.vala b/src/document.vala
index ebf28fe..5ae39d2 100644
--- a/src/document.vala
+++ b/src/document.vala
@@ -408,21 +408,13 @@ public class Document : Gtk.SourceBuffer
         get_iter_at_line (out cur_iter, start_line);
 
         begin_user_action ();
-        for (int i = start_line ; i <= end_line ; i++, cur_iter.forward_line ())
-        {
-            // do not comment empty lines
-            if (cur_iter.ends_line ())
-                continue;
-
-            TextIter end_line_iter = cur_iter;
-            end_line_iter.forward_to_line_end ();
 
-            string line_contents = get_text (cur_iter, end_line_iter, false);
-
-            // do not comment lines containing only spaces
-            if (line_contents.strip () != "")
-                insert (ref cur_iter, "% ", -1);
+        for (int line_num = start_line ; line_num <= end_line ; line_num++)
+        {
+            insert (ref cur_iter, "% ", -1);
+            cur_iter.forward_line ();
         }
+
         end_user_action ();
     }
 



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