def find_all_occurrences(ed_self, text, case_sensitive, whole_words):
"""
Finding matches to highlight
"""
opts = ('c' if case_sensitive else '') + ('w' if whole_words else '')
log("Calling ed_self.action: EDACTION_FIND_ALL")
res = ed_self.action(app.EDACTION_FIND_ALL, text, opts, opt.MAX_LINE_LEN)
res = [r[:2] for r in res]
return res
it uses EDACTION_FIND_ALL. ie Cud search engine.
search for 'visible' matches is not using Cud engine! it uses Py regex
items = []
for i,(x_offset, line) in enumerate(offset_lines):
if line: # prevent crash if line is None
for m in re.finditer(re_pattern, line, flags=_re_flags):
items.append( (x_offset+m.start(), y0+i) )
it is not nice. better rework this part using Cud engine.
search for all mathes is fast and ok
it uses EDACTION_FIND_ALL. ie Cud search engine.
it is not nice. better rework this part using Cud engine.