Commit: patch 9.1.1899: tabpanel: getcmdscreenpos() wrong when tabpanel is shown

1 view
Skip to first unread message

Christian Brabandt

unread,
Nov 13, 2025, 7:26:23 AM (9 days ago) Nov 13
to vim...@googlegroups.com
patch 9.1.1899: tabpanel: getcmdscreenpos() wrong when tabpanel is shown

Commit: https://github.com/vim/vim/commit/ef0233691588300ee9cf509447a2e890c4a943ae
Author: Hirohito Higashi <h.eas...@gmail.com>
Date: Sat Nov 8 17:12:57 2025 +0000

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.eas...@gmail.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/ex_getln.c b/src/ex_getln.c
index 63e981454..4ebfbfc5e 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -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;
}

/*
diff --git a/src/testdir/test_tabpanel.vim b/src/testdir/test_tabpanel.vim
index acf0ea94b..495969326 100644
--- a/src/testdir/test_tabpanel.vim
+++ b/src/testdir/test_tabpanel.vim
@@ -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
diff --git a/src/version.c b/src/version.c
index adf5f2268..a95d332c3 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1899,
/**/
1898,
/**/
Reply all
Reply to author
Forward
0 new messages