[gedit-plugins] [joinlines] use is_end() instead of ord



commit 8c15796fff779afd883e01f8157f719984ce3b48
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Thu Sep 11 22:07:14 2014 +0200

    [joinlines] use is_end() instead of ord

 plugins/joinlines/joinlines.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/plugins/joinlines/joinlines.py b/plugins/joinlines/joinlines.py
index f0bd7e1..7146dce 100644
--- a/plugins/joinlines/joinlines.py
+++ b/plugins/joinlines/joinlines.py
@@ -207,7 +207,7 @@ class JoinLinesViewActivatable(GObject.Object, Gedit.ViewActivatable):
             current_word_end = current_word_start.copy()
             forward_to_word_end(current_word_end)
 
-            if ord(current_word_end.get_char()) and \
+            if (not current_word_end.is_end()) and \
                doc.get_iter_at_mark(end_mark).compare(current_word_end) >= 0:
 
                 word_length = current_word_end.get_offset() - \
@@ -232,14 +232,14 @@ class JoinLinesViewActivatable(GObject.Object, Gedit.ViewActivatable):
 
 def forward_to_word_start(text_iter):
     char = text_iter.get_char()
-    while ord(char) and (char in (' ', '\t', '\n', '\r')):
+    while not text_iter.is_end() and char in (' ', '\t', '\n', '\r'):
         text_iter.forward_char()
         char = text_iter.get_char()
 
 
 def forward_to_word_end(text_iter):
     char = text_iter.get_char()
-    while ord(char) and (not (char in (' ', '\t', '\n', '\r'))):
+    while not text_iter.is_end() and not (char in (' ', '\t', '\n', '\r')):
         text_iter.forward_char()
         char = text_iter.get_char()
 


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