Mercurial > vim
comparison src/main.c @ 9649:fd9727ae3c49 v7.4.2101
commit https://github.com/vim/vim/commit/2932359000b2f918d5fade79ea4d124d5943cd07
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jul 24 22:04:11 2016 +0200
patch 7.4.2101
Problem: Looping over windows, buffers and tab pages is inconsistant.
Solution: Use FOR_ALL_ macros everywhere. (Yegappan Lakshmanan)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 24 Jul 2016 22:15:07 +0200 |
parents | 00ee8d8c2e0c |
children | 284b4eb307fc |
comparison
equal
deleted
inserted
replaced
9648:227649fd4301 | 9649:fd9727ae3c49 |
---|---|
740 if (params.diff_mode) | 740 if (params.diff_mode) |
741 { | 741 { |
742 win_T *wp; | 742 win_T *wp; |
743 | 743 |
744 /* set options in each window for "vimdiff". */ | 744 /* set options in each window for "vimdiff". */ |
745 for (wp = firstwin; wp != NULL; wp = wp->w_next) | 745 FOR_ALL_WINDOWS(wp) |
746 diff_win_options(wp, TRUE); | 746 diff_win_options(wp, TRUE); |
747 } | 747 } |
748 #endif | 748 #endif |
749 | 749 |
750 /* | 750 /* |
1373 /* Trigger BufWinLeave for all windows, but only once per buffer. */ | 1373 /* Trigger BufWinLeave for all windows, but only once per buffer. */ |
1374 # if defined FEAT_WINDOWS | 1374 # if defined FEAT_WINDOWS |
1375 for (tp = first_tabpage; tp != NULL; tp = next_tp) | 1375 for (tp = first_tabpage; tp != NULL; tp = next_tp) |
1376 { | 1376 { |
1377 next_tp = tp->tp_next; | 1377 next_tp = tp->tp_next; |
1378 for (wp = (tp == curtab) | 1378 FOR_ALL_WINDOWS_IN_TAB(tp, wp) |
1379 ? firstwin : tp->tp_firstwin; wp != NULL; wp = wp->w_next) | |
1380 { | 1379 { |
1381 if (wp->w_buffer == NULL) | 1380 if (wp->w_buffer == NULL) |
1382 /* Autocmd must have close the buffer already, skip. */ | 1381 /* Autocmd must have close the buffer already, skip. */ |
1383 continue; | 1382 continue; |
1384 buf = wp->w_buffer; | 1383 buf = wp->w_buffer; |
1397 apply_autocmds(EVENT_BUFWINLEAVE, curbuf, curbuf->b_fname, | 1396 apply_autocmds(EVENT_BUFWINLEAVE, curbuf, curbuf->b_fname, |
1398 FALSE, curbuf); | 1397 FALSE, curbuf); |
1399 # endif | 1398 # endif |
1400 | 1399 |
1401 /* Trigger BufUnload for buffers that are loaded */ | 1400 /* Trigger BufUnload for buffers that are loaded */ |
1402 for (buf = firstbuf; buf != NULL; buf = buf->b_next) | 1401 FOR_ALL_BUFFERS(buf) |
1403 if (buf->b_ml.ml_mfp != NULL) | 1402 if (buf->b_ml.ml_mfp != NULL) |
1404 { | 1403 { |
1405 bufref_T bufref; | 1404 bufref_T bufref; |
1406 | 1405 |
1407 set_bufref(&bufref, buf); | 1406 set_bufref(&bufref, buf); |