| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead. |
Sorry, something went wrong.
There was a problem hiding this comment.
All new features need tests. Please add one to test_tkinter.
Sorry, something went wrong.
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
|
Thanks! Shoot for the stars :) |
Sorry, something went wrong.
Sorry, something went wrong.
Added tests for text.search with and without regex.
Refactor test_search_all to simplify assertions and update overlap checks.
|
@serhiy-storchaka Ready for review |
Sorry, something went wrong.
|
GH-141669 is a backport of this pull request to the 3.14 branch. |
Sorry, something went wrong.
|
Thank you for your contribution, @sharktide. I rewrote the tests, so they clearly test the new options, and added many tests for already supported options. These tests will be backported. |
Sorry, something went wrong.
…honGH-130848) (pythonGH-141669) (cherry picked from commit 8db1aad) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
…honGH-130848) * Add parameters nolinestop and strictlimits in the tkinter.Text.search() method. * Add the tkinter.Text.search_all() method. * Add more tests for tkinter.Text.search(). * stopindex is now only ignored if it is None.
| Back | FazBrowse Home | New Git URL |
Add options -nolinestop, -all, -overlap, and -strictlimits to the search function of the text class of tkinter.
Fixes #130693
Closes #130693
Tested against
And test passed. Result:
Also tested against a custom test file:
[EDITED for change to new search_all method for -all and -overlap]
import tkinter as tk root = tk.Tk() text = tk.Text(root) text.pack() text.insert('1.0', 'This is a test. This is only a test.\nAnother line.\nYet another line.') # Test without options result = text.search('test', '1.0', 'end') print('Without options:', result) # Test with -nolinestop result = text.search('line', '1.0', 'end', nolinestop=True, regexp=True) print('With -nolinestop:', result) # Test with search_all result = text.search_all('test', '1.0', 'end') print('With search_all:', result) # Test with -overlap result = text.search_all('test', '1.0', 'end', overlap=True) print('With -overlap:', result) # Test with -strictlimits result = text.search('test', '1.0', 'end', strictlimits=True) print('With -strictlimits:', result) root.mainloop()Which returns:
Indicating that the new features are functioning correctly