diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-07-24 22:04:11 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-07-24 22:04:11 +0200 |
commit | 2932359000b2f918d5fade79ea4d124d5943cd07 (patch) | |
tree | 1ca4fa98569a4d20ce066c7d6254404bcf431b47 /src/ex_docmd.c | |
parent | 6835dc61aebca2b602d85a9d63c449ace58683b4 (diff) |
patch 7.4.2101v7.4.2101
Problem: Looping over windows, buffers and tab pages is inconsistant.
Solution: Use FOR_ALL_ macros everywhere. (Yegappan Lakshmanan)
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r-- | src/ex_docmd.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 41a228d229..28de56ab05 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -1708,7 +1708,7 @@ current_win_nr(win_T *win) win_T *wp; int nr = 0; - for (wp = firstwin; wp != NULL; wp = wp->w_next) + FOR_ALL_WINDOWS(wp) { ++nr; if (wp == win) @@ -1723,7 +1723,7 @@ current_tab_nr(tabpage_T *tab) tabpage_T *tp; int nr = 0; - for (tp = first_tabpage; tp != NULL; tp = tp->tp_next) + FOR_ALL_TABPAGES(tp) { ++nr; if (tp == tab) @@ -7273,7 +7273,7 @@ ex_close(exarg_T *eap) if (eap->addr_count == 0) ex_win_close(eap->forceit, curwin, NULL); else { - for (win = firstwin; win != NULL; win = win->w_next) + FOR_ALL_WINDOWS(win) { winnr++; if (winnr == eap->line2) @@ -7295,7 +7295,7 @@ ex_pclose(exarg_T *eap) { win_T *win; - for (win = firstwin; win != NULL; win = win->w_next) + FOR_ALL_WINDOWS(win) if (win->w_p_pvw) { ex_win_close(eap->forceit, win, NULL); @@ -7415,7 +7415,7 @@ ex_tabonly(exarg_T *eap) * up the lists. */ for (done = 0; done < 1000; ++done) { - for (tp = first_tabpage; tp != NULL; tp = tp->tp_next) + FOR_ALL_TABPAGES(tp) if (tp->tp_topframe != topframe) { tabpage_close_other(tp, eap->forceit); @@ -7474,6 +7474,10 @@ tabpage_close_other(tabpage_T *tp, int forceit) break; } +#ifdef FEAT_AUTOCMD + apply_autocmds(EVENT_TABCLOSED, NULL, NULL, FALSE, curbuf); +#endif + redraw_tabline = TRUE; if (h != tabline_height()) shell_new_rows(); @@ -7540,7 +7544,7 @@ ex_hide(exarg_T *eap) int winnr = 0; win_T *win; - for (win = firstwin; win != NULL; win = win->w_next) + FOR_ALL_WINDOWS(win) { winnr++; if (winnr == eap->line2) @@ -8686,7 +8690,7 @@ ex_syncbind(exarg_T *eap UNUSED) if (curwin->w_p_scb) { topline = curwin->w_topline; - for (wp = firstwin; wp; wp = wp->w_next) + FOR_ALL_WINDOWS(wp) { if (wp->w_p_scb && wp->w_buffer) { @@ -8707,7 +8711,7 @@ ex_syncbind(exarg_T *eap UNUSED) /* * Set all scrollbind windows to the same topline. */ - for (curwin = firstwin; curwin; curwin = curwin->w_next) + FOR_ALL_WINDOWS(curwin) { if (curwin->w_p_scb) { @@ -10957,7 +10961,7 @@ makeopens( return FAIL; /* Now put the other buffers into the buffer list */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) { if (!(only_save_windows && buf->b_nwindows == 0) && !(buf->b_help && !(ssop_flags & SSOP_HELP)) |