Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDLE Show completions pop-up not working on macOS #84309

Closed
darthur90 mannequin opened this issue Mar 31, 2020 · 16 comments
Closed

IDLE Show completions pop-up not working on macOS #84309

darthur90 mannequin opened this issue Mar 31, 2020 · 16 comments
Assignees
Labels
3.9 only security fixes 3.10 only security fixes 3.11 only security fixes OS-mac topic-IDLE type-bug An unexpected behavior, bug, or error

Comments

@darthur90
Copy link
Mannequin

darthur90 mannequin commented Mar 31, 2020

BPO 40128
Nosy @terryjreedy, @ronaldoussoren, @taleinat, @ned-deily, @ambv, @pablogsal, @miss-islington, @darthur90, @thsubaku9
PRs
  • bpo-40128: Fix IDLE autocomplete on macOS #26672
  • [3.9] bpo-40128: Fix IDLE autocomplete on macOS (GH-26672) #26683
  • [3.10] bpo-40128: Fix IDLE autocomplete on macOS (GH-26672) #26684
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/terryjreedy'
    closed_at = <Date 2021-06-11.23:26:00.505>
    created_at = <Date 2020-03-31.17:16:48.639>
    labels = ['OS-mac', 'type-bug', '3.9', '3.10', '3.11', 'expert-IDLE']
    title = 'IDLE Show completions pop-up not working on macOS'
    updated_at = <Date 2021-09-14.23:09:22.135>
    user = 'https://github.com/darthur90'

    bugs.python.org fields:

    activity = <Date 2021-09-14.23:09:22.135>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2021-06-11.23:26:00.505>
    closer = 'terry.reedy'
    components = ['IDLE', 'macOS']
    creation = <Date 2020-03-31.17:16:48.639>
    creator = 'darthur90'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 40128
    keywords = ['patch']
    message_count = 16.0
    messages = ['365401', '365447', '395657', '395667', '395668', '395669', '395670', '401744', '401745', '401756', '401757', '401759', '401792', '401795', '401797', '401804']
    nosy_count = 9.0
    nosy_names = ['terry.reedy', 'ronaldoussoren', 'taleinat', 'ned.deily', 'lukasz.langa', 'pablogsal', 'miss-islington', 'darthur90', 'thsubaku9']
    pr_nums = ['26672', '26683', '26684']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue40128'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    @darthur90
    Copy link
    Mannequin Author

    darthur90 mannequin commented Mar 31, 2020

    Hi,
    I am new to python, I am learning it now. In the course the guy is using autocomplete and when he writes "math." he gets an autocomplete menu. on my device for some reason it is not working. I also tried the key combination to force pop-up but nothing happens.
    I am running macOSx Catalina 10.15.2 and IDLE 3.8.2
    P.s. I reinstalled IDLE, nothing changed.

    @darthur90 darthur90 mannequin added the 3.8 only security fixes label Mar 31, 2020
    @darthur90 darthur90 mannequin assigned terryjreedy Mar 31, 2020
    @darthur90 darthur90 mannequin added topic-IDLE type-bug An unexpected behavior, bug, or error labels Mar 31, 2020
    @terryjreedy
    Copy link
    Member

    My first though was that the 'guy' had executed 'import math' and you had not. (See the IDLE doc at https://docs.python.org/3/library/idle.html or, within IDLE, Help => IDLE Help, "Editing and navigations" section, "completions' subsection, 2nd to last paragraph.) Or maybe this was another 'Catalina' issue.

    But I tried completion on my MacbookAir with Mohave 10.14.6? and 3.8.2 and 3.7.5, in Shell at >>>, that don't need imports. 'i'<tab> should bring up a box with 'id' at the top. 'int.' should bring up a box with 'as_integer_ratio' at the top. This works for me on Windows but not on the Mac.

    For shortcuts, IDLE Preferences, Keys tab, has "force_open_completions <control-key-space>". But the edit menu has "Show completions ^S". Control-S is not Control-space. Bug 1. In either case, neither work. Nor does clicking the menu entry. Bug 2. Hitting ^S causes "Edit" on the main menu to flash blue (Mac only); ^space. I believe this means that ^S invoked an item on the menu. I repeated the above with IDLE started in Terminal ('python3 -m idlelib'). No errors messages appeared.

    There are issues where shortcuts don't work, because they duplicate system binding, but menu items do. This is different.

    Is this a tkinter widget problem? Similar Toplevel popups (calltips, squeezer tooltips) work. Listbox is also used in config, config-key, and debugger dialogs, all of which at least appear.

    A debug print is autocomplete_w.py show_window reveals that it is called when it should be, including after both ^space and ^S, with what I believe are appropriate arguments. Another print in winconfig_event, just before the geometry call to move the window into view, shows that x,y position looks good. But two oddities: winconfig_event is called twice instead of once, and with ^space and not ^S. I have no idea how this could be. Adding update() just before update_idletasks() prevents the 2nd winconfig_event call but does not make the popup appear.

    I am out of ideas at the moment, except for this. Other popups are withdrawn while created and filled in, and then deiconified, while this one is moved off screen to 10000,10000 and moved back. Wondering whether tk 8.6 does not like this movement, I disabled it. The widget should then appear, but does not.

    @terryjreedy terryjreedy added 3.7 (EOL) end of life 3.9 only security fixes OS-mac labels Apr 1, 2020
    @terryjreedy terryjreedy changed the title IDLE Show completions/ autocomplete pop-up not working IDLE Show completions pop-up not working on macOS Apr 1, 2020
    @terryjreedy terryjreedy added 3.7 (EOL) end of life 3.9 only security fixes OS-mac labels Apr 1, 2020
    @terryjreedy terryjreedy changed the title IDLE Show completions/ autocomplete pop-up not working IDLE Show completions pop-up not working on macOS Apr 1, 2020
    @terryjreedy
    Copy link
    Member

    With 3.10.0b2 on my MacBook Air, completions work as far as I tested, with Edit => Show completions, Tab, and ^-Space.

    i<tab>
    i<^-Space>
    int.(configered pause)
    int.<^-Space, after dismissing box with Esc key>

    3.9.5, without the patch, remains buggy. I attribute the difference to using tcl/tk 8.6.11 in 3.10 versus 8.6.8 in 3.9 (and 3.8 and worse previously).

    3.9.5, with the patch, the above work. I will apply the patch in main and then backport because other Mac installers may have not switched to 8.6.11, I am not sure it never helps with 8.6.11, I prefer to keep active versions in sync, and it should not hurt except for a micro slowdown.

    I opened bpo-44398 for the hotkey issue.

    @terryjreedy terryjreedy added 3.10 only security fixes 3.11 only security fixes and removed 3.7 (EOL) end of life 3.8 only security fixes labels Jun 11, 2021
    @terryjreedy
    Copy link
    Member

    New changeset 3ec3ee7 by Kaustubh J in branch 'main':
    bpo-40128: Fix IDLE autocomplete on macOS (GH-26672)
    3ec3ee7

    @terryjreedy
    Copy link
    Member

    New changeset b441e99 by Miss Islington (bot) in branch '3.10':
    bpo-40128: Fix IDLE autocomplete on macOS (GH-26672)
    b441e99

    @terryjreedy
    Copy link
    Member

    New changeset a9e20cf by Miss Islington (bot) in branch '3.9':
    bpo-40128: Fix IDLE autocomplete on macOS (GH-26672)
    a9e20cf

    @terryjreedy
    Copy link
    Member

    Thank you for the fix.

    @terryjreedy
    Copy link
    Member

    Pablo (and Ned)

    PR_26672 (and backports) added one line to idlelib/autocomplete_w.py, 206 or 209.
    acw.update_idletasks() # Need for tk8.6.8 on macOS: bpo-40128.
    NEWs item included "The added update_idletask call should be harmless and possibly helpful otherwise. "

    This is consistent with https://www.tcl.tk/man/tcl8.6/TclCmd/update.html

    At the end of the PR, Tal Einat reports
    "this broke completions for me with Tcl/Tk 8.6.11 on Ubuntu 20.04.
    Apparently also with Tcl/Tk 8.6.10, which is the current default.
    Also broken in my latest install of Python 3.9.7 (not built from source)."

    Tal, did you verify that #ing the line fixes your issues? Can you be more specific as to what you see?

    I rechecked on my Macbook and the line is definitely needed for 3.9.7 with tk 8.6.8. It makes no difference for 3.10.0rc2 with 8.6.11. (So the bug of requiring update_idletasks call to ever see the dropdown box was fixed.)

    Assume Tal's report is verified on another machine, we could, before 3.10.0,

    1. Remove the line.
    2. Disable the line.
    3. Make it conditional on macOS and 8.6.8.

    It is obviously too late for 3.9.7.

    @terryjreedy
    Copy link
    Member

    @taleinat
    Copy link
    Contributor

    Confirmed with python 3.9.7 installed via the "deadsnakes" apt repo on another Ubuntu 20.04 machine.

    "Confirmed" meaning specifically that the completion window never appears, and commenting out that single line resolves the issue.

    @taleinat
    Copy link
    Contributor

    Note that _tkinter.TK_VERSION and _tkinter.TK_VERSION are simply "8.6", not enough to differentiate between patch versions. The best way to get this info appears to be tk.call("info", "patchlevel").

    Specifically I suggest:

    TK_VERSION = tuple(map(int, tk.call("info", "patchlevel").split(".")))

    ...

    if (8, 6, 8) <= TK_VERSION < (8, 6, 10):
        ...

    @taleinat
    Copy link
    Contributor

    I've created a separate issue for the completion window not appearing on Linux, issue bpo-45193. Let's move the discussion there.

    @pablogsal
    Copy link
    Member

    Thanks Terry,

    I have cherry-picked commit b441e99 to the 3.10.0 release branch!

    @taleinat
    Copy link
    Contributor

    Pablo, I'm not sure what you cherry-picked, but this fix for macOS broke the completions pop-up on Linux, and that appears to still be the state of things now on the 3.10.0 branch. Let's please not leave things this way if at all possible.

    @pablogsal
    Copy link
    Member

    Pablo, I'm not sure what you cherry-picked,

    I cherry-picked #26684

    but this can be easily undone as this is cherry-picked to the 3.10.0 release branch that I have much more control upon.

    What would you prefer me to do: undo the cherry-picking or wait for https://github.com/python/cpython/pull/28328/files ?

    Notice that this would need to be done ASAP if you want it to be in 3.10.0, otherwise will have to wait until 3.10.1

    @terryjreedy
    Copy link
    Member

    Pablo, sorry I was not clear. PR_26684 and the line it added, having been merged last June, are already in the 3.10.0rc2 release. What I want to do immediately is disable the line with a '#'. I just posted an explanation on bpo-34193. I am about to make a new PR to do so, and once it is merged and backported to 3.10 (but not 3.9), I will ask you to cherrypick it into the release branch.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes 3.10 only security fixes 3.11 only security fixes OS-mac topic-IDLE type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants