]> granicus.if.org Git - vim/commitdiff
patch 8.2.3627: difficult to know where the text starts in a window v8.2.3627
authorBram Moolenaar <Bram@vim.org>
Sat, 20 Nov 2021 11:14:24 +0000 (11:14 +0000)
committerBram Moolenaar <Bram@vim.org>
Sat, 20 Nov 2021 11:14:24 +0000 (11:14 +0000)
Problem:    difficult to know where the text starts in a window. (Sergey
            Vlasov)
Solution:   Add the "textoff" entry in the result of getwininfo().
            (closes #9163)

runtime/doc/eval.txt
src/evalwindow.c
src/testdir/test_bufwintabinfo.vim
src/version.c

index 593dcb5177b9ffc4cfc124f2667df97c10287d14..1003010354149673c7f76de6515b5e307a5efe66 100644 (file)
@@ -6382,6 +6382,9 @@ getwininfo([{winid}])                                     *getwininfo()*
                                        otherwise
                        wincol          leftmost screen column of the window;
                                        "col" from |win_screenpos()|
+                       textoff         number of columns occupied by any
+                                       'foldcolumn', 'signcolumn' and line
+                                       number in front of the text
                        winid           |window-ID|
                        winnr           window number
                        winrow          topmost screen line of the window;
index c90571557d766b0ba886876af51657d03fb7bea5..c8c1442d2713360f2ed42431f4f43a8c1a94c33d 100644 (file)
@@ -407,6 +407,7 @@ get_win_info(win_T *wp, short tpnr, short winnr)
 #endif
     dict_add_number(dict, "width", wp->w_width);
     dict_add_number(dict, "wincol", wp->w_wincol + 1);
+    dict_add_number(dict, "textoff", win_col_off(wp));
     dict_add_number(dict, "bufnr", wp->w_buffer->b_fnum);
 
 #ifdef FEAT_TERMINAL
index f201753a22aca99ce64fe0f15d24267b55340e52..1d8e74a0ddd9ac44cd936d0a198e0efe6d28c5c0 100644 (file)
@@ -50,6 +50,7 @@ func Test_getbufwintabinfo()
 
   only
   let w1_id = win_getid()
+  setl foldcolumn=3
   new
   let w2_id = win_getid()
   tabnew | let w3_id = win_getid()
@@ -68,6 +69,7 @@ func Test_getbufwintabinfo()
   call assert_equal(winbufnr(2), winlist[1].bufnr)
   call assert_equal(winheight(2), winlist[1].height)
   call assert_equal(1, winlist[1].wincol)
+  call assert_equal(3, winlist[1].textoff)  " foldcolumn
   call assert_equal(tablineheight + winheight(1) + 2, winlist[1].winrow)
 
   call assert_equal(1, winlist[2].winnr)
index c54307e15eab6ac40b10c636a244d63718b36b4d..7bb852f52e8fd41b1770af58f5c85a712cd733c4 100644 (file)
@@ -757,6 +757,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3627,
 /**/
     3626,
 /**/