Fixing bug that calls text styling in a loop while some highlighting is defined
authorlaurent
Fri, 18 Nov 2011 17:37:43 +0100
changeset 589 e3a1d9a59c97
parent 588 4876fedbe9df
child 590 b2442bb10c0b
Fixing bug that calls text styling in a loop while some highlighting is defined
TextViewer.py
--- a/TextViewer.py	Wed Nov 16 23:35:15 2011 +0100
+++ b/TextViewer.py	Fri Nov 18 17:37:43 2011 +0100
@@ -806,12 +806,14 @@
             if start[0] == 0:
                 highlight_start_pos = start[1] - indent
             else:
-                highlight_start_pos = self.GetLineEndPosition(start[0] - 1) + start[1] - indent + 1
+                highlight_start_pos = self.Editor.GetLineEndPosition(start[0] - 1) + start[1] - indent + 1
             if end[0] == 0:
                 highlight_end_pos = end[1] - indent + 1
             else:
-                highlight_end_pos = self.GetLineEndPosition(end[0] - 1) + end[1] - indent + 2
+                highlight_end_pos = self.Editor.GetLineEndPosition(end[0] - 1) + end[1] - indent + 2
             if highlight_start_pos < end_pos and highlight_end_pos > start_pos:
                 self.StartStyling(highlight_start_pos, 0xff)
                 self.SetStyling(highlight_end_pos - highlight_start_pos, highlight_type)
-
+                self.StartStyling(highlight_start_pos, 0x00)
+                self.SetStyling(len(self.Editor.GetText()) - highlight_end_pos, wx.stc.STC_STYLE_DEFAULT)
+