Skip to content

Commit

Permalink
Fixed buffer validation rejecting some valid buffers, fixed test util…
Browse files Browse the repository at this point in the history
…ity functions
  • Loading branch information
shaggyrogers committed May 21, 2018
1 parent 452176f commit 561803e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
4 changes: 2 additions & 2 deletions autoload/mundo.vim
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ function! s:MundoValidateBuffer()"{{{
let reason = 'is not modifiable'
elseif &previewwindow
let reason = 'is a preview window'
elseif &buftype != '' && &buftype != 'acwrite'
let reason = 'has invalid buffer type "'.&buftype.'"'
elseif &buftype == 'help' || &buftype == 'quickfix' || &buftype == 'terminal'
let reason = 'is a '.&buftype.' window'
else
return 1
endif
Expand Down
31 changes: 19 additions & 12 deletions tests/vim_test/plugin/gundo_test_utils.vim
Original file line number Diff line number Diff line change
@@ -1,39 +1,46 @@
let s:undolevels_save = &undolevels

function! g:Goto(buffername)"{{{
exec bufwinnr(bufnr(a:buffername)) . 'wincmd w'
let l:winnr = bufwinnr(a:buffername)

if l:winnr == -1
return
endif

execute l:winnr . 'wincmd w'
endfunction"}}}

function! g:GotoLineContaining(text)"{{{
exe "silent! normal gg/\\M" . a:text . "\n"
let index = match(getline(1, '$'), '\V' . escape(a:text, '\'))

if index == -1
return
endif

call cursor(index + 1, 0)
endfunction"}}}

function! g:CurrentLineContains(text)"{{{
if stridx(getline('.'), a:text) != -1
return 1
else
return 0
endif
return stridx(getline('.'), a:text) != -1
endfunction"}}}

function! g:Contains(text)"{{{
call g:GotoLineContaining(a:text)
return g:CurrentLineContains(a:text)
return match(getline(1, '$'), '\V' . escape(a:text, '\')) != -1
endfunction"}}}

function! g:TypeLine(text)"{{{
exe "normal i" . a:text . "\<C-g>u\n\e"
execute "normal i" . a:text . "\<C-g>u\n\e"
endfunction"}}}

function! g:TypeLineDone(text)"{{{
exe "normal i" . a:text . "\n\e"
execute "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 join(getline(1, '$'), "\n")
echo "SOMETIMES I HATE YOU VIM"
endfunction"}}}

Expand Down

0 comments on commit 561803e

Please sign in to comment.