summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-04-27 16:58:05 +0000
committerGeorg Brandl <georg@python.org>2009-04-27 16:58:05 +0000
commitbbde4cc9d38f71dc211425fb4b2eeb5e2e4258f4 (patch)
treee54905308aa2a653d431cc25f1d728ff859f65a5
parent830e807d374b1dced229e9828b25f5fa8a258f11 (diff)
downloadcpython-bbde4cc9d38f71dc211425fb4b2eeb5e2e4258f4.tar.gz
Merged revisions 71995 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r71995 | kurt.kaiser | 2009-04-27 01:22:11 +0200 (Mo, 27 Apr 2009) | 2 lines Right click 'go to file/line' not working if spaces in path. Bug 5559. ........
-rw-r--r--Lib/idlelib/NEWS.txt3
-rw-r--r--Lib/idlelib/OutputWindow.py35
2 files changed, 13 insertions, 25 deletions
diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt
index 2918fe5e30..9bb47ba199 100644
--- a/Lib/idlelib/NEWS.txt
+++ b/Lib/idlelib/NEWS.txt
@@ -30,6 +30,9 @@ What's New in IDLE 2.7? (UNRELEASED, but merged into 3.1 releases above.)
*Release date: XX-XXX-2009*
+- OutputWindow/PyShell right click menu "Go to file/line" wasn't working with
+ file paths containing spaces. Bug 5559.
+
- Windows: Version string for the .chm help file changed, file not being
accessed Patch 5783 Guilherme Polo
diff --git a/Lib/idlelib/OutputWindow.py b/Lib/idlelib/OutputWindow.py
index 0782eaf7e8..5a15873bae 100644
--- a/Lib/idlelib/OutputWindow.py
+++ b/Lib/idlelib/OutputWindow.py
@@ -58,6 +58,7 @@ class OutputWindow(EditorWindow):
r'file "([^"]*)", line (\d+)',
r'([^\s]+)\((\d+)\)',
r'([^\s]+):\s*(\d+):',
+ r'^\s*(\S+.*?):\s*(\d+):', # Win path with spaces, trim leading spaces
]
file_line_progs = None
@@ -91,17 +92,17 @@ class OutputWindow(EditorWindow):
def _file_line_helper(self, line):
for prog in self.file_line_progs:
- m = prog.search(line)
- if m:
- break
+ match = prog.search(line)
+ if match:
+ filename, lineno = match.group(1, 2)
+ try:
+ f = open(filename, "r")
+ f.close()
+ break
+ except IOError:
+ continue
else:
return None
- filename, lineno = m.group(1, 2)
- try:
- f = open(filename, "r")
- f.close()
- except IOError:
- return None
try:
return filename, int(lineno)
except TypeError:
@@ -134,19 +135,3 @@ class OnDemandOutputWindow:
text.tag_configure(tag, **cnf)
text.tag_raise('sel')
self.write = self.owin.write
-
-#class PseudoFile:
-#
-# def __init__(self, owin, tags, mark="end"):
-# self.owin = owin
-# self.tags = tags
-# self.mark = mark
-
-# def write(self, s):
-# self.owin.write(s, self.tags, self.mark)
-
-# def writelines(self, l):
-# map(self.write, l)
-
-# def flush(self):
-# pass