Fixed a bug if a snippet contains folding markers. Call normal zv (show current line) after each insertion
This commit is contained in:
parent
76a8d7b2a5
commit
13331a8aba
@ -51,6 +51,8 @@ class TextBuffer(Buffer):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '\n'.join(self._lines)
|
return '\n'.join(self._lines)
|
||||||
|
|
||||||
|
from debug import debug
|
||||||
|
|
||||||
class VimBuffer(Buffer):
|
class VimBuffer(Buffer):
|
||||||
def __init__(self, before, after):
|
def __init__(self, before, after):
|
||||||
self._bf = before
|
self._bf = before
|
||||||
@ -62,6 +64,11 @@ class VimBuffer(Buffer):
|
|||||||
vim.current.buffer[a.start:a.stop] = b
|
vim.current.buffer[a.start:a.stop] = b
|
||||||
else:
|
else:
|
||||||
vim.current.buffer[a] = b
|
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):
|
def __repr__(self):
|
||||||
return "VimBuffer()"
|
return "VimBuffer()"
|
||||||
|
|
||||||
|
18
test.py
18
test.py
@ -2030,6 +2030,24 @@ class SelectModeMappings_BufferLocalMappings_ECR(_SelectModeMappings):
|
|||||||
buffer_maps = ("H", "blah")
|
buffer_maps = ("H", "blah")
|
||||||
wanted = "Hello"
|
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 }}}"""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user