A little more cleanup in TextObjects
This commit is contained in:
parent
7953717f93
commit
82dffc5e1c
@ -224,9 +224,7 @@ class TextObject(object):
|
|||||||
self._children.sort()
|
self._children.sort()
|
||||||
|
|
||||||
|
|
||||||
#################
|
# Parsing below
|
||||||
# Parsing below #
|
|
||||||
#################
|
|
||||||
def _get_start_end(self, val, start_pos, end_pos):
|
def _get_start_end(self, val, start_pos, end_pos):
|
||||||
def _get_pos(s, pos):
|
def _get_pos(s, pos):
|
||||||
line_idx = s[:pos].count('\n')
|
line_idx = s[:pos].count('\n')
|
||||||
@ -312,6 +310,16 @@ class TextObject(object):
|
|||||||
|
|
||||||
return val
|
return val
|
||||||
|
|
||||||
|
class StartMarker(TextObject):
|
||||||
|
"""
|
||||||
|
This class only remembers it's starting position. It is used to
|
||||||
|
transform relative values into absolute position values in the vim
|
||||||
|
buffer
|
||||||
|
"""
|
||||||
|
def __init__(self, start):
|
||||||
|
end = Position(start.line, start.col)
|
||||||
|
TextObject.__init__(self, None, start, end, "")
|
||||||
|
|
||||||
|
|
||||||
class Mirror(TextObject):
|
class Mirror(TextObject):
|
||||||
"""
|
"""
|
||||||
@ -356,7 +364,6 @@ class Transformation(Mirror):
|
|||||||
return "Transformation(%s -> %s)" % (self._start, self._end)
|
return "Transformation(%s -> %s)" % (self._start, self._end)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TabStop(TextObject):
|
class TabStop(TextObject):
|
||||||
"""
|
"""
|
||||||
This is the most important TextObject. A TabStop is were the cursor
|
This is the most important TextObject. A TabStop is were the cursor
|
||||||
@ -369,11 +376,6 @@ class TabStop(TextObject):
|
|||||||
return "TabStop(%s -> %s, %s)" % (self._start, self._end,
|
return "TabStop(%s -> %s, %s)" % (self._start, self._end,
|
||||||
repr(self._current_text))
|
repr(self._current_text))
|
||||||
|
|
||||||
class StartMarker(TextObject):
|
|
||||||
def __init__(self, start):
|
|
||||||
end = Position(start.line, start.col)
|
|
||||||
TextObject.__init__(self, None, start, end, "")
|
|
||||||
|
|
||||||
class SnippetInstance(TextObject):
|
class SnippetInstance(TextObject):
|
||||||
"""
|
"""
|
||||||
A Snippet instance is an instance of a Snippet Definition. That is,
|
A Snippet instance is an instance of a Snippet Definition. That is,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user