fix search in TextViewer objects, search returns only first entry
authorSurkov Sergey <surkovsv93@gmail.com>
Thu, 18 Jan 2018 14:24:44 +0300
changeset 1967 92796bb8d4fe
parent 1966 08f70b33bc9f
child 1968 64827679f3f1
fix search in TextViewer objects, search returns only first entry

side effect of a63bb40
plcopen/plcopen.py
--- a/plcopen/plcopen.py	Thu Jan 18 14:03:29 2018 +0300
+++ b/plcopen/plcopen.py	Thu Jan 18 14:24:44 2018 +0300
@@ -152,12 +152,12 @@
     test_result = []
     result = criteria["pattern"].search(text)
     while result is not None:
-        prev_pos = result.endpos
+        prev_pos = result.span()[1]
         start = TextLenInRowColumn(text[:result.start()])
         end = TextLenInRowColumn(text[:result.end() - 1])
         test_result.append((start, end, "\n".join(lines[start[0]:end[0] + 1])))
         result = criteria["pattern"].search(text, result.end())
-        if result is not None and prev_pos == result.endpos:
+        if result is not None and prev_pos == result.end():
             break
     return test_result