def do_edit(self, arg):
"Open an editor visiting the current file at the current line"
if arg == '':
filename, lineno = self._get_current_position()
else:
filename, lineno, _ = self._get_position_of_arg(arg)
if filename is None:
return
# this case handles code generated with py.code.Source()
# filename is something like '<0-codegen foo.py:18>'
match = re.match(r'.*<\d+-codegen (.*):(\d+)>', filename)
if match:
filename = match.group(1)
lineno = int(match.group(2))
editor = self.config.editor
self._open_editor(editor, lineno, filename)
评论列表
文章目录