Added tests for leaving snippets above or below

This commit is contained in:
Holger Rapp 2009-07-06 16:43:24 +02:00
parent d8cd3f3d08
commit 02684225a8
3 changed files with 51 additions and 5 deletions

View File

@ -1 +1,44 @@
# This is a comment, don't read it
snippet mfg
Mit freundlichen Grüßen,
Holger Rapp
$0
endsnippet
snippet lg
Liebe Grüße,
Holger
$0
endsnippet
snippet vg
Viele Grüße,
Holger
$0
endsnippet
snippet sig
----------------------------------------
Dipl.-Phys. Holger Rapp
Institut für Mess- und Regelungstechnik
Universität Karlsruhe (TH)
Engler-Bunte-Ring 21
76131 Karlsruhe, Germany
Geb. 40.32, Zi. 232, zweite Etage
Tel: +49 (0)721 / 608-2341
Fax: +49 (0)721 / 661874
Mail: Rapp@mrt.uka.de
Web: www.mrt.uni-karlsruhe.de
----------------------------------------
$0
endsnippet
snippet snip
------------------- SNIP -------------------
$0
------------------- SNAP -------------------
endsnippet

View File

@ -890,8 +890,6 @@ class SnippetManager(object):
if not is_inside:
self._current_snippets.pop()
# TODO: check if we left the current snippet
if not self._accept_input:
return

11
test.py
View File

@ -509,9 +509,14 @@ class IMMoving_ExitWhenOutsideLeft_ECR(_VimTest):
snippets = ("test", r"${1:Hi} ${2:blub}")
keys = "hello test this" + ESC + "02f i\ttab" + 4*ARR_L + "\thallo"
wanted = "hellohallo tab blub this"
# TODO: exit when below or above snippet
# TODO: single line snippet insertions always adds newline
class IMMoving_ExitWhenOutsideAbove_ECR(_VimTest):
snippets = ("test", "${1:Hi}\n${2:blub}")
keys = "hello test this" + ESC + "02f i\ttab" + 1*ARR_U + "\t\nhallo"
wanted = "hallo\nhello tab\nblub this"
class IMMoving_ExitWhenOutsideBelow_ECR(_VimTest):
snippets = ("test", "${1:Hi}\n${2:blub}")
keys = "hello test this" + ESC + "02f i\ttab" + 2*ARR_D + "\ttesthallo\n"
wanted = "hello tab\nblub this\ntesthallo"
####################
# PROPER INDENTING #