Skip to content

gh-87820: IDLE: fix config disabling tab completion - #26421

Open
taleinat wants to merge 2 commits into
python:mainfrom
taleinat:bpo-43654/IDLE-fix-config-disabling-tab-completion-take2
Open

taleinat wants to merge 2 commits into
python:mainfrom
taleinat:bpo-43654/IDLE-fix-config-disabling-tab-completion-take2

Conversation

@taleinat

@taleinat taleinat commented May 28, 2021 •

Copy link
Copy Markdown
Contributor

(Alternative PR to GH-26403.)

The underlying issue causing tab-completion to be broken after using the config dialog: Two events are bound to <Key-Tab>: <<smart-indent>> and <<autocomplete>>. The order these are bound is important: The binding to <<autocomplete>> must be done last so that it will be invoked first. The current bug is that <<smart-indent>> is unbound and then bound again by the config dialog, which changes the order and breaks tab-completion.

This PR removes three key bindings from the key configuration mechanism, which are required to always be bound to specific keys for IDLE to behave properly:

  • '<<smart-backspace>>': ['<Key-BackSpace>']
  • '<<newline-and-indent>>': ['<Key-Return>', '<Key-KP_Enter>']
  • '<<smart-indent>>': ['<Key-Tab>']

I manually verified that having a config-keys.cfg file in .idlerc with those keys defined in it doesn't cause any issues after this change is made. (IdleConf.GetCoreKeys() is written in a way that ensures this.)

This removes three key bindings from the key
configuration mechanism, which are required to
always be bound to specific keys for IDLE to
behave properly:

* '<<smart-backspace>>': ['<Key-BackSpace>'],
* '<<newline-and-indent>>': ['<Key-Return>', '<Key-KP_Enter>'],
* '<<smart-indent>>': ['<Key-Tab>'],

Signed-off-by: Tal Einat <532281+taleinat@users.noreply.github.com>

@terryjreedy terryjreedy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to merge the code and .def changes as are but am not quite sure that we should. See comment on the issue.

Comment thread Lib/idlelib/editor.py
Comment on lines +302 to +303
# Bind keys to pseudoevents for non-configurable key-specific handlers.
text.event_add('<<smart-backspace>>', '<Key-BackSpace>')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only function reason to keep these fixed keys separate from those that follow is that the pseudoevent -- handler bindings are done above for these and below for the existing fixed key keys. And this is related to where the handler are defined. So keep the separation for now.

Comment thread Misc/NEWS.d/next/IDLE/2021-05-28-09-28-45.bpo-43654.WYsKKG.rst
@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Jul 3, 2021
@ambv

ambv commented May 17, 2022

Copy link
Copy Markdown
Contributor

This missed the boat for inclusion in Python 3.9 which accepts security fixes only as of today.

@serhiy-storchaka serhiy-storchaka added the needs backport to 3.11 only security fixes label May 20, 2022
@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Aug 9, 2022
@terryjreedy terryjreedy self-assigned this Sep 18, 2022
@terryjreedy terryjreedy changed the title bpo-43654: IDLE: fix config disabling tab completion gh-87820: IDLE: fix config disabling tab completion Sep 18, 2022
@terryjreedy terryjreedy removed the type-bug An unexpected behavior, bug, or error label Sep 18, 2022
@hugovk hugovk removed the needs backport to 3.10 only security fixes label Apr 7, 2023
@serhiy-storchaka serhiy-storchaka added needs backport to 3.12 only security fixes needs backport to 3.13 bugs and security fixes and removed needs backport to 3.11 only security fixes labels May 9, 2024
@tomasr8 tomasr8 removed the needs backport to 3.12 only security fixes label Apr 10, 2025
@python-cla-bot

python-cla-bot Bot commented Apr 18, 2025 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@serhiy-storchaka serhiy-storchaka added the needs backport to 3.14 bugs and security fixes label May 8, 2025
@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 9, 2026
@serhiy-storchaka serhiy-storchaka added the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label May 30, 2026
@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Jun 4, 2026
@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Sep 6, 2026
@python python deleted a comment from github-actions Bot Sep 26, 2026
@python python deleted a comment from github-actions Bot Sep 26, 2026
@python python deleted a comment from github-actions Bot Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes stale Stale PR or inactive for long period of time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants