E5Gui/E5GenericDiffHighlighter.py

changeset 5597
3d88d53f8c2b
parent 5587
ea526b78ee6c
child 5765
39d8b26ff557
equal deleted inserted replaced
5596:4550d8e34765 5597:3d88d53f8c2b
135 if not formats: 135 if not formats:
136 # nothing matched 136 # nothing matched
137 self.setFormat(0, len(text), self.normalFormat) 137 self.setFormat(0, len(text), self.normalFormat)
138 return 138 return
139 139
140 for match, format in formats: 140 for match, formatStr in formats:
141 start = match.start() 141 start = match.start()
142 groups = match.groups() 142 groups = match.groups()
143 143
144 # No groups in the regex, assume this is a single rule 144 # No groups in the regex, assume this is a single rule
145 # that spans the entire line 145 # that spans the entire line
146 if not groups: 146 if not groups:
147 self.setFormat(0, len(text), format) 147 self.setFormat(0, len(text), formatStr)
148 continue 148 continue
149 149
150 # Groups exist, rule is a tuple corresponding to group 150 # Groups exist, rule is a tuple corresponding to group
151 for groupIndex, group in enumerate(groups): 151 for groupIndex, group in enumerate(groups):
152 if not group: 152 if not group:
153 # empty match 153 # empty match
154 continue 154 continue
155 155
156 # allow None as a no-op format 156 # allow None as a no-op format
157 length = len(group) 157 length = len(group)
158 if format[groupIndex]: 158 if formatStr[groupIndex]:
159 self.setFormat(start, start + length, 159 self.setFormat(start, start + length,
160 format[groupIndex]) 160 formatStr[groupIndex])
161 start += length 161 start += length

eric ide

mercurial