Make Snippet object available to SnippetInstance

When a Snippet object creates a SnippetInstance it should pass itself as
an argument, so that the instance can later get additional information
about the snippet.
This commit is contained in:
Aaron Schrab 2012-11-24 13:03:28 -05:00
parent 18b081b7fe
commit d4d1e86962
2 changed files with 3 additions and 3 deletions

View File

@ -416,7 +416,7 @@ class Snippet(object):
v.append(line_ind + line[tabs:])
v = '\n'.join(v)
si = SnippetInstance(parent, indent, v, start, end, visual_content,
si = SnippetInstance(self, parent, indent, v, start, end, visual_content,
last_re = self._last_re, globals = self._globals)
return si

View File

@ -15,12 +15,12 @@ class SnippetInstance(EditableTextObject):
also a TextObject because it has a start an end
"""
def __init__(self, parent, indent, initial_text, start, end, visual_content, last_re, globals):
def __init__(self, snippet, parent, indent, initial_text, start, end, visual_content, last_re, globals):
if start is None:
start = Position(0,0)
if end is None:
end = Position(0,0)
self.snippet = snippet
self._cts = 0
self.locals = {"match" : last_re}