1
0
forked from aniani/vim

updated for version 7.3.940

Problem:    Python: Can't get position of window.
Solution:   Add window.row and window.col. (ZyX)
This commit is contained in:
Bram Moolenaar
2013-05-12 19:30:31 +02:00
parent 99add41656
commit 4e5dfb5700
3 changed files with 13 additions and 2 deletions

View File

@@ -400,6 +400,9 @@ Window attributes are:
This is zero in case it cannot be determined This is zero in case it cannot be determined
(e.g. when the window object belongs to other (e.g. when the window object belongs to other
tab page). 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 height attribute is writable only if the screen is split horizontally.
The width attribute is writable only if the screen is split vertically. The width attribute is writable only if the screen is split vertically.

View File

@@ -1839,9 +1839,15 @@ WindowAttr(WindowObject *this, char *name)
} }
else if (strcmp(name, "height") == 0) else if (strcmp(name, "height") == 0)
return PyLong_FromLong((long)(this->win->w_height)); 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 #ifdef FEAT_VERTSPLIT
else if (strcmp(name, "width") == 0) else if (strcmp(name, "width") == 0)
return PyLong_FromLong((long)(W_WIDTH(this->win))); return PyLong_FromLong((long)(W_WIDTH(this->win)));
else if (strcmp(name, "col") == 0)
return PyLong_FromLong((long)(W_WINCOL(this->win)));
#endif #endif
else if (strcmp(name, "vars") == 0) else if (strcmp(name, "vars") == 0)
return DictionaryNew(this->win->w_vars); return DictionaryNew(this->win->w_vars);
@@ -1851,8 +1857,8 @@ WindowAttr(WindowObject *this, char *name)
else if (strcmp(name, "number") == 0) else if (strcmp(name, "number") == 0)
return PyLong_FromLong((long) get_win_number(this->win)); return PyLong_FromLong((long) get_win_number(this->win));
else if (strcmp(name,"__members__") == 0) else if (strcmp(name,"__members__") == 0)
return Py_BuildValue("[ssssss]", "buffer", "cursor", "height", "vars", return Py_BuildValue("[ssssssss]", "buffer", "cursor", "height", "vars",
"options", "number"); "options", "number", "row", "col");
else else
return NULL; return NULL;
} }

View File

@@ -728,6 +728,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
940,
/**/ /**/
939, 939,
/**/ /**/