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
author |
Hyeon Kim <simnalamburt@gmail.com> |
date |
Mon, 15 Dec 2014 06:29:40 +0900 |
parents |
eb9fc8676b89
|
children |
3a3d8751bbe9
|
branches/tags |
(none) |
files |
autoload/gundo.py |
Changes
--- 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):