MCPcopy Index your code
hub / github.com/python/cpython / show_hit

Method show_hit

Lib/idlelib/replace.py:230–251  ·  view source on GitHub ↗

Highlight text between first and last indices. Text is highlighted via the 'hit' tag and the marked section is brought into view. The colors from the 'hit' tag aren't currently shown when the text is displayed. This is due to the 'sel' tag being added first

(self, first, last)

Source from the content-addressed store, hash-verified

228 return True
229
230 def show_hit(self, first, last):
231 """Highlight text between first and last indices.
232
233 Text is highlighted via the 'hit' tag and the marked
234 section is brought into view.
235
236 The colors from the 'hit' tag aren't currently shown
237 when the text is displayed. This is due to the 'sel'
238 tag being added first, so the colors in the 'sel'
239 config are seen instead of the colors for 'hit'.
240 """
241 text = self.text
242 text.mark_set("insert", first)
243 text.tag_remove("sel", "1.0", "end")
244 text.tag_add("sel", first, last)
245 text.tag_remove("hit", "1.0", "end")
246 if first == last:
247 text.tag_add("hit", first)
248 else:
249 text.tag_add("hit", first, last)
250 text.see("insert")
251 text.update_idletasks()
252
253 def close(self, event=None):
254 "Close the dialog and remove hit tags."

Callers 3

replace_allMethod · 0.95
do_findMethod · 0.95
do_replaceMethod · 0.95

Calls 5

tag_addMethod · 0.80
update_idletasksMethod · 0.80
mark_setMethod · 0.45
tag_removeMethod · 0.45
seeMethod · 0.45

Tested by

no test coverage detected