Permalink
Browse files

Fix for folding problem by Aaron

  • Loading branch information...
2 parents e283500 + 3584ee3 commit 3fc86a36a8b192592883dc09fcdb7d4cab7475c0 @SirVer committed Aug 22, 2012
Showing with 21 additions and 4 deletions.
  1. +4 −4 plugin/UltiSnips/_vim.py
  2. +17 −0 test.py
@@ -66,10 +66,6 @@ def fset(self, pos):
def text_to_vim(start, end, text):
lines = text.split('\n')
- # Open any folds this might have created
- buf.cursor = start
- vim.command("normal zv")
-
new_end = _calc_end(lines, start)
before = buf[start.line][:start.col]
@@ -82,6 +78,10 @@ def text_to_vim(start, end, text):
new_lines[-1] += after
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
def escape(inp):
View
@@ -2587,6 +2587,23 @@ class Fold_DeleteMiddleLine_ECR(_VimTest):
# End: $1 `!p snip.rv = vim.eval("&foldmarker").split(",")[1]`""")
keys = "fold" + EX + "hi" + ESC + "jdd"
wanted = "# hi {{{\n\n# End: hi }}}"
+
+class PerlSyntaxFold(_VimTest):
+ def _options_on(self):
+ self.send(":set foldlevel=0\n")
+ self.send(":syntax enable\n")
+ self.send(":set foldmethod=syntax\n")
+ self.send(":let g:perl_fold = 1\n")
+ self.send(":so $VIMRUNTIME/syntax/perl.vim\n")
+ def _options_off(self):
+ self.send(":set foldmethod=manual\n")
+ self.send(":syntax clear\n")
+
+ snippets = ("test", r"""package ${1:`!v printf('c%02d', 3)`};
+${0}
+1;""")
+ keys = "test" + EX + JF + "sub junk {}"
+ wanted = "package c03;\nsub junk {}\n1;"
# End: Folding Interaction #}}}
# Cursor Movement {{{#

0 comments on commit 3fc86a3

Please sign in to comment.