Skip to content
Browse files

Fixed a bug if a snippet contains folding markers. Call normal zv (sh…

…ow current line) after each insertion
  • Loading branch information...
1 parent 76a8d7b commit 13331a8aba1ae2fbc1a211702a42c1b321aef1e2 @SirVer committed Sep 23, 2010
Showing with 25 additions and 0 deletions.
  1. +7 −0 plugin/UltiSnips/Buffer.py
  2. +18 −0 test.py
View
7 plugin/UltiSnips/Buffer.py
@@ -51,6 +51,8 @@ def __repr__(self):
def __str__(self):
return '\n'.join(self._lines)
+from debug import debug
+
class VimBuffer(Buffer):
def __init__(self, before, after):
self._bf = before
@@ -62,6 +64,11 @@ def __setitem__(self, a, b):
vim.current.buffer[a.start:a.stop] = b
else:
vim.current.buffer[a] = b
+
+ # Open any folds this might have created
+ vim.current.window.cursor = a.start + 1, 0
+ vim.command("normal zv")
+
def __repr__(self):
return "VimBuffer()"
View
18 test.py
@@ -2030,6 +2030,24 @@ class SelectModeMappings_BufferLocalMappings_ECR(_SelectModeMappings):
buffer_maps = ("H", "blah")
wanted = "Hello"
+####################
+# Folding problems #
+####################
+class FoldingEnabled_SnippetWithFold_ExpectNoFolding(_VimTest):
+ def _options_on(self):
+ self.send(":set foldlevel=0\n")
+ self.send(":set foldmethod=marker\n")
+ def _options_off(self):
+ self.send(":set foldlevel=0\n")
+ self.send(":set foldmethod=manual\n")
+
+ snippets = ("test", r"""Hello {{{
+${1:Welt} }}}""")
+ keys = "test" + EX + "Ball"
+ wanted = """Hello {{{
+Ball }}}"""
+
+

0 comments on commit 13331a8

Please sign in to comment.
Something went wrong with that request. Please try again.