Issue 805830: Highlight builtins - Python tracker (original) (raw)

Created on 2003-09-14 01:29 by fisheggs, last changed 2022-04-10 16:11 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
idlefork-builtin.patch fisheggs,2003-09-14 01:29
Messages (9)
msg44624 - (view) Author: Nigel Rowe (fisheggs) Date: 2003-09-14 01:29
There was a recent discussion on c.l.p regarding shadowing builtins. (Summary, DONT). The point was made that decent editors should highlight builtins and keywords. The attached patch enables hightlighting of all entries in __builtin__ excluding those starting with a '_'
msg44625 - (view) Author: Kurt B. Kaiser (kbk) * (Python committer) Date: 2004-03-08 18:33
Logged In: YES user_id=149084 Thanks for the patch! This also implemented a fix for IDLEfork bug [ 693418 ] Normal text background color not refreshed which is a significant contribution! Add a highlight theme for builtin keywords. Python Patch 805830 Nigel Rowe M ClassBrowser.py 1.8 M ColorDelegator.py 1.13 M EditorWindow.py 1.56 M NEWS.txt 1.31 M PyShell.py 1.87 M TreeWidget.py 1.9 M config-highlight.def 1.8 M configDialog.py 1.57 M configHandler.py 1.34
msg44626 - (view) Author: Kurt B. Kaiser (kbk) * (Python committer) Date: 2004-03-08 20:51
Logged In: YES user_id=149084 This also fixed Python [897872 ] Unknown color name on HP-UX
msg44627 - (view) Author: Kurt B. Kaiser (kbk) * (Python committer) Date: 2004-03-11 03:18
Logged In: YES user_id=149084 There's bug in the patch: if a builtin keyword is typed after a ' or " (without an intervening space), the comment attribute is removed from the quote and the rest of the line is colorized as if it were not quoted. ## builtin = r"([^\\.]\b|^)" + any("BUILTIN", builtinlist) + r"\b" builtin = r"\b" + any("BUILTIN", builtinlist) + r"\b" seems to fix the symptom but the original obviously had a purpose (which I've been unable to decipher).
msg44628 - (view) Author: Nigel Rowe (fisheggs) Date: 2004-03-11 04:42
Logged In: YES user_id=756090 The purpose of the r"([^\\.]\b|^)" is to prevent member vars with the same name as a builtin from being colorised. ie given self.file=file(filename) only the second 'file' should be colorised as the first one is NOT shadowing the builtin. However, you are quite right WRT the quoting bug. Changeing the r"([^\\.]\b ^)" to r"([^\\.'\"]\b ^)" seems to fix it so that self.file = file("file") is colorised correctly. Ie the first 'file' is in Normal color, the second is in Builtins color and the third is in Strings color. -- Nigel
msg44629 - (view) Author: Nigel Rowe (fisheggs) Date: 2004-03-11 04:44
Logged In: YES user_id=756090 Damm that word wrap!! -- Nigel
msg44630 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2004-03-13 21:24
Logged In: YES user_id=80475 Can this be closed? This or something like it is already in. FWIW, the barney purple made the code harder to read rather that easier. I immediately switched to a color (drk brown) that was closer to the black used for surrounding text -- that gave some differentiation without being distracting.
msg44631 - (view) Author: Kurt B. Kaiser (kbk) * (Python committer) Date: 2004-03-15 04:37
Logged In: YES user_id=149084 I don't understand why SF doesn't fix it. It's a real aggravation for everyone. Gotta be trivial. Thanks for the fix! ColorDelegator 1.14
msg44632 - (view) Author: Kurt B. Kaiser (kbk) * (Python committer) Date: 2004-03-16 03:50
Logged In: YES user_id=149084 Raymond must have a traumatic experience in his past. I muted the barney purple to royal purple. Don't blame Nigel Rowe, he used brown! I'm trying to keep the colors bright in the default scheme as I've seen comments that people like it that way. Maybe we need another scheme, say "Big Muddy" or "Arizona". But the config system just proved its worth :-) You don't like it, change it.
History
Date User Action Args
2022-04-10 16:11:09 admin set github: 39230
2003-09-14 01:29:46 fisheggs create