Fix opening folds inserted by snippets

Commit 13331a8 added code to show the current line after insertions, but
later changes caused that to be called too soon.  This left folds
created by a snippet closed, and the cursor at the end of the insertion.
This commit is contained in:
Aaron Schrab 2012-07-31 15:01:15 -04:00
parent e9a783857b
commit 73352257e4

View File

@ -64,10 +64,6 @@ buf = VimBuffer()
def text_to_vim(start, end, text): def text_to_vim(start, end, text):
lines = text.split('\n') lines = text.split('\n')
# Open any folds this might have created
buf.cursor = start
vim.command("normal zv")
new_end = _calc_end(lines, start) new_end = _calc_end(lines, start)
before = buf[start.line][:start.col] before = buf[start.line][:start.col]
@ -80,6 +76,10 @@ def text_to_vim(start, end, text):
new_lines[-1] += after new_lines[-1] += after
buf[start.line:end.line + 1] = new_lines buf[start.line:end.line + 1] = new_lines
# Open any folds this might have created
buf.cursor = start
vim.command("normal zv")
return new_end return new_end
def escape(inp): def escape(inp):