Merged my fixes for proper handling of autoformatting
This commit is contained in:
commit
a7ebbe37fc
@ -694,8 +694,12 @@ class SnippetManager(object):
|
|||||||
this_entered = vim.current.line[:self._vstate.pos.col]
|
this_entered = vim.current.line[:self._vstate.pos.col]
|
||||||
self._chars_entered('\n' + cline + this_entered, 1)
|
self._chars_entered('\n' + cline + this_entered, 1)
|
||||||
if line_was_shortened and user_didnt_enter_newline:
|
if line_was_shortened and user_didnt_enter_newline:
|
||||||
self._backspace(len(self._vstate.last_line)-len(lline))
|
nchars_deleted_in_lline = self._vstate.ppos.col - len(lline)
|
||||||
self._chars_entered('\n' + cline, 1)
|
self._backspace(nchars_deleted_in_lline)
|
||||||
|
nchars_wrapped_from_lline_after_cursor = \
|
||||||
|
len(self._vstate.last_line) - self._vstate.ppos.col
|
||||||
|
self._chars_entered('\n' + cline
|
||||||
|
[:len(cline)-nchars_wrapped_from_lline_after_cursor], 1)
|
||||||
else:
|
else:
|
||||||
pentered = lline[self._vstate.ppos.col:]
|
pentered = lline[self._vstate.ppos.col:]
|
||||||
this_entered = vim.current.line[:self._vstate.pos.col]
|
this_entered = vim.current.line[:self._vstate.pos.col]
|
||||||
|
53
test.py
53
test.py
@ -217,15 +217,60 @@ class MultilineExpandTestTyping_ExceptCorrectResult(_VimTest):
|
|||||||
wanted = "Wie Hallo Welt!\nUnd Wie gehtsHuiui! gehts"
|
wanted = "Wie Hallo Welt!\nUnd Wie gehtsHuiui! gehts"
|
||||||
keys = "Wie hallo gehts" + ESC + "bhi" + EX + "Huiui!"
|
keys = "Wie hallo gehts" + ESC + "bhi" + EX + "Huiui!"
|
||||||
|
|
||||||
class MultilineExpandWithFormatoptionsOn_ExceptCorrectResult(_VimTest):
|
########################
|
||||||
snippets = ("test", "${1:longer expand}\n$0")
|
# Format options tests #
|
||||||
keys = "test" + EX + "This is a longer text that should wrap"
|
########################
|
||||||
wanted = "This is a longer\ntext that should\nwrap\n"
|
class _FormatoptionsBase(_VimTest):
|
||||||
def _options_on(self):
|
def _options_on(self):
|
||||||
self.send(":set tw=20\n")
|
self.send(":set tw=20\n")
|
||||||
def _options_off(self):
|
def _options_off(self):
|
||||||
self.send(":set tw=0\n")
|
self.send(":set tw=0\n")
|
||||||
|
|
||||||
|
class FOSimple_ExceptCorrectResult(_FormatoptionsBase):
|
||||||
|
snippets = ("test", "${1:longer expand}\n$0")
|
||||||
|
keys = "test" + EX + "This is a longer text that should wrap"
|
||||||
|
wanted = "This is a longer\ntext that should\nwrap\n"
|
||||||
|
|
||||||
|
class FOTextBeforeAndAfter_ExceptCorrectResult(_FormatoptionsBase):
|
||||||
|
snippets = ("test", "Before${1:longer expand}After\nstart$1end")
|
||||||
|
keys = "test" + EX + "This is a longer text that should wrap"
|
||||||
|
wanted = \
|
||||||
|
"""BeforeThis is a
|
||||||
|
longer text that
|
||||||
|
should wrapAfter
|
||||||
|
startThis is a
|
||||||
|
longer text that
|
||||||
|
should wrapend"""
|
||||||
|
|
||||||
|
|
||||||
|
class FOTextAfter_ExceptCorrectResult(_FormatoptionsBase):
|
||||||
|
"""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"""
|
||||||
|
|
||||||
|
class FOWrapOnLongWord_ExceptCorrectResult(_FormatoptionsBase):
|
||||||
|
"""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"""
|
||||||
|
|
||||||
############
|
############
|
||||||
# TabStops #
|
# TabStops #
|
||||||
|
Loading…
Reference in New Issue
Block a user