Mercurial > vim
comparison src/window.c @ 19888:435726a03481 v8.2.0500
patch 8.2.0500: using the same loop in many places
Commit: https://github.com/vim/vim/commit/aeea72151c31d686bcbb7b06d895006d7363585c
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Apr 2 18:50:46 2020 +0200
patch 8.2.0500: using the same loop in many places
Problem: Using the same loop in many places.
Solution: Define more FOR_ALL macros. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5339)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 02 Apr 2020 19:00:05 +0200 |
parents | 1d6bc6b31c2e |
children | 8c401bc7f32b |
comparison
equal
deleted
inserted
replaced
19887:d03edd8c7e2f | 19888:435726a03481 |
---|---|
1426 win_valid_popup(win_T *win UNUSED) | 1426 win_valid_popup(win_T *win UNUSED) |
1427 { | 1427 { |
1428 #ifdef FEAT_PROP_POPUP | 1428 #ifdef FEAT_PROP_POPUP |
1429 win_T *wp; | 1429 win_T *wp; |
1430 | 1430 |
1431 for (wp = first_popupwin; wp != NULL; wp = wp->w_next) | 1431 FOR_ALL_POPUPWINS(wp) |
1432 if (wp == win) | 1432 if (wp == win) |
1433 return TRUE; | 1433 return TRUE; |
1434 for (wp = curtab->tp_first_popupwin; wp != NULL; wp = wp->w_next) | 1434 FOR_ALL_POPUPWINS_IN_TAB(curtab, wp) |
1435 if (wp == win) | 1435 if (wp == win) |
1436 return TRUE; | 1436 return TRUE; |
1437 #endif | 1437 #endif |
1438 return FALSE; | 1438 return FALSE; |
1439 } | 1439 } |
1471 { | 1471 { |
1472 if (wp == win) | 1472 if (wp == win) |
1473 return TRUE; | 1473 return TRUE; |
1474 } | 1474 } |
1475 #ifdef FEAT_PROP_POPUP | 1475 #ifdef FEAT_PROP_POPUP |
1476 for (wp = tp->tp_first_popupwin; wp != NULL; wp = wp->w_next) | 1476 FOR_ALL_POPUPWINS_IN_TAB(tp, wp) |
1477 if (wp == win) | 1477 if (wp == win) |
1478 return TRUE; | 1478 return TRUE; |
1479 #endif | 1479 #endif |
1480 } | 1480 } |
1481 return win_valid_popup(win); | 1481 return win_valid_popup(win); |
2274 // Also check windows in other tab pages. | 2274 // Also check windows in other tab pages. |
2275 for (tp = first_tabpage; tp != NULL; tp = nexttp) | 2275 for (tp = first_tabpage; tp != NULL; tp = nexttp) |
2276 { | 2276 { |
2277 nexttp = tp->tp_next; | 2277 nexttp = tp->tp_next; |
2278 if (tp != curtab) | 2278 if (tp != curtab) |
2279 for (wp = tp->tp_firstwin; wp != NULL; wp = wp->w_next) | 2279 FOR_ALL_WINDOWS_IN_TAB(tp, wp) |
2280 if (wp->w_buffer == buf | 2280 if (wp->w_buffer == buf |
2281 && !(wp->w_closing || wp->w_buffer->b_locked > 0)) | 2281 && !(wp->w_closing || wp->w_buffer->b_locked > 0)) |
2282 { | 2282 { |
2283 win_close_othertab(wp, FALSE, tp); | 2283 win_close_othertab(wp, FALSE, tp); |
2284 | 2284 |
4783 return wp; | 4783 return wp; |
4784 | 4784 |
4785 FOR_ALL_TABPAGES(tp) | 4785 FOR_ALL_TABPAGES(tp) |
4786 if (tp != curtab) | 4786 if (tp != curtab) |
4787 { | 4787 { |
4788 for (wp = tp->tp_firstwin; wp != NULL; wp = wp->w_next) | 4788 FOR_ALL_WINDOWS_IN_TAB(tp, wp) |
4789 if (wp->w_buffer == buf) | 4789 if (wp->w_buffer == buf) |
4790 break; | 4790 break; |
4791 if (wp != NULL) | 4791 if (wp != NULL) |
4792 { | 4792 { |
4793 goto_tabpage_win(tp, wp); | 4793 goto_tabpage_win(tp, wp); |
4966 vim_free(wp->w_localdir); | 4966 vim_free(wp->w_localdir); |
4967 | 4967 |
4968 // Remove the window from the b_wininfo lists, it may happen that the | 4968 // Remove the window from the b_wininfo lists, it may happen that the |
4969 // freed memory is re-used for another window. | 4969 // freed memory is re-used for another window. |
4970 FOR_ALL_BUFFERS(buf) | 4970 FOR_ALL_BUFFERS(buf) |
4971 for (wip = buf->b_wininfo; wip != NULL; wip = wip->wi_next) | 4971 FOR_ALL_BUF_WININFO(buf, wip) |
4972 if (wip->wi_win == wp) | 4972 if (wip->wi_win == wp) |
4973 wip->wi_win = NULL; | 4973 wip->wi_win = NULL; |
4974 | 4974 |
4975 #ifdef FEAT_SEARCH_EXTRA | 4975 #ifdef FEAT_SEARCH_EXTRA |
4976 clear_matches(wp); | 4976 clear_matches(wp); |