MCPcopy
hub / github.com/SirVer/ultisnips / overwrite

Method overwrite

pythonx/UltiSnips/text_objects/base.py:114–133  ·  view source on GitHub ↗

Overwrite the text of this object in the Vim Buffer and update its length information. If 'gtext' is None use the initial text of this object.

(self, buf, gtext)

Source from the content-addressed store, hash-verified

112 self.overwrite(buf, self._initial_text)
113
114 def overwrite(self, buf, gtext):
115 """Overwrite the text of this object in the Vim Buffer and update its
116 length information.
117
118 If 'gtext' is None use the initial text of this object.
119
120 """
121 # We explicitly do not want to move our children around here as we
122 # either have non or we are replacing text initially which means we do
123 # not want to mess with their positions
124 if self.current_text == gtext:
125 return
126 old_end = self._end
127 self._end = _replace_text(buf, self._start, self._end, gtext)
128 if self._parent:
129 self._parent._child_has_moved(
130 self._parent._children.index(self),
131 min(old_end, self._end),
132 self._end.delta(old_end),
133 )
134
135 def _update(self, done, buf):
136 """Update this object inside 'buf' which is a list of lines.

Callers 9

_updateMethod · 0.80
_do_editMethod · 0.80
__setitem__Method · 0.80
_updateMethod · 0.80
_updateMethod · 0.80
_updateMethod · 0.80
_updateMethod · 0.80
_updateMethod · 0.80

Calls 3

_replace_textFunction · 0.85
_child_has_movedMethod · 0.80
deltaMethod · 0.80

Tested by

no test coverage detected