-
Couldn't load subscription status.
- Fork 81
Neovim support: line buffers shouldn't contain newlines #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
👍 |
|
@evantravers. @sjl looks tired (he hasn't checked this PR over 45 days) so I forked this. vim-mundo supports nvim and it merged some reasonable pull requests which made to this repo. Please take a look! :D |
|
this is still an issue. @sjl are you still maintaining the plugin? |
|
👍 |
|
This strips more than just newlines. Does it break the diffs if lines contain trailing spaces? |
|
Adding diff --git a/autoload/gundo.py b/autoload/gundo.py
index 281b30c..a61ec20 100644
--- a/autoload/gundo.py
+++ b/autoload/gundo.py
@@ -336,7 +336,7 @@ def _fmt_time(t):
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): |
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 sjl/gundo.vim#30 (comment)
4e3b683 to
0d9806d
Compare
Neovim support: line buffers shouldn't contain newlines
|
Merged, thanks. |
Fix sjl#30: error on help toggle
The result of
difflib.unified_diff()may contains newlines at the end of itseach line. It's suppressed in original Vim, but it's illegal in Neovim.
Since there is no good way to prevent
difflibfrom appending newlines to theresults,
_output_preview_text()function should sanitize it.Reference