Support for selection=old.
This commit is contained in:
commit
f2d9e8b608
@ -1401,6 +1401,8 @@ individuals have contributed to UltiSnips (in chronological order):
|
|||||||
Ches Martin - ches
|
Ches Martin - ches
|
||||||
Christian - Oberon00
|
Christian - Oberon00
|
||||||
Andrew Ruder - aeruder
|
Andrew Ruder - aeruder
|
||||||
|
Mathias Fußenegger - mfussenegger
|
||||||
|
|
||||||
|
|
||||||
Thank you for your support.
|
Thank you for your support.
|
||||||
|
|
||||||
|
@ -118,8 +118,6 @@ def select(start, end):
|
|||||||
_unmap_select_mode_mapping()
|
_unmap_select_mode_mapping()
|
||||||
|
|
||||||
selection = eval("&selection")
|
selection = eval("&selection")
|
||||||
if "old" in selection:
|
|
||||||
raise RuntimeError("selection=old does not work with UltiSnips :(.")
|
|
||||||
|
|
||||||
col = col2byte(start.line + 1, start.col)
|
col = col2byte(start.line + 1, start.col)
|
||||||
vim.current.window.cursor = start.line + 1, col
|
vim.current.window.cursor = start.line + 1, col
|
||||||
@ -143,6 +141,8 @@ def select(start, end):
|
|||||||
move_cmd += "%iG$" % end.line
|
move_cmd += "%iG$" % end.line
|
||||||
else:
|
else:
|
||||||
move_cmd += "%iG%i|" % virtual_position(end.line + 1, end.col)
|
move_cmd += "%iG%i|" % virtual_position(end.line + 1, end.col)
|
||||||
|
elif "old" in selection:
|
||||||
|
move_cmd += "%iG%i|" % virtual_position(end.line + 1, end.col)
|
||||||
else:
|
else:
|
||||||
move_cmd += "%iG%i|" % virtual_position(end.line + 1, end.col + 1)
|
move_cmd += "%iG%i|" % virtual_position(end.line + 1, end.col + 1)
|
||||||
move_cmd += "o%iG%i|o\\<c-g>" % virtual_position(
|
move_cmd += "o%iG%i|o\\<c-g>" % virtual_position(
|
||||||
|
21
test.py
21
test.py
@ -3134,6 +3134,27 @@ class ExclusiveSelection_RealWorldCase_Test(_ES_Base):
|
|||||||
// code
|
// code
|
||||||
}"""
|
}"""
|
||||||
# End: Exclusive Selection #}}}
|
# End: Exclusive Selection #}}}
|
||||||
|
|
||||||
|
# Old Selection {{{#
|
||||||
|
class _OS_Base(_VimTest):
|
||||||
|
def _extra_options_pre_init(self, vim_config):
|
||||||
|
vim_config.append("set selection=old")
|
||||||
|
class OldSelection_SimpleTabstop_Test(_OS_Base):
|
||||||
|
snippets =("test", "h${1:blah}w $1")
|
||||||
|
keys = "test" + EX + "ui" + JF
|
||||||
|
wanted = "huiw ui"
|
||||||
|
|
||||||
|
class OldSelection_RealWorldCase_Test(_OS_Base):
|
||||||
|
snippets = ("for",
|
||||||
|
"""for ($${1:i} = ${2:0}; $$1 < ${3:count}; $$1${4:++}) {
|
||||||
|
${5:// code}
|
||||||
|
}""")
|
||||||
|
keys = "for" + EX + "k" + JF
|
||||||
|
wanted = """for ($k = 0; $k < count; $k++) {
|
||||||
|
// code
|
||||||
|
}"""
|
||||||
|
# End: Old Selection #}}}
|
||||||
|
|
||||||
# Normal mode editing {{{#
|
# Normal mode editing {{{#
|
||||||
# Test for bug #927844
|
# Test for bug #927844
|
||||||
class DeleteLastTwoLinesInSnippet(_VimTest):
|
class DeleteLastTwoLinesInSnippet(_VimTest):
|
||||||
|
Loading…
Reference in New Issue
Block a user