diff options
| author | Bram Moolenaar <Bram@vim.org> | 2016-11-05 21:55:13 +0100 |
|---|---|---|
| committer | Bram Moolenaar <Bram@vim.org> | 2016-11-05 21:55:13 +0100 |
| commit | 4a08b0dc4dd70334056fc1bf069b5e938f2ed7d5 (patch) | |
| tree | 8857e7b1f4bc103cb64e7f625b2ea16b267801d5 /src/testdir | |
| parent | 40d3f137e751c0e9f5e7e6a587b93a52dd833d04 (diff) | |
| download | vim-git-4a08b0dc4dd70334056fc1bf069b5e938f2ed7d5.tar.gz | |
patch 8.0.0066v8.0.0066
Problem: when calling an operator function when 'linebreak' is set, it is
internally reset before calling the operator function.
Solution: Restore 'linebreak' before calling op_function(). (Christian
Brabandt)
Diffstat (limited to 'src/testdir')
| -rw-r--r-- | src/testdir/test_normal.vim | 47 |
1 files changed, 43 insertions, 4 deletions
diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim index 4dafe3c10..29bd783eb 100644 --- a/src/testdir/test_normal.vim +++ b/src/testdir/test_normal.vim @@ -35,8 +35,20 @@ func! CountSpaces(type, ...) let @@ = reg_save endfunc -func! IsWindows() - return has("win32") || has("win64") || has("win95") +func! OpfuncDummy(type, ...) + " for testing operatorfunc + let g:opt=&linebreak + + if a:0 " Invoked from Visual mode, use gv command. + silent exe "normal! gvy" + elseif a:type == 'line' + silent exe "normal! '[V']y" + else + silent exe "normal! `[v`]y" + endif + " Create a new dummy window + new + let g:bufnr=bufnr('%') endfunc fun! Test_normal00_optrans() @@ -147,7 +159,7 @@ endfunc func! Test_normal04_filter() " basic filter test " only test on non windows platform - if IsWindows() + if has('win32') return endif call Setup_NewWindow() @@ -210,7 +222,7 @@ endfunc func! Test_normal06_formatprg() " basic test for formatprg " only test on non windows platform - if IsWindows() + if has('win32') return else " uses sed to number non-empty lines @@ -328,7 +340,34 @@ func! Test_normal09_operatorfunc() " clean up unmap <buffer> ,, set opfunc= + unlet! g:a + bw! +endfunc + +func! Test_normal09a_operatorfunc() + " Test operatorfunc + call Setup_NewWindow() + " Add some spaces for counting + 50,60s/$/ / + unlet! g:opt + set linebreak + nmap <buffer><silent> ,, :set opfunc=OpfuncDummy<CR>g@ + 50 + norm ,,j + exe "bd!" g:bufnr + call assert_true(&linebreak) + call assert_equal(g:opt, &linebreak) + set nolinebreak + norm ,,j + exe "bd!" g:bufnr + call assert_false(&linebreak) + call assert_equal(g:opt, &linebreak) + + " clean up + unmap <buffer> ,, + set opfunc= bw! + unlet! g:opt endfunc func! Test_normal10_expand() |
