[gedit-plugins] Use gtksourcebuffer join_lines implementation



commit 84ff72bf496b756b3d26aec64f8da3d1a2cafd37
Author: Paolo Borelli <pborelli gnome org>
Date:   Fri Mar 13 22:17:27 2015 +0100

    Use gtksourcebuffer join_lines implementation

 plugins/joinlines/joinlines.py |   24 +-----------------------
 1 files changed, 1 insertions(+), 23 deletions(-)
---
diff --git a/plugins/joinlines/joinlines.py b/plugins/joinlines/joinlines.py
index 7146dce..175ee58 100644
--- a/plugins/joinlines/joinlines.py
+++ b/plugins/joinlines/joinlines.py
@@ -121,8 +121,6 @@ class JoinLinesViewActivatable(GObject.Object, Gedit.ViewActivatable):
         if doc is None:
             return
 
-        doc.begin_user_action()
-
         # If there is a selection use it, otherwise join the
         # next line
         try:
@@ -132,27 +130,7 @@ class JoinLinesViewActivatable(GObject.Object, Gedit.ViewActivatable):
             end = start.copy()
             end.forward_line()
 
-        end_mark = doc.create_mark(None, end)
-
-        if not start.ends_line():
-            start.forward_to_line_end()
-
-        # Include trailing spaces in the chunk to be removed
-        while start.backward_char() and start.get_char() in ('\t', ' '):
-            pass
-        start.forward_char()
-
-        while doc.get_iter_at_mark(end_mark).compare(start) == 1:
-            end = start.copy()
-            while end.get_char() in ('\r', '\n', ' ', '\t'):
-                end.forward_char()
-            doc.delete(start, end)
-
-            doc.insert(start, ' ')
-            start.forward_to_line_end()
-
-        doc.delete_mark(end_mark)
-        doc.end_user_action()
+        doc.join_lines(start, end)
 
     def split_lines(self):
         doc = self.view.get_buffer()


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