editors/TextViewer.py
branchpython3
changeset 3791 c98646b1c981
parent 3765 88fe6fc9fd38
child 3795 223a91584172
equal deleted inserted replaced
3790:9ec48ec13b65 3791:c98646b1c981
   189         self.Editor.SelectAll()
   189         self.Editor.SelectAll()
   190 
   190 
   191     def Colourise(self, start, end):
   191     def Colourise(self, start, end):
   192         self.Editor.Colourise(start, end)
   192         self.Editor.Colourise(start, end)
   193 
   193 
   194     def StartStyling(self, pos):
   194     if wx.VERSION < (4, 1, 0):
   195         self.Editor.StartStyling(pos)
   195         def StartStyling(self, pos, mask=0xff):
       
   196             self.Editor.StartStyling(pos, mask)
       
   197     else:
       
   198         def StartStyling(self, pos, *ignored):
       
   199             self.Editor.StartStyling(pos)
   196 
   200 
   197     INDIC0 = 0
   201     INDIC0 = 0
   198     INDIC1 = 1
   202     INDIC1 = 1
   199     INDIC2 = 2
   203     INDIC2 = 2
   200 
   204 
   975             else:
   979             else:
   976                 highlight_end_pos = self.Editor.GetLineEndPosition(end[0] - 1) + end[1] - indent + 2
   980                 highlight_end_pos = self.Editor.GetLineEndPosition(end[0] - 1) + end[1] - indent + 2
   977             if highlight_start_pos < end_pos and highlight_end_pos > start_pos:
   981             if highlight_start_pos < end_pos and highlight_end_pos > start_pos:
   978                 self.StartStyling(highlight_start_pos)
   982                 self.StartStyling(highlight_start_pos)
   979                 self.SetStyling(highlight_end_pos - highlight_start_pos, highlight_type)
   983                 self.SetStyling(highlight_end_pos - highlight_start_pos, highlight_type)
   980                 self.StartStyling(highlight_start_pos)
   984                 self.StartStyling(highlight_start_pos, 0x00)
   981                 until_end = max(0, len(self.Editor.GetText()) - highlight_end_pos)
   985                 until_end = max(0, len(self.Editor.GetText()) - highlight_end_pos)
   982                 self.SetStyling(until_end, wx.stc.STC_STYLE_DEFAULT)
   986                 self.SetStyling(until_end, wx.stc.STC_STYLE_DEFAULT)