In py2 we could get by with attempting to encode/decode a string and if
it failed just ignore and return. Unfortunately on py3 a string decodes
to a bytearray and a bytearray encodes to a string. We can't simply
return the original object when we fail. We choose replace for handling
bytes we don't understand.
Test case (using python3 for UltiSnips):
open a new file
:set encoding=utf-8
qa<Backspace>q
"ap
Warning: this test case makes it very difficult to exit vim cleanly and
save files!
Signed-off-by: Andrew Ruder <andrew.ruder@elecsyscorp.com>
In windows when expanding snippets the names of the snippet files look weird because \ is not escaped properly.
Also I think there should be an option to show only part of the file name, say the path relative to ~/.vim, because this way most of the screen is taken with the paths of the file.
Going even further I think it would it look nicer if you had some kind of alignment for the string. Say "%2i: %-15s (%s)".
Of course this last suggestion might not be consensual, but maybe a option might be offered to the user.
This makes the testsuite slower, but avoids leaking state. Also the code
has to be less aware of being under test. It will also allow to to more
integration tests with other plugins that have support for UltiSnips or
that UltiSnips supports.
Removed parsing responsibilities from SnippetManager and instead put
them into the new module providers. Renamed private methods on
SnippetManager that are not meant to be called by external libraries to
start with _. Refactored tests so that expected failures can be tested
and therefore removed the testing flag from SnippetManager.
If a python module tried to load UltiSnips without the autoload file
being run first, UltiSnips_Manager was not defined. This broke YCM and
maybe others too. This fixes
https://github.com/Valloric/YouCompleteMe/issues/820.