Merge pull request #94 from jszakmeister/fix-escaping-in-list_snippets_dict

Escape apostrophes in the description inside of list_snippets_dict.
This commit is contained in:
Holger Rapp 2013-08-05 20:24:35 -07:00
commit 84c36fccd8
2 changed files with 4 additions and 4 deletions

View File

@ -565,7 +565,7 @@ class SnippetManager(object):
description = description[1:-1] description = description[1:-1]
_vim.command(as_unicode("let g:current_ulti_dict['{key}'] = '{val}'").format( _vim.command(as_unicode("let g:current_ulti_dict['{key}'] = '{val}'").format(
key=key.replace("'", "''"), val=description)) key=key.replace("'", "''"), val=description.replace("'", "''")))
@err_to_scratch_buffer @err_to_scratch_buffer
def list_snippets(self): def list_snippets(self):

View File

@ -3021,16 +3021,16 @@ class VerifyVimDict1(_VimTest):
"""check: """check:
correct type (4 means vim dictionary) correct type (4 means vim dictionary)
correct length of dictionary (in this case we have on element if the use same prefix, dictionary should have 1 element) correct length of dictionary (in this case we have on element if the use same prefix, dictionary should have 1 element)
correct description correct description (including the apostrophe)
if the prefix is mismatched no resulting dict should have 0 elements if the prefix is mismatched no resulting dict should have 0 elements
""" """
snippets = ('testâ', 'abc123ά', '123êabc') snippets = ('testâ', 'abc123ά', '123\'êabc')
keys = ('test=(type(UltiSnips_SnippetsInCurrentScope()) . len(UltiSnips_SnippetsInCurrentScope()) . ' + keys = ('test=(type(UltiSnips_SnippetsInCurrentScope()) . len(UltiSnips_SnippetsInCurrentScope()) . ' +
'UltiSnips_SnippetsInCurrentScope()["testâ"]' + ')\n' + 'UltiSnips_SnippetsInCurrentScope()["testâ"]' + ')\n' +
'=len(UltiSnips_SnippetsInCurrentScope())\n') '=len(UltiSnips_SnippetsInCurrentScope())\n')
wanted = 'test41123êabc0' wanted = 'test41123\'êabc0'
class VerifyVimDict2(_VimTest): class VerifyVimDict2(_VimTest):
"""check: """check: