Fixed a bug if a snippet contains folding markers. Call normal zv (show current line) after each insertion

This commit is contained in:
Holger Rapp 2010-09-23 10:49:39 +02:00
parent 76a8d7b2a5
commit 13331a8aba
2 changed files with 25 additions and 0 deletions

View File

@ -51,6 +51,8 @@ class TextBuffer(Buffer):
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 @@ class VimBuffer(Buffer):
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()"

18
test.py
View File

@ -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 }}}"""