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

Commit: 
https://github.com/vim/vim/commit/ef0233691588300ee9cf509447a2e890c4a943ae
Author: Hirohito Higashi <[email protected]>
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 <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

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,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1vJWOq-001D62-1J%40256bit.org.

Raspunde prin e-mail lui