mirror of
https://github.com/vim/vim.git
synced 2025-11-13 22:54:27 -05:00
patch 9.1.1899: tabpanel: getcmdscreenpos() wrong when tabpanel is shown
Problem: tabpanel: getcmdscreenpos() wrong when tabpanel is shown
Solution: Adjust f_getcmdscreenpos() and add cmdline_col_off
(Hirohito Higashi)
related: #18678
closes: #18699
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
cf4d9625c6
commit
ef02336915
@@ -4481,7 +4481,7 @@ f_getcmdscreenpos(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
{
|
||||
cmdline_info_T *p = get_ccline_ptr();
|
||||
|
||||
rettv->vval.v_number = p != NULL ? p->cmdspos + 1 : 0;
|
||||
rettv->vval.v_number = p != NULL ? cmdline_col_off + p->cmdspos + 1 : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -94,6 +94,45 @@ function Test_tabpanel_with_vsplit()
|
||||
call StopVimInTerminal(buf)
|
||||
endfunc
|
||||
|
||||
func Call_cmd_funcs()
|
||||
let g:results = [getcmdpos(), getcmdscreenpos(), getcmdline()]
|
||||
endfunc
|
||||
|
||||
function Test_tabpanel_cmdline()
|
||||
let save_showtabline = &showtabline
|
||||
let g:results = []
|
||||
cnoremap <expr> <F2> Call_cmd_funcs()
|
||||
|
||||
set showtabline=0 showtabpanel=0
|
||||
call Call_cmd_funcs()
|
||||
call assert_equal([0, 0, ''], g:results)
|
||||
call feedkeys(":\<F2>\<Esc>", "xt")
|
||||
call assert_equal([1, 2, ''], g:results)
|
||||
call feedkeys(":pwd\<F2>\<Esc>", "xt")
|
||||
call assert_equal([4, 5, 'pwd'], g:results)
|
||||
|
||||
set showtabline=2 showtabpanel=2 tabpanelopt=columns:20,align:left
|
||||
call Call_cmd_funcs()
|
||||
call assert_equal([0, 0, ''], g:results)
|
||||
call feedkeys(":\<F2>\<Esc>", "xt")
|
||||
call assert_equal([1, 22, ''], g:results)
|
||||
call feedkeys(":pwd\<F2>\<Esc>", "xt")
|
||||
call assert_equal([4, 25, 'pwd'], g:results)
|
||||
|
||||
set showtabline=2 showtabpanel=2 tabpanelopt+=align:right
|
||||
call Call_cmd_funcs()
|
||||
call assert_equal([0, 0, ''], g:results)
|
||||
call feedkeys(":\<F2>\<Esc>", "xt")
|
||||
call assert_equal([1, 2, ''], g:results)
|
||||
call feedkeys(":pwd\<F2>\<Esc>", "xt")
|
||||
call assert_equal([4, 5, 'pwd'], g:results)
|
||||
|
||||
unlet g:results
|
||||
cunmap <F2>
|
||||
call s:reset()
|
||||
let &showtabline = save_showtabline
|
||||
endfunc
|
||||
|
||||
function Test_tabpanel_mouse()
|
||||
let save_showtabline = &showtabline
|
||||
let save_mouse = &mouse
|
||||
|
||||
@@ -729,6 +729,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1899,
|
||||
/**/
|
||||
1898,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user