0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 7.4.1895

Problem:    Cannot use a window ID where a window number is expected.
Solution:   Add LOWEST_WIN_ID, so that the window ID can be used where a
            number is expected.
This commit is contained in:
Bram Moolenaar
2016-06-04 18:49:36 +02:00
parent 511972d810
commit 888ccac890
6 changed files with 50 additions and 10 deletions

View File

@@ -13566,11 +13566,18 @@ find_win_by_nr(
for (wp = (tp == NULL || tp == curtab) ? firstwin : tp->tp_firstwin;
wp != NULL; wp = wp->w_next)
if (--nr <= 0)
if (nr >= LOWEST_WIN_ID)
{
if (wp->w_id == nr)
return wp;
}
else if (--nr <= 0)
break;
if (nr >= LOWEST_WIN_ID)
return NULL;
return wp;
#else
if (nr == 0 || nr == 1)
if (nr == 0 || nr == 1 || nr == curwin->w_id)
return curwin;
return NULL;
#endif