Fixed bug triggered by deleting the last few lines of a snippet in normal mode

This commit is contained in:
Holger Rapp 2012-02-12 08:53:42 +01:00
parent 6d6fe9dbb6
commit 164bcbc714
2 changed files with 9 additions and 2 deletions

View File

@ -55,7 +55,7 @@ def guess_edit(initial_line, lt, ct, vs):
if sv != pos and sv.line == pos.line:
es.append(("I", sv.line, sv.col, ct[sv.line - initial_line][sv.col:pos.col+1]))
if is_complete_edit(initial_line, lt, ct, es): return True, es
if pos.line == ppos.line: # Movement only in one line
if pos.line == ppos.line and len(lt) == len(ct): # Movement only in one line
llen = len(lt[ppos.line - initial_line])
clen = len(ct[pos.line - initial_line])
if ppos < pos and clen > llen: # Likely that only characters have been added

View File

@ -2554,7 +2554,6 @@ class DeleteSnippetInsertion1(_VimTest):
snippets = ("test", r"$1${1/(.*)/(?0::.)/}")
keys = "test" + EX + ESC + "u" + "i" + JF + "\t"
wanted = "\t"
# End: Undo of Snippet insertion #}}}
# Tab Completion of Words {{{#
class Completion_SimpleExample_ECR(_VimTest):
@ -2795,6 +2794,14 @@ class ExclusiveSelection_RealWorldCase_Test(_ES_Base):
// code
}"""
# End: Exclusive Selection #}}}
# Normal mode editing {{{#
# Test for bug #927844
class DeleteLastTwoLinesInSnippet(_VimTest):
snippets = ("test", "$1hello\nnice\nworld")
keys = "test" + EX + ESC + "j2dd"
wanted = "hello"
# End: Normal mode editing #}}}
###########################################################################
# END OF TEST #
###########################################################################