mirror of
https://github.com/neovim/neovim.git
synced 2025-09-20 10:18:18 +00:00
vim-patch:8.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)
4a08b0dc4d
This commit is contained in:
@@ -1914,6 +1914,9 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case OP_FUNCTION:
|
case OP_FUNCTION:
|
||||||
|
// Restore linebreak, so that when the user edits it looks as
|
||||||
|
// before.
|
||||||
|
curwin->w_p_lbr = lbr_saved;
|
||||||
op_function(oap); /* call 'operatorfunc' */
|
op_function(oap); /* call 'operatorfunc' */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@@ -35,8 +35,20 @@ func! CountSpaces(type, ...)
|
|||||||
let @@ = reg_save
|
let @@ = reg_save
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! IsWindows()
|
func! OpfuncDummy(type, ...)
|
||||||
return has("win32") || has("win64") || has("win95")
|
" 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
|
endfunc
|
||||||
|
|
||||||
fun! Test_normal00_optrans()
|
fun! Test_normal00_optrans()
|
||||||
@@ -147,7 +159,7 @@ endfunc
|
|||||||
func! Test_normal04_filter()
|
func! Test_normal04_filter()
|
||||||
" basic filter test
|
" basic filter test
|
||||||
" only test on non windows platform
|
" only test on non windows platform
|
||||||
if IsWindows()
|
if has('win32')
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
call Setup_NewWindow()
|
call Setup_NewWindow()
|
||||||
@@ -210,7 +222,7 @@ endfunc
|
|||||||
func! Test_normal06_formatprg()
|
func! Test_normal06_formatprg()
|
||||||
" basic test for formatprg
|
" basic test for formatprg
|
||||||
" only test on non windows platform
|
" only test on non windows platform
|
||||||
if IsWindows()
|
if has('win32')
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
" uses sed to number non-empty lines
|
" uses sed to number non-empty lines
|
||||||
@@ -328,9 +340,36 @@ func! Test_normal09_operatorfunc()
|
|||||||
" clean up
|
" clean up
|
||||||
unmap <buffer> ,,
|
unmap <buffer> ,,
|
||||||
set opfunc=
|
set opfunc=
|
||||||
|
unlet! g:a
|
||||||
bw!
|
bw!
|
||||||
endfunc
|
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()
|
func! Test_normal10_expand()
|
||||||
" Test for expand()
|
" Test for expand()
|
||||||
10new
|
10new
|
||||||
|
Reference in New Issue
Block a user