summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKurt B. Kaiser <kbk@shore.net>2003-06-05 02:38:32 (GMT)
committerKurt B. Kaiser <kbk@shore.net>2003-06-05 02:38:32 (GMT)
commit3f8ace9a0f51ffd3f83c57d145a10d2e18751ee7 (patch)
tree041eeec48d6f78933b5e10a58332b29226200612
parentd2f4861a0b52a2af5ea3395267a5c56541352f8f (diff)
downloadcpython-3f8ace9a0f51ffd3f83c57d145a10d2e18751ee7.zip
cpython-3f8ace9a0f51ffd3f83c57d145a10d2e18751ee7.tar.gz
cpython-3f8ace9a0f51ffd3f83c57d145a10d2e18751ee7.tar.bz2
SF 747667 Error Doesn't Decolorize
Also improved error notification if Tabnanny detects a TokenError. M ScriptBinding
-rw-r--r--Lib/idlelib/ScriptBinding.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/idlelib/ScriptBinding.py b/Lib/idlelib/ScriptBinding.py
index 0e0f1ff..fa9ecbc 100644
--- a/Lib/idlelib/ScriptBinding.py
+++ b/Lib/idlelib/ScriptBinding.py
@@ -69,7 +69,10 @@ class ScriptBinding:
try:
tabnanny.process_tokens(tokenize.generate_tokens(f.readline))
except tokenize.TokenError, msg:
- self.errorbox("Token error", "Token error:\n%s" % msg)
+ msgtxt, (lineno, start) = msg
+ self.editwin.gotoline(lineno)
+ self.errorbox("Tabnanny Tokenizing Error",
+ "Token Error: %s" % msgtxt)
return False
except tabnanny.NannyNag, nag:
# The error messages from tabnanny are too confusing...
@@ -86,6 +89,8 @@ class ScriptBinding:
source = re.sub(r"\r\n", "\n", source)
if source and source[-1] != '\n':
source = source + '\n'
+ text = self.editwin.text
+ text.tag_remove("ERROR", "1.0", "end")
try:
# If successful, return the compiled code
return compile(source, filename, "exec")