[issue23216] IDLE grep/find/replace source code needs docstrings

Cheryl Sabella report at bugs.python.org
Sat Mar 2 19:52:10 EST 2019


Cheryl Sabella <cheryl.sabella at gmail.com> added the comment:

I've created the first PR for docstrings on replace.  Saimadhav Heblikar had added some docstrings under issue 21676, so I expanded on what he did.  I referred to Al's diff, but didn't use it much since there were already some docstrings.

For readability, I also changed some boolean values from 0 to False and 1 to True.  I had to figure out what `ok` did, so that helped.

I also left a note in `show_hit` because it isn't working right.  The text gets colorized with the `sel` tag instead of the `hit` tag.  effbot says this about tag ordering:
>>> If you attach multiple tags to a range of text, style options from the most recently created tag override options from earlier tags. In the following example, the resulting text is blue on a yellow background.

>>>    text.tag_config("n", background="yellow", foreground="red")
>>>    text.tag_config("a", foreground="blue")
>>>    text.insert(contents, ("n", "a"))

>>> Note that it doesn’t matter in which order you attach tags to a range; it’s the tag creation order that counts.

The note seems to be the important part here as the definition for `sel` is done before `hit` in colorizer.

----------
stage: patch review -> needs patch

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue23216>
_______________________________________


More information about the Python-bugs-list mailing list