Added stricter test case that show the problem and implement fixes for them

This commit is contained in:
Holger Rapp 2011-02-20 20:49:32 +01:00
parent b371f0c8c4
commit 461e81d6a2
2 changed files with 39 additions and 2 deletions

View File

@ -694,8 +694,8 @@ class SnippetManager(object):
this_entered = vim.current.line[:self._vstate.pos.col]
self._chars_entered('\n' + cline + this_entered, 1)
if line_was_shortened and user_didnt_enter_newline:
self._backspace(len(self._vstate.last_line)-len(lline))
self._chars_entered('\n' + cline, 1)
self._backspace(self._vstate.ppos.col-len(lline))
self._chars_entered('\n' + cline[:len(cline)-(len(self._vstate.last_line)-self._vstate.ppos.col)], 1)
else:
pentered = lline[self._vstate.ppos.col:]
this_entered = vim.current.line[:self._vstate.pos.col]

37
test.py
View File

@ -226,6 +226,43 @@ class MultilineExpandWithFormatoptionsOn_ExceptCorrectResult(_VimTest):
def _options_off(self):
self.send(":set tw=0\n")
class MultilineExpandWithFormatoptionsOnTextAfter_ExceptCorrectResult(_VimTest):
"""Testcase for lp:719998"""
snippets = ("test", "${1:longer expand}after\nstart$1end")
keys = ("test" + EX + "This is a longer snippet that should wrap properly "
"and the mirror below should work as well")
wanted = \
"""This is a longer
snippet that should
wrap properly and
the mirror below
should work as wellafter
startThis is a longer
snippet that should
wrap properly and
the mirror below
should work as wellend"""
def _options_on(self):
self.send(":set tw=20\n")
def _options_off(self):
self.send(":set tw=0\n")
class MultilineExpandWithFormatoptionsWrapOnLongWord_ExceptCorrectResult(_VimTest):
"""Testcase for lp:719998"""
snippets = ("test", "${1:longer expand}after\nstart$1end")
keys = ("test" + EX + "This is a longersnippet that should wrap properly")
wanted = \
"""This is a
longersnippet that
should wrap properlyafter
startThis is a
longersnippet that
should wrap properlyend"""
def _options_on(self):
self.send(":set tw=20\n")
def _options_off(self):
self.send(":set tw=0\n")
############
# TabStops #