Fixed bug triggered by deleting the last few lines of a snippet in normal mode
This commit is contained in:
parent
6d6fe9dbb6
commit
164bcbc714
@ -55,7 +55,7 @@ def guess_edit(initial_line, lt, ct, vs):
|
|||||||
if sv != pos and sv.line == pos.line:
|
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]))
|
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 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])
|
llen = len(lt[ppos.line - initial_line])
|
||||||
clen = len(ct[pos.line - initial_line])
|
clen = len(ct[pos.line - initial_line])
|
||||||
if ppos < pos and clen > llen: # Likely that only characters have been added
|
if ppos < pos and clen > llen: # Likely that only characters have been added
|
||||||
|
9
test.py
9
test.py
@ -2554,7 +2554,6 @@ class DeleteSnippetInsertion1(_VimTest):
|
|||||||
snippets = ("test", r"$1${1/(.*)/(?0::.)/}")
|
snippets = ("test", r"$1${1/(.*)/(?0::.)/}")
|
||||||
keys = "test" + EX + ESC + "u" + "i" + JF + "\t"
|
keys = "test" + EX + ESC + "u" + "i" + JF + "\t"
|
||||||
wanted = "\t"
|
wanted = "\t"
|
||||||
|
|
||||||
# End: Undo of Snippet insertion #}}}
|
# End: Undo of Snippet insertion #}}}
|
||||||
# Tab Completion of Words {{{#
|
# Tab Completion of Words {{{#
|
||||||
class Completion_SimpleExample_ECR(_VimTest):
|
class Completion_SimpleExample_ECR(_VimTest):
|
||||||
@ -2795,6 +2794,14 @@ class ExclusiveSelection_RealWorldCase_Test(_ES_Base):
|
|||||||
// code
|
// code
|
||||||
}"""
|
}"""
|
||||||
# End: Exclusive Selection #}}}
|
# 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 #
|
# END OF TEST #
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
Loading…
x
Reference in New Issue
Block a user