To: vim_dev@googlegroups.com Subject: Patch 7.3.940 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.3.940 Problem: Python: Can't get position of window. Solution: Add window.row and window.col. (ZyX) Files: runtime/doc/if_pyth.txt, src/if_py_both.h *** ../vim-7.3.939/runtime/doc/if_pyth.txt 2013-05-12 19:00:36.000000000 +0200 --- runtime/doc/if_pyth.txt 2013-05-12 19:24:40.000000000 +0200 *************** *** 400,405 **** --- 400,408 ---- This is zero in case it cannot be determined (e.g. when the window object belongs to other tab page). + row, col (read-only) On-screen window position in display cells. + First position is zero. + The height attribute is writable only if the screen is split horizontally. The width attribute is writable only if the screen is split vertically. *** ../vim-7.3.939/src/if_py_both.h 2013-05-12 19:09:46.000000000 +0200 --- src/if_py_both.h 2013-05-12 19:22:16.000000000 +0200 *************** *** 1839,1847 **** --- 1839,1853 ---- } else if (strcmp(name, "height") == 0) return PyLong_FromLong((long)(this->win->w_height)); + #ifdef FEAT_WINDOWS + else if (strcmp(name, "row") == 0) + return PyLong_FromLong((long)(this->win->w_winrow)); + #endif #ifdef FEAT_VERTSPLIT else if (strcmp(name, "width") == 0) return PyLong_FromLong((long)(W_WIDTH(this->win))); + else if (strcmp(name, "col") == 0) + return PyLong_FromLong((long)(W_WINCOL(this->win))); #endif else if (strcmp(name, "vars") == 0) return DictionaryNew(this->win->w_vars); *************** *** 1851,1858 **** else if (strcmp(name, "number") == 0) return PyLong_FromLong((long) get_win_number(this->win)); else if (strcmp(name,"__members__") == 0) ! return Py_BuildValue("[ssssss]", "buffer", "cursor", "height", "vars", ! "options", "number"); else return NULL; } --- 1857,1864 ---- else if (strcmp(name, "number") == 0) return PyLong_FromLong((long) get_win_number(this->win)); else if (strcmp(name,"__members__") == 0) ! return Py_BuildValue("[ssssssss]", "buffer", "cursor", "height", "vars", ! "options", "number", "row", "col"); else return NULL; } *** ../vim-7.3.939/src/version.c 2013-05-12 19:09:46.000000000 +0200 --- src/version.c 2013-05-12 19:23:50.000000000 +0200 *************** *** 730,731 **** --- 730,733 ---- { /* Add new patch number below this line */ + /**/ + 940, /**/ -- A computer programmer is a device for turning requirements into undocumented features. It runs on cola, pizza and Dilbert cartoons. Bram Moolenaar /// Bram Moolenaar -- Bram@Moolenaar.net -- 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 ///