diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2023-10-24 09:59:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-24 09:59:19 (GMT) |
commit | b8c20f90492f9ef2c4600e2739f8e871a31b93c3 (patch) | |
tree | 7e0fb6e73a73903d62a347039806fb9f1eb42919 /Lib/idlelib | |
parent | 81eba7645082a192c027e739b8eb99a94b4c0eec (diff) | |
download | cpython-b8c20f90492f9ef2c4600e2739f8e871a31b93c3.zip cpython-b8c20f90492f9ef2c4600e2739f8e871a31b93c3.tar.gz cpython-b8c20f90492f9ef2c4600e2739f8e871a31b93c3.tar.bz2 |
gh-97928: Change the behavior of tkinter.Text.count() (GH-98484)
It now always returns an integer if one or less counting options are specified.
Previously it could return a single count as a 1-tuple, an integer (only if
option "update" was specified) or None if no items found.
The result is now the same if wantobjects is set to 0.
Diffstat (limited to 'Lib/idlelib')
-rw-r--r-- | Lib/idlelib/sidebar.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/idlelib/sidebar.py b/Lib/idlelib/sidebar.py index fb1084d..166c043 100644 --- a/Lib/idlelib/sidebar.py +++ b/Lib/idlelib/sidebar.py @@ -25,10 +25,9 @@ def get_end_linenumber(text): def get_displaylines(text, index): """Display height, in lines, of a logical line in a Tk text widget.""" - res = text.count(f"{index} linestart", - f"{index} lineend", - "displaylines") - return res[0] if res else 0 + return text.count(f"{index} linestart", + f"{index} lineend", + "displaylines") def get_widget_padding(widget): """Get the total padding of a Tk widget, including its border.""" |