summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib
diff options
context:
space:
mode:
authorTal Einat <532281+taleinat@users.noreply.github.com>2021-05-27 14:29:55 (GMT)
committerGitHub <noreply@github.com>2021-05-27 14:29:55 (GMT)
commitabc4bd5db91c86b6b74289241378a13bd3a0a5e2 (patch)
tree6b797b315c7307a005752e7342abb900496df6f3 /Lib/idlelib
parent8cec740820fc875117bfa7b6bdb10202ebeb8fd5 (diff)
downloadcpython-abc4bd5db91c86b6b74289241378a13bd3a0a5e2.zip
cpython-abc4bd5db91c86b6b74289241378a13bd3a0a5e2.tar.gz
cpython-abc4bd5db91c86b6b74289241378a13bd3a0a5e2.tar.bz2
bpo-41611: IDLE: fix freezing on completion on macOS (GH-26400)
Diffstat (limited to 'Lib/idlelib')
-rw-r--r--Lib/idlelib/autocomplete_w.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/idlelib/autocomplete_w.py b/Lib/idlelib/autocomplete_w.py
index d3d1e69..4676822 100644
--- a/Lib/idlelib/autocomplete_w.py
+++ b/Lib/idlelib/autocomplete_w.py
@@ -247,7 +247,13 @@ class AutoCompleteWindow:
text.see(self.startindex)
x, y, cx, cy = text.bbox(self.startindex)
acw = self.autocompletewindow
- acw.update()
+ if platform.system().startswith('Windows'):
+ # On Windows an update() call is needed for the completion list
+ # window to be created, so that we can fetch its width and
+ # height. However, this is not needed on other platforms (tested
+ # on Ubuntu and macOS) but at one point began causing freezes on
+ # macOS. See issues 37849 and 41611.
+ acw.update()
acw_width, acw_height = acw.winfo_width(), acw.winfo_height()
text_width, text_height = text.winfo_width(), text.winfo_height()
new_x = text.winfo_rootx() + min(x, max(0, text_width - acw_width))