Skip to content

Commit ef02336

Browse files
h-eastchrisbra
authored andcommitted
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>
1 parent cf4d962 commit ef02336

3 files changed

Lines changed: 42 additions & 1 deletion

File tree

src/ex_getln.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4481,7 +4481,7 @@ f_getcmdscreenpos(typval_T *argvars UNUSED, typval_T *rettv)
44814481
{
44824482
cmdline_info_T *p = get_ccline_ptr();
44834483

4484-
rettv->vval.v_number = p != NULL ? p->cmdspos + 1 : 0;
4484+
rettv->vval.v_number = p != NULL ? cmdline_col_off + p->cmdspos + 1 : 0;
44854485
}
44864486

44874487
/*

src/testdir/test_tabpanel.vim

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,45 @@ function Test_tabpanel_with_vsplit()
9494
call StopVimInTerminal(buf)
9595
endfunc
9696

97+
func Call_cmd_funcs()
98+
let g:results = [getcmdpos(), getcmdscreenpos(), getcmdline()]
99+
endfunc
100+
101+
function Test_tabpanel_cmdline()
102+
let save_showtabline = &showtabline
103+
let g:results = []
104+
cnoremap <expr> <F2> Call_cmd_funcs()
105+
106+
set showtabline=0 showtabpanel=0
107+
call Call_cmd_funcs()
108+
call assert_equal([0, 0, ''], g:results)
109+
call feedkeys(":\<F2>\<Esc>", "xt")
110+
call assert_equal([1, 2, ''], g:results)
111+
call feedkeys(":pwd\<F2>\<Esc>", "xt")
112+
call assert_equal([4, 5, 'pwd'], g:results)
113+
114+
set showtabline=2 showtabpanel=2 tabpanelopt=columns:20,align:left
115+
call Call_cmd_funcs()
116+
call assert_equal([0, 0, ''], g:results)
117+
call feedkeys(":\<F2>\<Esc>", "xt")
118+
call assert_equal([1, 22, ''], g:results)
119+
call feedkeys(":pwd\<F2>\<Esc>", "xt")
120+
call assert_equal([4, 25, 'pwd'], g:results)
121+
122+
set showtabline=2 showtabpanel=2 tabpanelopt+=align:right
123+
call Call_cmd_funcs()
124+
call assert_equal([0, 0, ''], g:results)
125+
call feedkeys(":\<F2>\<Esc>", "xt")
126+
call assert_equal([1, 2, ''], g:results)
127+
call feedkeys(":pwd\<F2>\<Esc>", "xt")
128+
call assert_equal([4, 5, 'pwd'], g:results)
129+
130+
unlet g:results
131+
cunmap <F2>
132+
call s:reset()
133+
let &showtabline = save_showtabline
134+
endfunc
135+
97136
function Test_tabpanel_mouse()
98137
let save_showtabline = &showtabline
99138
let save_mouse = &mouse

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,8 @@ static char *(features[]) =
729729

730730
static int included_patches[] =
731731
{ /* Add new patch number below this line */
732+
/**/
733+
1899,
732734
/**/
733735
1898,
734736
/**/

0 commit comments

Comments
 (0)