bpo-37530: simplify, optimize and clean up IDLE code context#14675
Conversation
* Only create CodeContext instances for "real" editors windows, but not e.g. shell or output windows. * Remove configuration update Tk event fired every second, by having the editor window ask its code context widget to update when necessary, i.e. upon font or highlighting updates. * When code context isn't being shown, avoid having a Tk event fired every 100ms to check whether the code context needs to be updated. * Use the editor window's getlineno() method where applicable. * Fix a bare "except:"
|
I've tested this on Windows, macOS and Ubuntu Linux. Seems working well. @terryjreedy, would you like a NEWS entry for this? |
An update loop is only needed for an active editor with code context, rather all editors with such. Whatever this PR does not do (have not read details yet) can be another PR. |
|
|
Then I will look at this this evening. |
terryjreedy
left a comment
There was a problem hiding this comment.
I added a sentence to blurb. Edit if you want. Please merge and update line number patch.
After adding line numbers, we might want to experiment with the order in which changes are applied. See example.
|
I presume you are working on fixing test_font. It might be doing more than is needed, such as restoring the font of the temporary text instance. Travis also had an unrelated doctest failure. I will open a new issue for that if not one already. |
|
Thanks @taleinat for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8. |
…H-14675) * Only create CodeContext instances for "real" editors windows, but not e.g. shell or output windows. * Remove configuration update Tk event fired every second, by having the editor window ask its code context widget to update when necessary, i.e. upon font or highlighting updates. * When code context isn't being shown, avoid having a Tk event fired every 100ms to check whether the code context needs to be updated. * Use the editor window's getlineno() method where applicable. * Update font of the code context widget before the main text widget (cherry picked from commit 7036e1d) Co-authored-by: Tal Einat <taleinat@gmail.com>
|
GH-14807 is a backport of this pull request to the 3.8 branch. |
…H-14675) * Only create CodeContext instances for "real" editors windows, but not e.g. shell or output windows. * Remove configuration update Tk event fired every second, by having the editor window ask its code context widget to update when necessary, i.e. upon font or highlighting updates. * When code context isn't being shown, avoid having a Tk event fired every 100ms to check whether the code context needs to be updated. * Use the editor window's getlineno() method where applicable. * Update font of the code context widget before the main text widget (cherry picked from commit 7036e1d) Co-authored-by: Tal Einat <taleinat@gmail.com>
|
GH-14808 is a backport of this pull request to the 3.7 branch. |
Done. |
* Only create CodeContext instances for "real" editors windows, but not e.g. shell or output windows. * Remove configuration update Tk event fired every second, by having the editor window ask its code context widget to update when necessary, i.e. upon font or highlighting updates. * When code context isn't being shown, avoid having a Tk event fired every 100ms to check whether the code context needs to be updated. * Use the editor window's getlineno() method where applicable. * Update font of the code context widget before the main text widget (cherry picked from commit 7036e1d) Co-authored-by: Tal Einat <taleinat@gmail.com>
* Only create CodeContext instances for "real" editors windows, but not e.g. shell or output windows. * Remove configuration update Tk event fired every second, by having the editor window ask its code context widget to update when necessary, i.e. upon font or highlighting updates. * When code context isn't being shown, avoid having a Tk event fired every 100ms to check whether the code context needs to be updated. * Use the editor window's getlineno() method where applicable. * Update font of the code context widget before the main text widget (cherry picked from commit 7036e1d) Co-authored-by: Tal Einat <taleinat@gmail.com>
…H-14675) * Only create CodeContext instances for "real" editors windows, but not e.g. shell or output windows. * Remove configuration update Tk event fired every second, by having the editor window ask its code context widget to update when necessary, i.e. upon font or highlighting updates. * When code context isn't being shown, avoid having a Tk event fired every 100ms to check whether the code context needs to be updated. * Use the editor window's getlineno() method where applicable. * Update font of the code context widget before the main text widget
…H-14675) * Only create CodeContext instances for "real" editors windows, but not e.g. shell or output windows. * Remove configuration update Tk event fired every second, by having the editor window ask its code context widget to update when necessary, i.e. upon font or highlighting updates. * When code context isn't being shown, avoid having a Tk event fired every 100ms to check whether the code context needs to be updated. * Use the editor window's getlineno() method where applicable. * Update font of the code context widget before the main text widget
…H-14675) * Only create CodeContext instances for "real" editors windows, but not e.g. shell or output windows. * Remove configuration update Tk event fired every second, by having the editor window ask its code context widget to update when necessary, i.e. upon font or highlighting updates. * When code context isn't being shown, avoid having a Tk event fired every 100ms to check whether the code context needs to be updated. * Use the editor window's getlineno() method where applicable. * Update font of the code context widget before the main text widget
CodeContextinstances for "real" editors windows, but not e.g. shell or output windows.getlineno()method where applicable.except:.https://bugs.python.org/issue37530