tests/vim_test/plugin/gundo_test_utils.vim @ 9a42f3562a99
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 |
d018089ed71a |
children |
(none) |
let s:undolevels_save = &undolevels
function! g:Goto(buffername)"{{{
exec bufwinnr(bufnr(a:buffername)) . 'wincmd w'
endfunction"}}}
function! g:GotoLineContaining(text)"{{{
exe "silent! normal gg/\\M" . a:text . "\n"
endfunction"}}}
function! g:CurrentLineContains(text)"{{{
if stridx(getline('.'), a:text) != -1
return 1
else
return 0
endif
endfunction"}}}
function! g:Contains(text)"{{{
call g:GotoLineContaining(a:text)
return g:CurrentLineContains(a:text)
endfunction"}}}
function! g:TypeLine(text)"{{{
exe "normal i" . a:text . "\<C-g>u\n\e"
endfunction"}}}
function! g:TypeLineDone(text)"{{{
exe "normal i" . a:text . "\n\e"
" Break the undo chain
let &undolevels = s:undolevels_save
endfunction"}}}
function! g:PrintTheFuckingBuffer()"{{{
echo join(getline(1, 100000), "\n")
echo "SOMETIMES I HATE YOU VIM"
endfunction"}}}
function! g:MoveUp()"{{{
call cursor(line('.') - 1, 0)
endfunction"}}}
function! g:MoveDown()"{{{
call cursor(line('.') + 1, 0)
endfunction"}}}