-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
bpo-27099: IDLE - Convert built-in extensions to regular features #2494
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
Changes from all commits
5c57faf
d49170f
8c3a966
757bb38
d7e136c
b178af5
2adebb9
86c3d4c
1c246fc
0418ad0
097a0d8
4232e77
a7b29f5
e30b7b4
252672b
999b573
1a74591
3501c45
232f711
f095c53
a661bfa
5c90a8f
5a6a007
709b434
b9b1f9a
8b76ccb
b986c12
f86acaa
5805462
165b548
aee5d02
cb161bd
dc09a2b
100463e
3fbaa90
60ff82f
e3f6f16
a253f0c
fe8eb7a
caa7774
c29184e
c62f726
d0e009f
9e889c2
6afdea3
7de27db
a2e76a7
2265b53
03eed24
207b0ca
00acd22
2d2bfbd
fe76cd3
d2966e0
6845bb0
b7afebb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,23 +10,13 @@ | |
place before requesting the next selection causes AutoExpand to reset | ||
its state. | ||
|
||
This is an extension file and there is only one instance of AutoExpand. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leave 'There is only one instance of AutoExpand'. |
||
There is only one instance of Autoexpand. | ||
''' | ||
import re | ||
import string | ||
|
||
###$ event <<expand-word>> | ||
###$ win <Alt-slash> | ||
###$ unix <Alt-slash> | ||
|
||
class AutoExpand: | ||
|
||
menudefs = [ | ||
('edit', [ | ||
('E_xpand Word', '<<expand-word>>'), | ||
]), | ||
] | ||
|
||
wordchars = string.ascii_letters + string.digits + "_" | ||
|
||
def __init__(self, editwin): | ||
|
@@ -100,6 +90,7 @@ def getprevword(self): | |
i = i-1 | ||
return line[i:] | ||
|
||
|
||
if __name__ == '__main__': | ||
import unittest | ||
unittest.main('idlelib.idle_test.test_autoexpand', verbosity=2) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,25 @@ | ||
# config-extensions.def | ||
# | ||
# The following sections are for features that are no longer extensions. | ||
# Their options values are left here for back-compatibility. | ||
|
||
[AutoComplete] | ||
popupwait= 2000 | ||
|
||
[CodeContext] | ||
numlines= 3 | ||
visible= False | ||
bgcolor= LightGray | ||
fgcolor= Black | ||
|
||
[FormatParagraph] | ||
max-width= 72 | ||
|
||
[ParenMatch] | ||
style= expression | ||
flash-delay= 500 | ||
bell= True | ||
|
||
# IDLE reads several config files to determine user preferences. This | ||
# file is the default configuration file for IDLE extensions settings. | ||
# | ||
|
@@ -19,7 +39,7 @@ | |
# extension that may be sensibly re-configured. | ||
# | ||
# If there are no keybindings for a menus' virtual events, include lines | ||
# like <<toggle-code-context>>= (See [CodeContext], below.) | ||
# like <<toggle-code-context>>=. | ||
# | ||
# Currently it is necessary to manually modify this file to change | ||
# extension key bindings and default values. To customize, create | ||
|
@@ -32,68 +52,14 @@ | |
# See config-keys.def for notes on specifying keys and extend.txt for | ||
# information on creating IDLE extensions. | ||
|
||
[AutoComplete] | ||
enable=True | ||
popupwait=2000 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I said and explained on the issue, I want to leave non-key options in config-extensions. So the 4 non-trivial [Xtension] sections should stay. For former extensions, I would like to drop the requirement for an enable option when the entry is read in the editor. Then we can delete the enable items. I believe that this will be back-compatible with existing custom enable settings, but must verify. (Ditto for not requiring some binding section.) As I said yesterday, I now think the [Xtension_cfgBindings] should go, to be replaced by new entries in keysets. This will require some change in IdleConf to deal better with missing entries in custom keysets. But this was already needed, and perhaps should be a separate preliminary patch. I think putting non-configurable key bindings in configuration files was a bit of a mistake. In any case, these binding should be hard coded in the appropriate place. At minimum, 'x_keys = idleConf(...)' should be replaced by 'x_keys = (current-idleconf-return). |
||
[AutoComplete_cfgBindings] | ||
force-open-completions=<Control-Key-space> | ||
[AutoComplete_bindings] | ||
autocomplete=<Key-Tab> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The '_bindings' entries had two effects:
I decided to put all event_adds in EditorWindow for now. I believe they only need to be called once in the process, not once for every window, but must check and then decide where to put them. |
||
try-open-completions=<KeyRelease-period> <KeyRelease-slash> <KeyRelease-backslash> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here you accomplished effect 1 above, |
||
|
||
[AutoExpand] | ||
enable=True | ||
[AutoExpand_cfgBindings] | ||
expand-word=<Alt-Key-slash> | ||
|
||
[CallTips] | ||
enable=True | ||
[CallTips_cfgBindings] | ||
force-open-calltip=<Control-Key-backslash> | ||
[CallTips_bindings] | ||
try-open-calltip=<KeyRelease-parenleft> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto. |
||
refresh-calltip=<KeyRelease-parenright> <KeyRelease-0> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs event_add. |
||
|
||
[CodeContext] | ||
enable=True | ||
enable_shell=False | ||
numlines=3 | ||
visible=False | ||
bgcolor=LightGray | ||
fgcolor=Black | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep |
||
[CodeContext_bindings] | ||
toggle-code-context= | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The is a dummy line as there is not key to associate with a virtual event. |
||
|
||
[FormatParagraph] | ||
enable=True | ||
max-width=72 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep |
||
[FormatParagraph_cfgBindings] | ||
format-paragraph=<Alt-Key-q> | ||
|
||
[ParenMatch] | ||
enable=True | ||
style= expression | ||
flash-delay= 500 | ||
bell=True | ||
[ParenMatch_cfgBindings] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep. |
||
flash-paren=<Control-Key-0> | ||
[ParenMatch_bindings] | ||
paren-closed=<KeyRelease-parenright> <KeyRelease-bracketright> <KeyRelease-braceright> | ||
|
||
[RstripExtension] | ||
enable=True | ||
enable_shell=False | ||
enable_editor=True | ||
|
||
[ScriptBinding] | ||
enable=True | ||
enable_shell=False | ||
enable_editor=True | ||
[ScriptBinding_cfgBindings] | ||
run-module=<Key-F5> | ||
check-module=<Alt-Key-x> | ||
|
||
[ZoomHeight] | ||
enable=True | ||
[ZoomHeight_cfgBindings] | ||
zoom-height=<Alt-Key-2> | ||
# A fake extension for testing and example purposes. When enabled and | ||
# invoked, inserts or deletes z-text at beginning of every line. | ||
[ZzDummy] | ||
enable= True | ||
enable_shell = False | ||
enable_editor = True | ||
z-text= Z | ||
[ZzDummy_cfgBindings] | ||
z-in= <Control-Shift-KeyRelease-Insert> | ||
[ZzDummy_bindings] | ||
z-out= <Control-Shift-KeyRelease-Delete> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you move this? Although another issue, really, I can see moving within init to have changes take effect sooner, why make it conditional?