Patch 8.0.1364
Problem:    There is no easy way to get the window position.
Solution:   Add win_screenpos().
Files:      src/evalfunc.c, src/testdir/test_window_cmd.vim,
            runtime/doc/eval.txt


*** ../vim-8.0.1363/src/evalfunc.c      2017-11-25 14:37:05.410794057 +0100
--- src/evalfunc.c      2017-12-02 15:28:32.248562749 +0100
***************
*** 441,446 ****
--- 441,447 ----
  static void f_win_gotoid(typval_T *argvars, typval_T *rettv);
  static void f_win_id2tabwin(typval_T *argvars, typval_T *rettv);
  static void f_win_id2win(typval_T *argvars, typval_T *rettv);
+ static void f_win_screenpos(typval_T *argvars, typval_T *rettv);
  static void f_winbufnr(typval_T *argvars, typval_T *rettv);
  static void f_wincol(typval_T *argvars, typval_T *rettv);
  static void f_winheight(typval_T *argvars, typval_T *rettv);
***************
*** 899,904 ****
--- 900,906 ----
      {"win_gotoid",    1, 1, f_win_gotoid},
      {"win_id2tabwin", 1, 1, f_win_id2tabwin},
      {"win_id2win",    1, 1, f_win_id2win},
+     {"win_screenpos", 1, 1, f_win_screenpos},
      {"winbufnr",      1, 1, f_winbufnr},
      {"wincol",                0, 0, f_wincol},
      {"winheight",     1, 1, f_winheight},
***************
*** 5379,5384 ****
--- 5381,5402 ----
  }
  
  /*
+  * "win_screenpos()" function
+  */
+     static void
+ f_win_screenpos(typval_T *argvars, typval_T *rettv)
+ {
+     win_T     *wp;
+ 
+     if (rettv_list_alloc(rettv) == FAIL)
+       return;
+ 
+     wp = find_win_by_nr(&argvars[0], NULL);
+     list_append_number(rettv->vval.v_list, wp == NULL ? 0 : wp->w_winrow + 1);
+     list_append_number(rettv->vval.v_list, wp == NULL ? 0 : wp->w_wincol + 1);
+ }
+ 
+ /*
   * "getwinposx()" function
   */
      static void
*** ../vim-8.0.1363/src/testdir/test_window_cmd.vim     2017-08-07 
22:02:09.319624624 +0200
--- src/testdir/test_window_cmd.vim     2017-12-02 15:36:31.681113839 +0100
***************
*** 362,367 ****
--- 362,380 ----
    set equalalways&
  endfunc
  
+ func Test_win_screenpos()
+   call assert_equal(1, winnr('$'))
+   split
+   vsplit
+   10wincmd _
+   30wincmd |
+   call assert_equal([1, 1], win_screenpos(1))
+   call assert_equal([1, 32], win_screenpos(2))
+   call assert_equal([12, 1], win_screenpos(3))
+   call assert_equal([0, 0], win_screenpos(4))
+   only
+ endfunc
+ 
  func Test_window_jump_tag()
    help
    /iccf
*** ../vim-8.0.1363/runtime/doc/eval.txt        2017-11-19 20:13:01.618509073 
+0100
--- runtime/doc/eval.txt        2017-12-02 15:38:24.912358072 +0100
***************
*** 2452,2457 ****
--- 2452,2458 ----
  win_gotoid({expr})            Number  go to window with ID {expr}
  win_id2tabwin({expr})         List    get tab and window nr from window ID
  win_id2win({expr})            Number  get window nr from window ID
+ win_screenpos({nr})           List    get screen position of window {nr}
  winbufnr({nr})                        Number  buffer number of window {nr}
  wincol()                      Number  window column of the cursor
  winheight({nr})                       Number  height of window {nr}
***************
*** 8605,8610 ****
--- 8634,8647 ----
                Return the window number of window with ID {expr}.
                Return 0 if the window cannot be found in the current tabpage.
  
+ win_screenpos({nr})                                   *win_screenpos()*
+               Return the screen position of window {nr} as a list with two
+               numbers: [row, col].  The first window always has position
+               [1, 1].
+               {nr} can be the window number or the |window-ID|.
+               Return [0, 0] if the window cannot be found in the current
+               tabpage.
+ 
                                                        *winbufnr()*
  winbufnr({nr})        The result is a Number, which is the number of the 
buffer
                associated with window {nr}.  {nr} can be the window number or
*** ../vim-8.0.1363/src/version.c       2017-12-02 15:11:18.421655177 +0100
--- src/version.c       2017-12-02 15:37:36.044680576 +0100
***************
*** 773,774 ****
--- 773,776 ----
  {   /* Add new patch number below this line */
+ /**/
+     1364,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
62. If your doorbell rings, you think that new mail has arrived.  And then
    you're disappointed that it's only someone at the door.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
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].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui