Repository navigation
bpo-37903: IDLE: Shell sidebar with prompts (take #2) #22682
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 1 commit
7adb9ad
26bbaec
9076da5
cad2cd1
4040e26
9b31031
37a0db3
c766822
50bd082
6f186f0
f7f3de9
e929ea7
d04bfa3
81f4852
46be85e
1fc4bcb
6f1c975
083fede
4ad72a1
009e08d
e524cce
3ea2986
7f9182f
10aaf1d
7c91901
50ca9c6
23c218f
6cef0a9
a018135
525fe44
7b8913d
8c8d0c0
7ecc843
bedb1cb
eee0453
7afcb57
8a7dd60
6efb968
cc37924
97576da
2aa4e1a
71f343e
45e66a5
dbe931c
779adc4
8f81915
ddc0026
d1e0d32
0516db9
afa6669
9d06f26
73146fb
19b16a4
ecab884
7b2d9dc
d6e35cc
f6c9a7c
990cef4
e86353b
a1891a4
3e52c5d
cc709ab
093544a
474c11a
fde793a
916e0d3
8ada0a7
c1871f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
This avoids ColorDelegator removing unrelated tags, specifically "stdin", when re-colorizing.
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -266,7 +266,7 @@ def __init__(self, flist=None, filename=None, key=None, root=None): | |
| io.set_filename_change_hook(self.filename_change_hook) | ||
| self.good_load = False | ||
| self.set_indentation_params(False) | ||
| self.color = None # initialized below in self.ResetColorizer | ||
| self.color = None # initialized below in self.update_colors() | ||
| self.code_context = None # optionally initialized later below | ||
| self.line_numbers = None # optionally initialized later below | ||
| if filename: | ||
|
|
@@ -279,7 +279,7 @@ def __init__(self, flist=None, filename=None, key=None, root=None): | |
| io.set_filename(filename) | ||
| self.good_load = True | ||
|
|
||
| self.ResetColorizer() | ||
| self.update_colors() | ||
| self.saved_change_hook() | ||
| self.update_recent_files_list() | ||
| self.load_extensions() | ||
|
|
@@ -792,18 +792,40 @@ def _rmcolorizer(self): | |
| self.color = None | ||
|
|
||
| def ResetColorizer(self): | ||
| "Update the color theme" | ||
| # Called from self.filename_change_hook and from configdialog.py | ||
| """Reset the syntax colorizer. | ||
|
Member
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 appears to be an unrelated refactoring that should have been and should be a separate issue and review. The effect is to call color_config before instead of after self._addcolorizer. Assuming that this is an improvement, which should be tested or explained in the separate issue, this can be done without splitting into two functions. While being edited, change the name to reset_colorizer or maybe better reset_colors.
Contributor
Author
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. Yes, you're right. I'll make the changes you suggest in a separate PR.
Contributor
Author
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. I've reverted this change. It is no longer necessary given the addition of (No other PR is necessary, other than for cleanup and renaming, which I'm going to postpone for now.) |
||
|
|
||
| For example, this is called after filename changes, since the file | ||
| type can affect the highlighting. | ||
| """ | ||
| self._rmcolorizer() | ||
| self._addcolorizer() | ||
|
|
||
| def update_colors(self): | ||
| """Update the color theme. | ||
|
|
||
| For example, this is called after highlighting config changes. | ||
| """ | ||
| EditorWindow.color_config(self.text) | ||
|
|
||
| tag_colors = self.get_tag_colors() | ||
| for tag, tag_colors_config in tag_colors.items(): | ||
| self.text.tag_configure(tag, **tag_colors_config) | ||
|
|
||
| self.ResetColorizer() | ||
|
|
||
| if self.code_context is not None: | ||
| self.code_context.update_highlight_colors() | ||
|
|
||
| if self.line_numbers is not None: | ||
| self.line_numbers.update_colors() | ||
|
|
||
| def get_tag_colors(self): | ||
| theme = idleConf.CurrentTheme() | ||
| return { | ||
| # The following is used by ReplaceDialog: | ||
| "hit": idleConf.GetHighlight(theme, "hit"), | ||
| } | ||
|
|
||
| IDENTCHARS = string.ascii_letters + string.digits + "_" | ||
|
|
||
| def colorize_syntax_error(self, text, pos): | ||
|
|
||
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.
These unrelated format and comment changes, including the unused import removal in editor.py and anything else similar, should have been and still should be done separately.