# HG changeset patch # User Andrey Skvortsov # Date 1551448516 -10800 # Node ID c48470e2b3833c6333e7653e1b90419b0875b9c3 # Parent cbfcae21c698c447ae8f49cc15bb4a78402d51f5 Fix section styling in code editor (python and c extensions) if non-latin symbols are used in the code Problem exists even if non-latin characters are placed in comments. Close #76 diff -r cbfcae21c698 -r c48470e2b383 editors/CodeFileEditor.py --- a/editors/CodeFileEditor.py Thu Feb 21 11:39:50 2019 +0300 +++ b/editors/CodeFileEditor.py Fri Mar 01 16:55:16 2019 +0300 @@ -280,20 +280,20 @@ def RefreshSectionStyling(self): self.Colourise(0, -1) - text = self.GetText() for line in xrange(self.GetLineCount()): self.SetLineState(line, 0) + doc_end_pos = self.GetLength() for section in self.Controler.SECTIONS_NAMES: section_comments = self.SectionsComments[section] - start_pos = text.find(section_comments["comment"]) + start_pos = self.FindText(0, doc_end_pos, section_comments["comment"]) end_pos = start_pos + len(section_comments["comment"]) self.StartStyling(start_pos, 0xff) self.SetStyling(end_pos - start_pos, STC_CODE_SECTION) self.SetLineState(self.LineFromPosition(start_pos), 1) self.StartStyling(end_pos, 0x00) - self.SetStyling(len(self.GetText()) - end_pos, stc.STC_STYLE_DEFAULT) + self.SetStyling(doc_end_pos - end_pos, stc.STC_STYLE_DEFAULT) def DoGetBestSize(self): return self.ParentWindow.GetPanelBestSize()