# HG changeset patch # User Hyeon Kim # Date 1418592580 -32400 # Node ID 9a42f3562a99a9de924c9518141b3e7f8f3ce4dd # Parent eb9fc8676b8959c3c2c95bf6b6e8f0f44317c5c0 Neovim support: line buffers shouldn't contain newlines The result of `difflib.unified_diff()` may contains newlines at the end of its each line. It's suppressed in original Vim, but it's illegal in Neovim. Since there is no good way to prevent `difflib` from appending newlines to the results, `_output_preview_text()` function should sanitize it. Thanks @michamos Reference: https://github.com/neovim/neovim/blob/a5edc5f2572d6d63f7f7a32ae6ec7bcabe1472b6/src/nvim/api/buffer.c#L215 https://github.com/sjl/gundo.vim/pull/30#issuecomment-170064637 diff -r eb9fc8676b89 -r 9a42f3562a99 autoload/gundo.py --- a/autoload/gundo.py Wed Jul 10 20:37:26 2013 -0400 +++ b/autoload/gundo.py Mon Dec 15 06:29:40 2014 +0900 @@ -336,7 +336,7 @@ def _output_preview_text(lines): _goto_window_for_buffer_name('__Gundo_Preview__') vim.command('setlocal modifiable') - vim.current.buffer[:] = lines + vim.current.buffer[:] = [line.rstrip('\n') for line in lines] vim.command('setlocal nomodifiable') def _generate_preview_diff(current, node_before, node_after):