Skip to content

Commit 5997c03

Browse files
committed
bpo-43654: IDLE: fix config disabling tab completion
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 <[email protected]>
1 parent 4e2e5c1 commit 5997c03

File tree

4 files changed

+11
-18
lines changed

4 files changed

+11
-18
lines changed

Lib/idlelib/config-keys.def

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ find-in-files=<Alt-Key-F3> <Meta-Key-F3>
4444
find-selection=<Control-Key-F3>
4545
replace=<Control-Key-h> <Control-Key-H>
4646
goto-line=<Alt-Key-g> <Meta-Key-g> <Alt-Key-G> <Meta-Key-G>
47-
smart-backspace=<Key-BackSpace>
48-
newline-and-indent=<Key-Return> <Key-KP_Enter>
49-
smart-indent=<Key-Tab>
5047
indent-region=<Control-Key-bracketright>
5148
dedent-region=<Control-Key-bracketleft>
5249
comment-region=<Alt-Key-3> <Meta-Key-3>
@@ -104,9 +101,6 @@ find-in-files=<Alt-Key-s> <Meta-Key-s>
104101
find-selection=<Control-Key-s>
105102
replace=<Control-Key-r>
106103
goto-line=<Alt-Key-g> <Meta-Key-g>
107-
smart-backspace=<Key-BackSpace>
108-
newline-and-indent=<Key-Return> <Key-KP_Enter>
109-
smart-indent=<Key-Tab>
110104
indent-region=<Control-Key-bracketright>
111105
dedent-region=<Control-Key-bracketleft>
112106
comment-region=<Alt-Key-3>
@@ -164,9 +158,6 @@ find-in-files = <Control-Shift-Key-f>
164158
find-selection = <Control-Key-h>
165159
replace = <Control-Key-r>
166160
goto-line = <Control-Key-g>
167-
smart-backspace = <Key-BackSpace>
168-
newline-and-indent = <Key-Return> <Key-KP_Enter>
169-
smart-indent = <Key-Tab>
170161
indent-region = <Control-Key-bracketright>
171162
dedent-region = <Control-Key-bracketleft>
172163
comment-region = <Control-Key-d>
@@ -224,9 +215,6 @@ find-in-files=<Command-Key-F3>
224215
find-selection=<Shift-Command-Key-F3>
225216
replace=<Command-Key-r>
226217
goto-line=<Command-Key-j>
227-
smart-backspace=<Key-BackSpace>
228-
newline-and-indent=<Key-Return> <Key-KP_Enter>
229-
smart-indent=<Key-Tab>
230218
indent-region=<Command-Key-bracketright>
231219
dedent-region=<Command-Key-bracketleft>
232220
comment-region=<Control-Key-3>
@@ -271,10 +259,8 @@ find-again = <Command-Key-g> <Key-F3>
271259
find = <Command-Key-f>
272260
toggle-auto-coloring = <Control-Key-slash>
273261
select-all = <Command-Key-a>
274-
smart-backspace = <Key-BackSpace>
275262
change-indentwidth = <Control-Key-u>
276263
do-nothing = <Control-Key-F12>
277-
smart-indent = <Key-Tab>
278264
center-insert = <Control-Key-l>
279265
history-next = <Control-Key-n>
280266
del-word-right = <Option-Key-Delete>
@@ -288,7 +274,6 @@ copy = <Command-Key-c>
288274
paste = <Command-Key-v>
289275
indent-region = <Command-Key-bracketright>
290276
del-word-left = <Option-Key-BackSpace> <Option-Command-Key-BackSpace>
291-
newline-and-indent = <Key-Return> <Key-KP_Enter>
292277
end-of-file = <Control-Key-d>
293278
open-class-browser = <Command-Key-b>
294279
open-new-window = <Command-Key-n>

Lib/idlelib/config.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -634,9 +634,6 @@ def GetCoreKeys(self, keySetName=None):
634634
'<<find>>': ['<Control-f>'],
635635
'<<replace>>': ['<Control-h>'],
636636
'<<goto-line>>': ['<Alt-g>'],
637-
'<<smart-backspace>>': ['<Key-BackSpace>'],
638-
'<<newline-and-indent>>': ['<Key-Return>', '<Key-KP_Enter>'],
639-
'<<smart-indent>>': ['<Key-Tab>'],
640637
'<<indent-region>>': ['<Control-Key-bracketright>'],
641638
'<<dedent-region>>': ['<Control-Key-bracketleft>'],
642639
'<<comment-region>>': ['<Alt-Key-3>'],

Lib/idlelib/editor.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,12 @@ def __init__(self, flist=None, filename=None, key=None, root=None):
299299
self.askyesno = messagebox.askyesno
300300
self.showerror = messagebox.showerror
301301

302+
# Bind keys to pseudoevents for non-configurable key-specific handlers.
303+
text.event_add('<<smart-backspace>>', '<Key-BackSpace>')
304+
text.event_add('<<newline-and-indent>>',
305+
'<Key-Return>', '<Key-KP_Enter>')
306+
text.event_add('<<smart-indent>>', '<Key-Tab>')
307+
302308
# Add pseudoevents for former extension fixed keys.
303309
# (This probably needs to be done once in the process.)
304310
text.event_add('<<autocomplete>>', '<Key-Tab>')
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Fix the config dialog breaking tab completion. This is achieved by removing
2+
the key configuration options for ``<<smart-indent>>`` (Tab),
3+
``<<newline-and-indent>>`` (Return, Enter) and ``<<smart-backspace>>``
4+
(Backspace) from the configuration mechanism, making them hard-coded
5+
instead.

0 commit comments

Comments
 (0)