Terry J. Reedy <[email protected]> added the comment:
Thanks for reporting this. It is easy to trigger. And after a bit of
analysis, easy to fix.
self.bell is set as top.bell in searchbase.SearchDialogBase.create_widgets().
The latter is called by SDB.open(), which is called for Find, Find-again if
there is no previously defined pattern, and Find-in-files. It is not called by
Find-selection as it uses the selection as the pattern.
The bell only sounds if the selection is not found anywhere else in the editor.
if selfirst == first and sellast == last:
self.bell()
If the selection is found elsewhere, the copy is then tagged with the selection
tag, so when the original is found, the condition is not true. I consider it a
bug that the selection tag is used instead of the 'found' tag, but the above
depends on it being moved.
The purpose of creating and calling self.bell instead of top.bell is so bell
can be mocked when testing, both to detect the call and suppress noise when
testing. Binding self.bell to root.bell in __init__ instead of to top.bell in
create_widgets should work fine.
----------
stage: -> commit review
versions: +Python 3.7
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue35591>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com