Patch 7.4.2101
Problem: Looping over windows, buffers and tab pages is inconsistant.
Solution: Use FOR_ALL_ macros everywhere. (Yegappan Lakshmanan)
Files: src/buffer.c, src/diff.c, src/edit.c, src/eval.c, src/evalfunc.c,
src/ex_cmds.c, src/ex_cmds2.c, src/ex_docmd.c, src/fileio.c,
src/globals.h, src/gui.c, src/gui_mac.c, src/if_lua.c,
src/if_mzsch.c, src/if_perl.xs, src/if_ruby.c, src/if_tcl.c,
src/main.c, src/mark.c, src/memfile.c, src/memline.c, src/misc1.c,
src/move.c, src/netbeans.c, src/normal.c, src/option.c,
src/quickfix.c, src/screen.c, src/spell.c, src/term.c,
src/window.c, src/workshop.c
*** ../vim-7.4.2100/src/buffer.c 2016-07-24 16:17:55.749759245 +0200
--- src/buffer.c 2016-07-24 21:51:19.884109062 +0200
***************
*** 105,111 ****
* If we can't create one for the current buffer, take another buffer
*/
close_buffer(NULL, curbuf, 0, FALSE);
! for (curbuf = firstbuf; curbuf != NULL; curbuf = curbuf->b_next)
if (curbuf->b_ml.ml_mfp != NULL)
break;
/*
--- 105,111 ----
* If we can't create one for the current buffer, take another buffer
*/
close_buffer(NULL, curbuf, 0, FALSE);
! FOR_ALL_BUFFERS(curbuf)
if (curbuf->b_ml.ml_mfp != NULL)
break;
/*
***************
*** 1284,1290 ****
* If deleting the last (listed) buffer, make it empty.
* The last (listed) buffer cannot be unloaded.
*/
! for (bp = firstbuf; bp != NULL; bp = bp->b_next)
if (bp->b_p_bl && bp != buf)
break;
if (bp == NULL && buf == curbuf)
--- 1284,1290 ----
* If deleting the last (listed) buffer, make it empty.
* The last (listed) buffer cannot be unloaded.
*/
! FOR_ALL_BUFFERS(bp)
if (bp->b_p_bl && bp != buf)
break;
if (bp == NULL && buf == curbuf)
***************
*** 1410,1416 ****
buf = bp;
if (buf == NULL) /* No loaded buffer, find listed one */
{
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
if (buf->b_p_bl && buf != curbuf)
break;
}
--- 1410,1416 ----
buf = bp;
if (buf == NULL) /* No loaded buffer, find listed one */
{
! FOR_ALL_BUFFERS(buf)
if (buf->b_p_bl && buf != curbuf)
break;
}
***************
*** 2406,2412 ****
#ifdef FEAT_WINDOWS
win_T *wp;
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
if (wp->w_buffer == buf)
break;
if (wp == NULL)
--- 2406,2412 ----
#ifdef FEAT_WINDOWS
win_T *wp;
! FOR_ALL_WINDOWS(wp)
if (wp->w_buffer == buf)
break;
if (wp == NULL)
***************
*** 2508,2514 ****
for (round = 1; round <= 2; ++round)
{
count = 0;
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
{
if (!buf->b_p_bl) /* skip unlisted buffers */
continue;
--- 2508,2514 ----
for (round = 1; round <= 2; ++round)
{
count = 0;
! FOR_ALL_BUFFERS(buf)
{
if (!buf->b_p_bl) /* skip unlisted buffers */
continue;
***************
*** 2734,2740 ****
if (wip->wi_opt.wo_diff)
{
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
/* return FALSE when it's a window in the current tab page, thus
* the buffer was in diff mode here */
if (wip->wi_win == wp)
--- 2734,2740 ----
if (wip->wi_opt.wo_diff)
{
! FOR_ALL_WINDOWS(wp)
/* return FALSE when it's a window in the current tab page, thus
* the buffer was in diff mode here */
if (wip->wi_win == wp)
***************
*** 3153,3159 ****
{
buf_T *bp;
! for (bp = firstbuf; bp != NULL; bp = bp->b_next)
{
if (bp->b_ffname != NULL)
slash_adjust(bp->b_ffname);
--- 3153,3159 ----
{
buf_T *bp;
! FOR_ALL_BUFFERS(bp)
{
if (bp->b_ffname != NULL)
slash_adjust(bp->b_ffname);
***************
*** 5083,5089 ****
#endif
{
/* Check if this buffer already has a window */
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
if (wp->w_buffer == buf)
break;
/* If the buffer already has a window, move it */
--- 5083,5089 ----
#endif
{
/* Check if this buffer already has a window */
! FOR_ALL_WINDOWS(wp)
if (wp->w_buffer == buf)
break;
/* If the buffer already has a window, move it */
***************
*** 5461,5467 ****
#endif
fputs(_("\n# Buffer list:\n"), fp);
! for (buf = firstbuf; buf != NULL ; buf = buf->b_next)
{
if (buf->b_fname == NULL
|| !buf->b_p_bl
--- 5461,5467 ----
#endif
fputs(_("\n# Buffer list:\n"), fp);
! FOR_ALL_BUFFERS(buf)
{
if (buf->b_fname == NULL
|| !buf->b_p_bl
***************
*** 5847,5853 ****
{
buf_T *buf; /* buffer we are checking for signs */
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
if (buf->b_signlist != NULL)
buf_delete_signs(buf);
}
--- 5847,5853 ----
{
buf_T *buf; /* buffer we are checking for signs */
! FOR_ALL_BUFFERS(buf)
if (buf->b_signlist != NULL)
buf_delete_signs(buf);
}
*** ../vim-7.4.2100/src/diff.c 2016-07-10 22:11:11.858751521 +0200
--- src/diff.c 2016-07-24 21:51:19.884109062 +0200
***************
*** 65,71 ****
int i;
tabpage_T *tp;
! for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
{
i = diff_buf_idx_tp(buf, tp);
if (i != DB_COUNT)
--- 65,71 ----
int i;
tabpage_T *tp;
! FOR_ALL_TABPAGES(tp)
{
i = diff_buf_idx_tp(buf, tp);
if (i != DB_COUNT)
***************
*** 92,98 ****
{
/* When there is no window showing a diff for this buffer, remove
* it from the diffs. */
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
if (wp->w_buffer == win->w_buffer && wp->w_p_diff)
break;
if (wp == NULL)
--- 92,98 ----
{
/* When there is no window showing a diff for this buffer, remove
* it from the diffs. */
! FOR_ALL_WINDOWS(wp)
if (wp->w_buffer == win->w_buffer && wp->w_p_diff)
break;
if (wp == NULL)
***************
*** 178,184 ****
tabpage_T *tp;
int i;
! for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
{
i = diff_buf_idx_tp(buf, tp);
if (i != DB_COUNT)
--- 178,184 ----
tabpage_T *tp;
int i;
! FOR_ALL_TABPAGES(tp)
{
i = diff_buf_idx_tp(buf, tp);
if (i != DB_COUNT)
***************
*** 204,210 ****
tabpage_T *tp;
/* Handle all tab pages that use the current buffer in a diff. */
! for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
{
idx = diff_buf_idx_tp(curbuf, tp);
if (idx != DB_COUNT)
--- 204,210 ----
tabpage_T *tp;
/* Handle all tab pages that use the current buffer in a diff. */
! FOR_ALL_TABPAGES(tp)
{
idx = diff_buf_idx_tp(curbuf, tp);
if (idx != DB_COUNT)
***************
*** 591,597 ****
win_T *wp;
int n;
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
if (wp->w_p_diff)
{
redraw_win_later(wp, SOME_VALID);
--- 591,597 ----
win_T *wp;
int n;
! FOR_ALL_WINDOWS(wp)
if (wp->w_p_diff)
{
redraw_win_later(wp, SOME_VALID);
***************
*** 1198,1204 ****
int diffwin = FALSE;
#endif
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
{
if (eap->forceit ? wp->w_p_diff : wp == curwin)
{
--- 1198,1204 ----
int diffwin = FALSE;
#endif
! FOR_ALL_WINDOWS(wp)
{
if (eap->forceit ? wp->w_p_diff : wp == curwin)
{
***************
*** 1879,1885 ****
/* If "icase" or "iwhite" was added or removed, need to update the diff.
*/
if (diff_flags != diff_flags_new)
! for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
tp->tp_diff_invalid = TRUE;
diff_flags = diff_flags_new;
--- 1879,1885 ----
/* If "icase" or "iwhite" was added or removed, need to update the diff.
*/
if (diff_flags != diff_flags_new)
! FOR_ALL_TABPAGES(tp)
tp->tp_diff_invalid = TRUE;
diff_flags = diff_flags_new;
***************
*** 2434,2440 ****
int i;
win_T *wp;
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
for (i = 0; i < DB_COUNT; ++i)
if (curtab->tp_diffbuf[i] == wp->w_buffer && i != skip_idx)
foldUpdate(wp, dp->df_lnum[i],
--- 2434,2440 ----
int i;
win_T *wp;
! FOR_ALL_WINDOWS(wp)
for (i = 0; i < DB_COUNT; ++i)
if (curtab->tp_diffbuf[i] == wp->w_buffer && i != skip_idx)
foldUpdate(wp, dp->df_lnum[i],
***************
*** 2450,2456 ****
{
tabpage_T *tp;
! for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
if (diff_buf_idx_tp(buf, tp) != DB_COUNT)
return TRUE;
return FALSE;
--- 2450,2456 ----
{
tabpage_T *tp;
! FOR_ALL_TABPAGES(tp)
if (diff_buf_idx_tp(buf, tp) != DB_COUNT)
return TRUE;
return FALSE;
*** ../vim-7.4.2100/src/edit.c 2016-07-09 21:57:16.630640033 +0200
--- src/edit.c 2016-07-24 21:51:19.888109025 +0200
***************
*** 4239,4245 ****
if (!compl_started)
{
! for (ins_buf = firstbuf; ins_buf != NULL; ins_buf = ins_buf->b_next)
ins_buf->b_scanned = 0;
found_all = FALSE;
ins_buf = curbuf;
--- 4239,4245 ----
if (!compl_started)
{
! FOR_ALL_BUFFERS(ins_buf)
ins_buf->b_scanned = 0;
found_all = FALSE;
ins_buf = curbuf;
*** ../vim-7.4.2100/src/eval.c 2016-07-23 15:35:14.149577033 +0200
--- src/eval.c 2016-07-24 21:51:19.888109025 +0200
***************
*** 5253,5259 ****
abort = abort || set_ref_in_ht(&SCRIPT_VARS(i), copyID, NULL);
/* buffer-local variables */
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
abort = abort || set_ref_in_item(&buf->b_bufvar.di_tv, copyID,
NULL, NULL);
--- 5253,5259 ----
abort = abort || set_ref_in_ht(&SCRIPT_VARS(i), copyID, NULL);
/* buffer-local variables */
! FOR_ALL_BUFFERS(buf)
abort = abort || set_ref_in_item(&buf->b_bufvar.di_tv, copyID,
NULL, NULL);
***************
*** 5269,5275 ****
#ifdef FEAT_WINDOWS
/* tabpage-local variables */
! for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
abort = abort || set_ref_in_item(&tp->tp_winvar.di_tv, copyID,
NULL, NULL);
#endif
--- 5269,5275 ----
#ifdef FEAT_WINDOWS
/* tabpage-local variables */
! FOR_ALL_TABPAGES(tp)
abort = abort || set_ref_in_item(&tp->tp_winvar.di_tv, copyID,
NULL, NULL);
#endif
***************
*** 8303,8310 ****
if (nr == 0)
return curwin;
! for (wp = (tp == NULL || tp == curtab) ? firstwin : tp->tp_firstwin;
! wp != NULL; wp = wp->w_next)
if (nr >= LOWEST_WIN_ID)
{
if (wp->w_id == nr)
--- 8303,8310 ----
if (nr == 0)
return curwin;
! FOR_ALL_WINDOWS_IN_TAB(tp, wp)
! {
if (nr >= LOWEST_WIN_ID)
{
if (wp->w_id == nr)
***************
*** 8312,8317 ****
--- 8312,8318 ----
}
else if (--nr <= 0)
break;
+ }
if (nr >= LOWEST_WIN_ID)
return NULL;
return wp;
*** ../vim-7.4.2100/src/evalfunc.c 2016-07-23 15:35:14.157576957 +0200
--- src/evalfunc.c 2016-07-24 21:51:19.888109025 +0200
***************
*** 1439,1445 ****
{
/* No full path name match, try a match with a URL or a "nofile"
* buffer, these don't use the full path. */
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
if (buf->b_fname != NULL
&& (path_with_url(buf->b_fname)
#ifdef FEAT_QUICKFIX
--- 1439,1445 ----
{
/* No full path name match, try a match with a URL or a "nofile"
* buffer, these don't use the full path. */
! FOR_ALL_BUFFERS(buf)
if (buf->b_fname != NULL
&& (path_with_url(buf->b_fname)
#ifdef FEAT_QUICKFIX
***************
*** 1597,1603 ****
++emsg_off;
buf = get_buf_tv(&argvars[0], TRUE);
#ifdef FEAT_WINDOWS
! for (wp = firstwin; wp; wp = wp->w_next)
{
++winnr;
if (wp->w_buffer == buf)
--- 1597,1603 ----
++emsg_off;
buf = get_buf_tv(&argvars[0], TRUE);
#ifdef FEAT_WINDOWS
! FOR_ALL_WINDOWS(wp)
{
++winnr;
if (wp->w_buffer == buf)
***************
*** 6383,6389 ****
int n = 0;
buf_T *buf;
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
if (n < buf->b_fnum)
n = buf->b_fnum;
--- 6383,6389 ----
int n = 0;
buf_T *buf;
! FOR_ALL_BUFFERS(buf)
if (n < buf->b_fnum)
n = buf->b_fnum;
***************
*** 12373,12379 ****
char_u buf[50];
ga_init2(&ga, (int)sizeof(char), 70);
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
{
sprintf((char *)buf, "%dresize %d|", winnr, wp->w_height);
ga_concat(&ga, buf);
--- 12373,12379 ----
char_u buf[50];
ga_init2(&ga, (int)sizeof(char), 70);
! FOR_ALL_WINDOWS(wp)
{
sprintf((char *)buf, "%dresize %d|", winnr, wp->w_height);
ga_concat(&ga, buf);
*** ../vim-7.4.2100/src/ex_cmds.c 2016-07-10 22:11:11.854751580 +0200
--- src/ex_cmds.c 2016-07-24 21:51:19.892108988 +0200
***************
*** 1497,1503 ****
&& !autocmd_busy
#endif
&& msg_silent == 0)
! for (buf = firstbuf; buf; buf = buf->b_next)
if (bufIsChanged(buf))
{
#ifdef FEAT_GUI_MSWIN
--- 1497,1503 ----
&& !autocmd_busy
#endif
&& msg_silent == 0)
! FOR_ALL_BUFFERS(buf)
if (bufIsChanged(buf))
{
#ifdef FEAT_GUI_MSWIN
***************
*** 2345,2351 ****
#endif
/* Change file names to buffer numbers for fmarks. */
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
fmarks_check_names(buf);
return eof;
--- 2345,2351 ----
#endif
/* Change file names to buffer numbers for fmarks. */
! FOR_ALL_BUFFERS(buf)
fmarks_check_names(buf);
return eof;
***************
*** 3413,3419 ****
if (eap->cmdidx == CMD_xall || eap->cmdidx == CMD_wqall)
exiting = TRUE;
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
{
if (bufIsChanged(buf))
{
--- 3413,3419 ----
if (eap->cmdidx == CMD_xall || eap->cmdidx == CMD_wqall)
exiting = TRUE;
! FOR_ALL_BUFFERS(buf)
{
if (bufIsChanged(buf))
{
***************
*** 6115,6121 ****
*/
if (!curwin->w_p_pvw)
{
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
if (wp->w_p_pvw)
break;
if (wp != NULL)
--- 6115,6121 ----
*/
if (!curwin->w_p_pvw)
{
! FOR_ALL_WINDOWS(wp)
if (wp->w_p_pvw)
break;
if (wp != NULL)
***************
*** 6272,6278 ****
if (cmdmod.tab != 0)
wp = NULL;
else
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
if (wp->w_buffer != NULL && wp->w_buffer->b_help)
break;
if (wp != NULL && wp->w_buffer->b_nwindows > 0)
--- 6272,6278 ----
if (cmdmod.tab != 0)
wp = NULL;
else
! FOR_ALL_WINDOWS(wp)
if (wp->w_buffer != NULL && wp->w_buffer->b_help)
break;
if (wp != NULL && wp->w_buffer->b_nwindows > 0)
***************
*** 7745,7751 ****
if (idx == SIGNCMD_UNPLACE && *arg == NUL)
{
/* ":sign unplace {id}": remove placed sign by number */
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
if ((lnum = buf_delsign(buf, id)) != 0)
update_debug_sign(buf, lnum);
return;
--- 7745,7751 ----
if (idx == SIGNCMD_UNPLACE && *arg == NUL)
{
/* ":sign unplace {id}": remove placed sign by number */
! FOR_ALL_BUFFERS(buf)
if ((lnum = buf_delsign(buf, id)) != 0)
update_debug_sign(buf, lnum);
return;
*** ../vim-7.4.2100/src/ex_cmds2.c 2016-07-22 21:49:36.678031435 +0200
--- src/ex_cmds2.c 2016-07-24 21:51:19.892108988 +0200
***************
*** 1721,1727 ****
if (!(p_aw || p_awa) || !p_write)
return;
! for (buf = firstbuf; buf; buf = buf->b_next)
if (bufIsChanged(buf) && !buf->b_p_ro)
{
#ifdef FEAT_AUTOCMD
--- 1721,1727 ----
if (!(p_aw || p_awa) || !p_write)
return;
! FOR_ALL_BUFFERS(buf)
if (bufIsChanged(buf) && !buf->b_p_ro)
{
#ifdef FEAT_AUTOCMD
***************
*** 1764,1770 ****
int count = 0;
if (flags & CCGD_ALLBUF)
! for (buf2 = firstbuf; buf2 != NULL; buf2 = buf2->b_next)
if (bufIsChanged(buf2)
&& (buf2->b_ffname != NULL
# ifdef FEAT_BROWSE
--- 1764,1770 ----
int count = 0;
if (flags & CCGD_ALLBUF)
! FOR_ALL_BUFFERS(buf2)
if (bufIsChanged(buf2)
&& (buf2->b_ffname != NULL
# ifdef FEAT_BROWSE
***************
*** 1868,1874 ****
* Skip readonly buffers, these need to be confirmed
* individually.
*/
! for (buf2 = firstbuf; buf2 != NULL; buf2 = buf2->b_next)
{
if (bufIsChanged(buf2)
&& (buf2->b_ffname != NULL
--- 1868,1874 ----
* Skip readonly buffers, these need to be confirmed
* individually.
*/
! FOR_ALL_BUFFERS(buf2)
{
if (bufIsChanged(buf2)
&& (buf2->b_ffname != NULL
***************
*** 1904,1910 ****
/*
* mark all buffers as unchanged
*/
! for (buf2 = firstbuf; buf2 != NULL; buf2 = buf2->b_next)
unchanged(buf2, TRUE);
}
}
--- 1904,1910 ----
/*
* mark all buffers as unchanged
*/
! FOR_ALL_BUFFERS(buf2)
unchanged(buf2, TRUE);
}
}
***************
*** 1964,1970 ****
win_T *wp;
#endif
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
++bufcount;
if (bufcount == 0)
--- 1964,1970 ----
win_T *wp;
#endif
! FOR_ALL_BUFFERS(buf)
++bufcount;
if (bufcount == 0)
***************
*** 1983,1995 ****
add_bufnum(bufnrs, &bufnum, wp->w_buffer->b_fnum);
/* buf in other tab */
! for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
if (tp != curtab)
for (wp = tp->tp_firstwin; wp != NULL; wp = wp->w_next)
add_bufnum(bufnrs, &bufnum, wp->w_buffer->b_fnum);
#endif
/* any other buf */
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
add_bufnum(bufnrs, &bufnum, buf->b_fnum);
for (i = 0; i < bufnum; ++i)
--- 1983,1995 ----
add_bufnum(bufnrs, &bufnum, wp->w_buffer->b_fnum);
/* buf in other tab */
! FOR_ALL_TABPAGES(tp)
if (tp != curtab)
for (wp = tp->tp_firstwin; wp != NULL; wp = wp->w_next)
add_bufnum(bufnrs, &bufnum, wp->w_buffer->b_fnum);
#endif
/* any other buf */
! FOR_ALL_BUFFERS(buf)
add_bufnum(bufnrs, &bufnum, buf->b_fnum);
for (i = 0; i < bufnum; ++i)
***************
*** 2924,2930 ****
if (next_fnum < 0 || next_fnum > eap->line2)
break;
/* Check if the buffer still exists. */
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
if (buf->b_fnum == next_fnum)
break;
if (buf == NULL)
--- 2924,2930 ----
if (next_fnum < 0 || next_fnum > eap->line2)
break;
/* Check if the buffer still exists. */
! FOR_ALL_BUFFERS(buf)
if (buf->b_fnum == next_fnum)
break;
if (buf == NULL)
*** ../vim-7.4.2100/src/ex_docmd.c 2016-07-16 16:54:18.334699590 +0200
--- src/ex_docmd.c 2016-07-24 21:51:19.892108988 +0200
***************
*** 1708,1714 ****
win_T *wp;
int nr = 0;
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
{
++nr;
if (wp == win)
--- 1708,1714 ----
win_T *wp;
int nr = 0;
! FOR_ALL_WINDOWS(wp)
{
++nr;
if (wp == win)
***************
*** 1723,1729 ****
tabpage_T *tp;
int nr = 0;
! for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
{
++nr;
if (tp == tab)
--- 1723,1729 ----
tabpage_T *tp;
int nr = 0;
! FOR_ALL_TABPAGES(tp)
{
++nr;
if (tp == tab)
***************
*** 7273,7279 ****
if (eap->addr_count == 0)
ex_win_close(eap->forceit, curwin, NULL);
else {
! for (win = firstwin; win != NULL; win = win->w_next)
{
winnr++;
if (winnr == eap->line2)
--- 7273,7279 ----
if (eap->addr_count == 0)
ex_win_close(eap->forceit, curwin, NULL);
else {
! FOR_ALL_WINDOWS(win)
{
winnr++;
if (winnr == eap->line2)
***************
*** 7295,7301 ****
{
win_T *win;
! for (win = firstwin; win != NULL; win = win->w_next)
if (win->w_p_pvw)
{
ex_win_close(eap->forceit, win, NULL);
--- 7295,7301 ----
{
win_T *win;
! FOR_ALL_WINDOWS(win)
if (win->w_p_pvw)
{
ex_win_close(eap->forceit, win, NULL);
***************
*** 7415,7421 ****
* up the lists. */
for (done = 0; done < 1000; ++done)
{
! for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
if (tp->tp_topframe != topframe)
{
tabpage_close_other(tp, eap->forceit);
--- 7415,7421 ----
* up the lists. */
for (done = 0; done < 1000; ++done)
{
! FOR_ALL_TABPAGES(tp)
if (tp->tp_topframe != topframe)
{
tabpage_close_other(tp, eap->forceit);
***************
*** 7474,7479 ****
--- 7474,7483 ----
break;
}
+ #ifdef FEAT_AUTOCMD
+ apply_autocmds(EVENT_TABCLOSED, NULL, NULL, FALSE, curbuf);
+ #endif
+
redraw_tabline = TRUE;
if (h != tabline_height())
shell_new_rows();
***************
*** 7540,7546 ****
int winnr = 0;
win_T *win;
! for (win = firstwin; win != NULL; win = win->w_next)
{
winnr++;
if (winnr == eap->line2)
--- 7544,7550 ----
int winnr = 0;
win_T *win;
! FOR_ALL_WINDOWS(win)
{
winnr++;
if (winnr == eap->line2)
***************
*** 8686,8692 ****
if (curwin->w_p_scb)
{
topline = curwin->w_topline;
! for (wp = firstwin; wp; wp = wp->w_next)
{
if (wp->w_p_scb && wp->w_buffer)
{
--- 8690,8696 ----
if (curwin->w_p_scb)
{
topline = curwin->w_topline;
! FOR_ALL_WINDOWS(wp)
{
if (wp->w_p_scb && wp->w_buffer)
{
***************
*** 8707,8713 ****
/*
* Set all scrollbind windows to the same topline.
*/
! for (curwin = firstwin; curwin; curwin = curwin->w_next)
{
if (curwin->w_p_scb)
{
--- 8711,8717 ----
/*
* Set all scrollbind windows to the same topline.
*/
! FOR_ALL_WINDOWS(curwin)
{
if (curwin->w_p_scb)
{
***************
*** 10957,10963 ****
return FAIL;
/* Now put the other buffers into the buffer list */
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
{
if (!(only_save_windows && buf->b_nwindows == 0)
&& !(buf->b_help && !(ssop_flags & SSOP_HELP))
--- 10961,10967 ----
return FAIL;
/* Now put the other buffers into the buffer list */
! FOR_ALL_BUFFERS(buf)
{
if (!(only_save_windows && buf->b_nwindows == 0)
&& !(buf->b_help && !(ssop_flags & SSOP_HELP))
*** ../vim-7.4.2100/src/fileio.c 2016-07-19 23:12:18.712611729 +0200
--- src/fileio.c 2016-07-24 21:51:19.892108988 +0200
***************
*** 6088,6094 ****
char_u *p;
mch_dirname(dirname, MAXPATHL);
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
{
if (buf->b_fname != NULL
#ifdef FEAT_QUICKFIX
--- 6088,6094 ----
char_u *p;
mch_dirname(dirname, MAXPATHL);
! FOR_ALL_BUFFERS(buf)
{
if (buf->b_fname != NULL
#ifdef FEAT_QUICKFIX
***************
*** 6680,6686 ****
++no_wait_return;
did_check_timestamps = TRUE;
already_warned = FALSE;
! for (buf = firstbuf; buf != NULL; )
{
/* Only check buffers in a window. */
if (buf->b_nwindows > 0)
--- 6680,6686 ----
++no_wait_return;
did_check_timestamps = TRUE;
already_warned = FALSE;
! FOR_ALL_BUFFERS(buf)
{
/* Only check buffers in a window. */
if (buf->b_nwindows > 0)
***************
*** 6699,6705 ****
continue;
}
}
- buf = buf->b_next;
}
--no_wait_return;
need_check_timestamps = FALSE;
--- 6699,6704 ----
***************
*** 8759,8765 ****
* gives problems when the autocommands make changes to the list of
* buffers or windows...
*/
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
{
if (buf->b_ml.ml_mfp != NULL)
{
--- 8758,8764 ----
* gives problems when the autocommands make changes to the list of
* buffers or windows...
*/
! FOR_ALL_BUFFERS(buf)
{
if (buf->b_ml.ml_mfp != NULL)
{
***************
*** 8831,8837 ****
win = curwin;
else
#ifdef FEAT_WINDOWS
! for (win = firstwin; win != NULL; win = win->w_next)
if (win->w_buffer == buf)
break;
#else
--- 8830,8836 ----
win = curwin;
else
#ifdef FEAT_WINDOWS
! FOR_ALL_WINDOWS(win)
if (win->w_buffer == buf)
break;
#else
*** ../vim-7.4.2100/src/globals.h 2016-07-17 22:13:26.813095293 +0200
--- src/globals.h 2016-07-24 21:51:19.896108951 +0200
***************
*** 548,553 ****
--- 548,557 ----
EXTERN win_T *prevwin INIT(= NULL); /* previous window */
# define W_NEXT(wp) ((wp)->w_next)
# define FOR_ALL_WINDOWS(wp) for (wp = firstwin; wp != NULL; wp = wp->w_next)
+ # define FOR_ALL_TABPAGES(tp) for (tp = first_tabpage; tp != NULL; tp =
tp->tp_next)
+ # define FOR_ALL_WINDOWS_IN_TAB(tp, wp) \
+ for ((wp) = ((tp) == NULL || (tp) == curtab) \
+ ? firstwin : (tp)->tp_firstwin; (wp); (wp) = (wp)->w_next)
/*
* When using this macro "break" only breaks out of the inner loop. Use "goto"
* to break out of the tabpage loop.
***************
*** 561,566 ****
--- 565,572 ----
# define lastwin curwin
# define W_NEXT(wp) NULL
# define FOR_ALL_WINDOWS(wp) wp = curwin;
+ # define FOR_ALL_TABPAGES(tp) for (;FALSE;)
+ # define FOR_ALL_WINDOWS_IN_TAB(tp, wp) wp = curwin;
# define FOR_ALL_TAB_WINDOWS(tp, wp) wp = curwin;
#endif
***************
*** 595,600 ****
--- 601,608 ----
EXTERN buf_T *lastbuf INIT(= NULL); /* last buffer */
EXTERN buf_T *curbuf INIT(= NULL); /* currently active buffer */
+ #define FOR_ALL_BUFFERS(buf) for (buf = firstbuf; buf != NULL; buf =
buf->b_next)
+
/* Flag that is set when switching off 'swapfile'. It means that all blocks
* are to be loaded into memory. Shouldn't be global... */
EXTERN int mf_dont_release INIT(= FALSE); /* don't release blocks */
*** ../vim-7.4.2100/src/gui.c 2016-07-01 17:17:13.286266820 +0200
--- src/gui.c 2016-07-24 21:51:19.896108951 +0200
***************
*** 4082,4088 ****
{
do_check_scrollbind(TRUE);
/* need to update the window right here */
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
if (wp->w_redr_type > 0)
updateWindow(wp);
setcursor();
--- 4082,4088 ----
{
do_check_scrollbind(TRUE);
/* need to update the window right here */
! FOR_ALL_WINDOWS(wp)
if (wp->w_redr_type > 0)
updateWindow(wp);
setcursor();
***************
*** 4166,4172 ****
/* avoid that moving components around generates events */
++hold_gui_events;
! for (wp = firstwin; wp != NULL; wp = W_NEXT(wp))
{
if (wp->w_buffer == NULL) /* just in case */
continue;
--- 4166,4172 ----
/* avoid that moving components around generates events */
++hold_gui_events;
! FOR_ALL_WINDOWS(wp)
{
if (wp->w_buffer == NULL) /* just in case */
continue;
*** ../vim-7.4.2100/src/gui_mac.c 2016-07-07 16:42:57.314788421 +0200
--- src/gui_mac.c 2016-07-24 21:51:19.896108951 +0200
***************
*** 633,639 ****
if (error)
return error;
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
if (buf->b_ml.ml_mfp != NULL
&& SearchData.theFile.parID == buf->b_FSSpec.parID
&& SearchData.theFile.name[0] == buf->b_FSSpec.name[0]
--- 633,639 ----
if (error)
return error;
! FOR_ALL_BUFFERS(buf)
if (buf->b_ml.ml_mfp != NULL
&& SearchData.theFile.parID == buf->b_FSSpec.parID
&& SearchData.theFile.name[0] == buf->b_FSSpec.name[0]
***************
*** 725,731 ****
#endif
numFiles = 0;
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
if (buf->b_ml.ml_mfp != NULL)
{
/* Add this file to the list */
--- 725,731 ----
#endif
numFiles = 0;
! FOR_ALL_BUFFERS(buf)
if (buf->b_ml.ml_mfp != NULL)
{
/* Add this file to the list */
***************
*** 807,813 ****
if (error)
return error;
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
if (buf->b_ml.ml_mfp != NULL)
if (GetTextData.theFile.parID == buf->b_FSSpec.parID)
{
--- 807,813 ----
if (error)
return error;
! FOR_ALL_BUFFERS(buf)
if (buf->b_ml.ml_mfp != NULL)
if (GetTextData.theFile.parID == buf->b_FSSpec.parID)
{
***************
*** 6422,6428 ****
tabpage_T *tp;
int numTabs = 0;
! for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
++numTabs;
return numTabs;
}
--- 6422,6428 ----
tabpage_T *tp;
int numTabs = 0;
! FOR_ALL_TABPAGES(tp)
++numTabs;
return numTabs;
}
*** ../vim-7.4.2100/src/if_lua.c 2016-03-19 22:11:47.424674965 +0100
--- src/if_lua.c 2016-07-24 21:51:19.896108951 +0200
***************
*** 1402,1414 ****
if (lua_isnumber(L, 1)) /* by number? */
{
int n = lua_tointeger(L, 1);
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
if (buf->b_fnum == n) break;
}
else { /* by name */
size_t l;
const char *s = lua_tolstring(L, 1, &l);
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
{
if (buf->b_ffname == NULL || buf->b_sfname == NULL)
{
--- 1402,1414 ----
if (lua_isnumber(L, 1)) /* by number? */
{
int n = lua_tointeger(L, 1);
! FOR_ALL_BUFFERS(buf)
if (buf->b_fnum == n) break;
}
else { /* by name */
size_t l;
const char *s = lua_tolstring(L, 1, &l);
! FOR_ALL_BUFFERS(buf)
{
if (buf->b_ffname == NULL || buf->b_sfname == NULL)
{
*** ../vim-7.4.2100/src/if_mzsch.c 2016-06-13 19:54:18.392171818 +0200
--- src/if_mzsch.c 2016-07-24 21:51:19.896108951 +0200
***************
*** 1916,1922 ****
#ifdef FEAT_WINDOWS
win_T *w;
! for (w = firstwin; w != NULL; w = w->w_next)
#endif
++n;
return scheme_make_integer(n);
--- 1916,1922 ----
#ifdef FEAT_WINDOWS
win_T *w;
! FOR_ALL_WINDOWS(w)
#endif
++n;
return scheme_make_integer(n);
***************
*** 2197,2203 ****
fnum = SCHEME_INT_VAL(GUARANTEE_INTEGER(prim->name, 0));
! for (buf = firstbuf; buf; buf = buf->b_next)
if (buf->b_fnum == fnum)
return buffer_new(buf);
--- 2197,2203 ----
fnum = SCHEME_INT_VAL(GUARANTEE_INTEGER(prim->name, 0));
! FOR_ALL_BUFFERS(buf)
if (buf->b_fnum == fnum)
return buffer_new(buf);
***************
*** 2220,2226 ****
fname = GUARANTEED_STRING_ARG(prim->name, 0);
buffer = scheme_false;
! for (buf = firstbuf; buf; buf = buf->b_next)
{
if (buf->b_ffname == NULL || buf->b_sfname == NULL)
/* empty string */
--- 2220,2226 ----
fname = GUARANTEED_STRING_ARG(prim->name, 0);
buffer = scheme_false;
! FOR_ALL_BUFFERS(buf)
{
if (buf->b_ffname == NULL || buf->b_sfname == NULL)
/* empty string */
***************
*** 2283,2289 ****
buf_T *b;
int n = 0;
! for (b = firstbuf; b; b = b->b_next) ++n;
return scheme_make_integer(n);
}
--- 2283,2289 ----
buf_T *b;
int n = 0;
! FOR_ALL_BUFFERS(b) ++n;
return scheme_make_integer(n);
}
*** ../vim-7.4.2100/src/if_perl.xs 2016-06-26 17:19:42.362180288 +0200
--- src/if_perl.xs 2016-07-24 21:51:19.896108951 +0200
***************
*** 1534,1547 ****
if (GIMME == G_SCALAR)
{
i = 0;
! for (vimbuf = firstbuf; vimbuf; vimbuf = vimbuf->b_next)
++i;
XPUSHs(sv_2mortal(newSViv(i)));
}
else
{
! for (vimbuf = firstbuf; vimbuf; vimbuf = vimbuf->b_next)
XPUSHs(newBUFrv(newSV(0), vimbuf));
}
}
--- 1534,1547 ----
if (GIMME == G_SCALAR)
{
i = 0;
! FOR_ALL_BUFFERS(vimbuf)
++i;
XPUSHs(sv_2mortal(newSViv(i)));
}
else
{
! FOR_ALL_BUFFERS(vimbuf)
XPUSHs(newBUFrv(newSV(0), vimbuf));
}
}
***************
*** 1586,1592 ****
XPUSHs(sv_2mortal(newSViv(win_count())));
else
{
! for (vimwin = firstwin; vimwin != NULL; vimwin = W_NEXT(vimwin))
XPUSHs(newWINrv(newSV(0), vimwin));
}
}
--- 1586,1592 ----
XPUSHs(sv_2mortal(newSViv(win_count())));
else
{
! FOR_ALL_WINDOWS(vimwin)
XPUSHs(newWINrv(newSV(0), vimwin));
}
}
*** ../vim-7.4.2100/src/if_ruby.c 2016-06-13 20:08:39.879032005 +0200
--- src/if_ruby.c 2016-07-24 21:51:19.896108951 +0200
***************
*** 1151,1157 ****
buf_T *b;
int n = 0;
! for (b = firstbuf; b != NULL; b = b->b_next)
{
/* Deleted buffers should not be counted
* SegPhault - 01/07/05 */
--- 1151,1157 ----
buf_T *b;
int n = 0;
! FOR_ALL_BUFFERS(b)
{
/* Deleted buffers should not be counted
* SegPhault - 01/07/05 */
***************
*** 1167,1173 ****
buf_T *b;
int n = NUM2INT(num);
! for (b = firstbuf; b != NULL; b = b->b_next)
{
/* Deleted buffers should not be counted
* SegPhault - 01/07/05 */
--- 1167,1173 ----
buf_T *b;
int n = NUM2INT(num);
! FOR_ALL_BUFFERS(b)
{
/* Deleted buffers should not be counted
* SegPhault - 01/07/05 */
***************
*** 1418,1424 ****
win_T *w;
int n = 0;
! for (w = firstwin; w != NULL; w = w->w_next)
n++;
return INT2NUM(n);
#else
--- 1418,1424 ----
win_T *w;
int n = 0;
! FOR_ALL_WINDOWS(w)
n++;
return INT2NUM(n);
#else
*** ../vim-7.4.2100/src/if_tcl.c 2016-01-30 17:24:01.798502450 +0100
--- src/if_tcl.c 2016-07-24 21:51:19.896108951 +0200
***************
*** 388,394 ****
Tcl_WrongNumArgs(interp, 1, objv, "bufNumber");
return TCL_ERROR;
}
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
{
if (buf->b_fnum == n)
{
--- 388,394 ----
Tcl_WrongNumArgs(interp, 1, objv, "bufNumber");
return TCL_ERROR;
}
! FOR_ALL_BUFFERS(buf)
{
if (buf->b_fnum == n)
{
***************
*** 416,422 ****
err = TCL_ERROR;
break;
}
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
{
name = tclgetbuffer(interp, buf);
if (name == NULL)
--- 416,422 ----
err = TCL_ERROR;
break;
}
! FOR_ALL_BUFFERS(buf)
{
name = tclgetbuffer(interp, buf);
if (name == NULL)
*** ../vim-7.4.2100/src/main.c 2016-07-16 19:49:54.372304144 +0200
--- src/main.c 2016-07-24 21:51:19.896108951 +0200
***************
*** 742,748 ****
win_T *wp;
/* set options in each window for "vimdiff". */
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
diff_win_options(wp, TRUE);
}
#endif
--- 742,748 ----
win_T *wp;
/* set options in each window for "vimdiff". */
! FOR_ALL_WINDOWS(wp)
diff_win_options(wp, TRUE);
}
#endif
***************
*** 1375,1382 ****
for (tp = first_tabpage; tp != NULL; tp = next_tp)
{
next_tp = tp->tp_next;
! for (wp = (tp == curtab)
! ? firstwin : tp->tp_firstwin; wp != NULL; wp = wp->w_next)
{
if (wp->w_buffer == NULL)
/* Autocmd must have close the buffer already, skip. */
--- 1375,1381 ----
for (tp = first_tabpage; tp != NULL; tp = next_tp)
{
next_tp = tp->tp_next;
! FOR_ALL_WINDOWS_IN_TAB(tp, wp)
{
if (wp->w_buffer == NULL)
/* Autocmd must have close the buffer already, skip. */
***************
*** 1399,1405 ****
# endif
/* Trigger BufUnload for buffers that are loaded */
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
if (buf->b_ml.ml_mfp != NULL)
{
bufref_T bufref;
--- 1398,1404 ----
# endif
/* Trigger BufUnload for buffers that are loaded */
! FOR_ALL_BUFFERS(buf)
if (buf->b_ml.ml_mfp != NULL)
{
bufref_T bufref;
*** ../vim-7.4.2100/src/mark.c 2016-07-03 17:47:21.858812593 +0200
--- src/mark.c 2016-07-24 21:51:19.896108951 +0200
***************
*** 1864,1870 ****
#endif
fputs(_("\n# History of marks within files (newest to oldest):\n"),
fp_out);
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
{
/*
* Only write something if buffer has been loaded and at least one
--- 1864,1870 ----
#endif
fputs(_("\n# History of marks within files (newest to oldest):\n"),
fp_out);
! FOR_ALL_BUFFERS(buf)
{
/*
* Only write something if buffer has been loaded and at least one
***************
*** 2018,2024 ****
else /* fp_out != NULL */
{
/* This is slow if there are many buffers!! */
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
if (buf->b_ffname != NULL)
{
home_replace(NULL, buf->b_ffname, name_buf, LSIZE, TRUE);
--- 2018,2024 ----
else /* fp_out != NULL */
{
/* This is slow if there are many buffers!! */
! FOR_ALL_BUFFERS(buf)
if (buf->b_ffname != NULL)
{
home_replace(NULL, buf->b_ffname, name_buf, LSIZE, TRUE);
*** ../vim-7.4.2100/src/memfile.c 2016-07-16 14:46:51.127240626 +0200
--- src/memfile.c 2016-07-24 21:51:19.900108914 +0200
***************
*** 796,802 ****
if (mfp->mf_fd < 0 && need_release && p_uc)
{
/* find for which buffer this memfile is */
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
if (buf->b_ml.ml_mfp == mfp)
break;
if (buf != NULL && buf->b_may_swap)
--- 796,802 ----
if (mfp->mf_fd < 0 && need_release && p_uc)
{
/* find for which buffer this memfile is */
! FOR_ALL_BUFFERS(buf)
if (buf->b_ml.ml_mfp == mfp)
break;
if (buf != NULL && buf->b_may_swap)
***************
*** 861,867 ****
bhdr_T *hp;
int retval = FALSE;
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
{
mfp = buf->b_ml.ml_mfp;
if (mfp != NULL)
--- 861,867 ----
bhdr_T *hp;
int retval = FALSE;
! FOR_ALL_BUFFERS(buf)
{
mfp = buf->b_ml.ml_mfp;
if (mfp != NULL)
*** ../vim-7.4.2100/src/memline.c 2016-07-16 14:46:51.127240626 +0200
--- src/memline.c 2016-07-24 21:51:19.900108914 +0200
***************
*** 739,745 ****
{
buf_T *buf;
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
if (!buf->b_p_ro || buf->b_changed)
ml_open_file(buf);
}
--- 739,745 ----
{
buf_T *buf;
! FOR_ALL_BUFFERS(buf)
if (!buf->b_p_ro || buf->b_changed)
ml_open_file(buf);
}
***************
*** 873,879 ****
{
buf_T *buf;
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
ml_close(buf, del_file && ((buf->b_flags & BF_PRESERVED) == 0
|| vim_strchr(p_cpo, CPO_PRESERVE) == NULL));
#ifdef FEAT_SPELL
--- 873,879 ----
{
buf_T *buf;
! FOR_ALL_BUFFERS(buf)
ml_close(buf, del_file && ((buf->b_flags & BF_PRESERVED) == 0
|| vim_strchr(p_cpo, CPO_PRESERVE) == NULL));
#ifdef FEAT_SPELL
***************
*** 893,899 ****
{
buf_T *buf;
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
if (!bufIsChanged(buf))
ml_close(buf, TRUE); /* close all not-modified buffers */
}
--- 893,899 ----
{
buf_T *buf;
! FOR_ALL_BUFFERS(buf)
if (!bufIsChanged(buf))
ml_close(buf, TRUE); /* close all not-modified buffers */
}
***************
*** 2264,2270 ****
buf_T *buf;
stat_T st;
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
{
if (buf->b_ml.ml_mfp == NULL || buf->b_ml.ml_mfp->mf_fname == NULL)
continue; /* no file */
--- 2264,2270 ----
buf_T *buf;
stat_T st;
! FOR_ALL_BUFFERS(buf)
{
if (buf->b_ml.ml_mfp == NULL || buf->b_ml.ml_mfp->mf_fname == NULL)
continue; /* no file */
*** ../vim-7.4.2100/src/misc1.c 2016-07-16 14:46:51.131240585 +0200
--- src/misc1.c 2016-07-24 21:51:19.900108914 +0200
***************
*** 2814,2820 ****
win_T *wp;
linenr_T wlnum;
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
if (wp->w_p_diff && wp != curwin)
{
redraw_win_later(wp, VALID);
--- 2814,2820 ----
win_T *wp;
linenr_T wlnum;
! FOR_ALL_WINDOWS(wp)
if (wp->w_p_diff && wp != curwin)
{
redraw_win_later(wp, VALID);
***************
*** 2924,2930 ****
win_T *wp;
linenr_T wlnum;
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
if (wp->w_p_diff && wp != curwin)
{
redraw_win_later(wp, VALID);
--- 2924,2930 ----
win_T *wp;
linenr_T wlnum;
! FOR_ALL_WINDOWS(wp)
if (wp->w_p_diff && wp != curwin)
{
redraw_win_later(wp, VALID);
***************
*** 3213,3219 ****
{
win_T *wp;
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
if (wp->w_buffer == buf && wp->w_status_height)
{
wp->w_redr_status = TRUE;
--- 3213,3219 ----
{
win_T *wp;
! FOR_ALL_WINDOWS(wp)
if (wp->w_buffer == buf && wp->w_status_height)
{
wp->w_redr_status = TRUE;
***************
*** 9475,9481 ****
ml_close_notmod(); /* close all not-modified buffers */
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
{
if (buf->b_ml.ml_mfp != NULL && buf->b_ml.ml_mfp->mf_fname != NULL)
{
--- 9475,9481 ----
ml_close_notmod(); /* close all not-modified buffers */
! FOR_ALL_BUFFERS(buf)
{
if (buf->b_ml.ml_mfp != NULL && buf->b_ml.ml_mfp->mf_fname != NULL)
{
*** ../vim-7.4.2100/src/move.c 2016-03-19 22:11:47.428674921 +0100
--- src/move.c 2016-07-24 21:51:19.900108914 +0200
***************
*** 2820,2826 ****
* loop through the cursorbound windows
*/
VIsual_select = VIsual_active = 0;
! for (curwin = firstwin; curwin; curwin = curwin->w_next)
{
curbuf = curwin->w_buffer;
/* skip original window and windows with 'noscrollbind' */
--- 2820,2826 ----
* loop through the cursorbound windows
*/
VIsual_select = VIsual_active = 0;
! FOR_ALL_WINDOWS(curwin)
{
curbuf = curwin->w_buffer;
/* skip original window and windows with 'noscrollbind' */
*** ../vim-7.4.2100/src/netbeans.c 2016-07-21 22:10:06.051248382 +0200
--- src/netbeans.c 2016-07-24 21:51:19.900108914 +0200
***************
*** 473,479 ****
{
buf_T *buf;
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
buf->b_has_sign_column = FALSE;
/* The IDE is breaking the connection. */
--- 473,479 ----
{
buf_T *buf;
! FOR_ALL_BUFFERS(buf)
buf->b_has_sign_column = FALSE;
/* The IDE is breaking the connection. */
***************
*** 721,727 ****
int n;
n = 0;
! for (bufp = firstbuf; bufp != NULL; bufp = bufp->b_next)
if (bufp->b_changed)
++n;
return n;
--- 721,727 ----
int n;
n = 0;
! FOR_ALL_BUFFERS(bufp)
if (bufp->b_changed)
++n;
return n;
*** ../vim-7.4.2100/src/normal.c 2016-07-02 18:25:15.724879148 +0200
--- src/normal.c 2016-07-24 21:51:19.900108914 +0200
***************
*** 4073,4079 ****
* loop through the scrollbound windows and scroll accordingly
*/
VIsual_select = VIsual_active = 0;
! for (curwin = firstwin; curwin; curwin = curwin->w_next)
{
curbuf = curwin->w_buffer;
/* skip original window and windows with 'noscrollbind' */
--- 4073,4079 ----
* loop through the scrollbound windows and scroll accordingly
*/
VIsual_select = VIsual_active = 0;
! FOR_ALL_WINDOWS(curwin)
{
curbuf = curwin->w_buffer;
/* skip original window and windows with 'noscrollbind' */
*** ../vim-7.4.2100/src/option.c 2016-07-16 14:46:51.131240585 +0200
--- src/option.c 2016-07-24 21:51:19.904108878 +0200
***************
*** 6342,6348 ****
{
buf_T *buf;
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
if (buf != curbuf && *buf->b_p_cm == NUL)
ml_set_crypt_key(buf, buf->b_p_key, oldval);
}
--- 6342,6348 ----
{
buf_T *buf;
! FOR_ALL_BUFFERS(buf)
if (buf != curbuf && *buf->b_p_cm == NUL)
ml_set_crypt_key(buf, buf->b_p_key, oldval);
}
***************
*** 7864,7870 ****
char_u hash[UNDO_HASH_SIZE];
buf_T *save_curbuf = curbuf;
! for (curbuf = firstbuf; curbuf != NULL; curbuf = curbuf->b_next)
{
/* When 'undofile' is set globally: for every buffer, otherwise
* only for the current buffer: Try to read in the undofile,
--- 7864,7870 ----
char_u hash[UNDO_HASH_SIZE];
buf_T *save_curbuf = curbuf;
! FOR_ALL_BUFFERS(curbuf)
{
/* When 'undofile' is set globally: for every buffer, otherwise
* only for the current buffer: Try to read in the undofile,
***************
*** 8040,8046 ****
{
win_T *win;
! for (win = firstwin; win != NULL; win = win->w_next)
if (win->w_p_pvw && win != curwin)
{
curwin->w_p_pvw = FALSE;
--- 8040,8046 ----
{
win_T *win;
! FOR_ALL_WINDOWS(win)
if (win->w_p_pvw && win != curwin)
{
curwin->w_p_pvw = FALSE;
***************
*** 11651,11657 ****
if (!old_p_paste)
{
/* save options for each buffer */
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
{
buf->b_p_tw_nopaste = buf->b_p_tw;
buf->b_p_wm_nopaste = buf->b_p_wm;
--- 11651,11657 ----
if (!old_p_paste)
{
/* save options for each buffer */
! FOR_ALL_BUFFERS(buf)
{
buf->b_p_tw_nopaste = buf->b_p_tw;
buf->b_p_wm_nopaste = buf->b_p_wm;
***************
*** 11683,11689 ****
* already on.
*/
/* set options for each buffer */
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
{
buf->b_p_tw = 0; /* textwidth is 0 */
buf->b_p_wm = 0; /* wrapmargin is 0 */
--- 11683,11689 ----
* already on.
*/
/* set options for each buffer */
! FOR_ALL_BUFFERS(buf)
{
buf->b_p_tw = 0; /* textwidth is 0 */
buf->b_p_wm = 0; /* wrapmargin is 0 */
***************
*** 11719,11725 ****
else if (old_p_paste)
{
/* restore options for each buffer */
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
{
buf->b_p_tw = buf->b_p_tw_nopaste;
buf->b_p_wm = buf->b_p_wm_nopaste;
--- 11719,11725 ----
else if (old_p_paste)
{
/* restore options for each buffer */
! FOR_ALL_BUFFERS(buf)
{
buf->b_p_tw = buf->b_p_tw_nopaste;
buf->b_p_wm = buf->b_p_wm_nopaste;
*** ../vim-7.4.2100/src/quickfix.c 2016-07-20 21:44:33.366131742 +0200
--- src/quickfix.c 2016-07-24 21:51:19.904108878 +0200
***************
*** 2040,2046 ****
if (cmdmod.tab != 0)
wp = NULL;
else
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
if (wp->w_buffer != NULL && wp->w_buffer->b_help)
break;
if (wp != NULL && wp->w_buffer->b_nwindows > 0)
--- 2040,2046 ----
if (cmdmod.tab != 0)
wp = NULL;
else
! FOR_ALL_WINDOWS(wp)
if (wp->w_buffer != NULL && wp->w_buffer->b_help)
break;
if (wp != NULL && wp->w_buffer->b_nwindows > 0)
*** ../vim-7.4.2100/src/screen.c 2016-07-24 16:17:55.753759205 +0200
--- src/screen.c 2016-07-24 21:51:19.904108878 +0200
***************
*** 730,736 ****
#ifdef FEAT_WINDOWS
/* Reset b_mod_set flags. Going through all windows is probably faster
* than going through all buffers (there could be many buffers). */
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
wp->w_buffer->b_mod_set = FALSE;
#else
curbuf->b_mod_set = FALSE;
--- 730,736 ----
#ifdef FEAT_WINDOWS
/* Reset b_mod_set flags. Going through all windows is probably faster
* than going through all buffers (there could be many buffers). */
! FOR_ALL_WINDOWS(wp)
wp->w_buffer->b_mod_set = FALSE;
#else
curbuf->b_mod_set = FALSE;
***************
*** 962,968 ****
update_prepare();
# ifdef FEAT_WINDOWS
! for (wp = firstwin; wp; wp = wp->w_next)
{
if (wp->w_redr_type != 0)
win_update(wp);
--- 962,968 ----
update_prepare();
# ifdef FEAT_WINDOWS
! FOR_ALL_WINDOWS(wp)
{
if (wp->w_redr_type != 0)
win_update(wp);
***************
*** 6271,6277 ****
{
win_T *wp;
! for (wp = firstwin; wp; wp = wp->w_next)
if (wp->w_status_height)
{
wp->w_redr_status = TRUE;
--- 6271,6277 ----
{
win_T *wp;
! FOR_ALL_WINDOWS(wp)
if (wp->w_status_height)
{
wp->w_redr_status = TRUE;
***************
*** 6287,6293 ****
{
win_T *wp;
! for (wp = firstwin; wp; wp = wp->w_next)
if (wp->w_status_height != 0 && wp->w_buffer == curbuf)
{
wp->w_redr_status = TRUE;
--- 6287,6293 ----
{
win_T *wp;
! FOR_ALL_WINDOWS(wp)
if (wp->w_status_height != 0 && wp->w_buffer == curbuf)
{
wp->w_redr_status = TRUE;
***************
*** 6303,6309 ****
{
win_T *wp;
! for (wp = firstwin; wp; wp = wp->w_next)
if (wp->w_redr_status)
win_redr_status(wp);
if (redraw_tabline)
--- 6303,6309 ----
{
win_T *wp;
! FOR_ALL_WINDOWS(wp)
if (wp->w_redr_status)
win_redr_status(wp);
if (redraw_tabline)
***************
*** 10360,10366 ****
else
#endif
{
! for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
++tabcount;
tabwidth = (Columns - 1 + tabcount / 2) / tabcount;
--- 10360,10366 ----
else
#endif
{
! FOR_ALL_TABPAGES(tp)
++tabcount;
tabwidth = (Columns - 1 + tabcount / 2) / tabcount;
*** ../vim-7.4.2100/src/spell.c 2016-07-19 16:38:45.499087078 +0200
--- src/spell.c 2016-07-24 21:51:19.904108878 +0200
***************
*** 2875,2881 ****
buf_T *buf;
/* Go through all buffers and handle 'spelllang'. <VN> */
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
ga_clear(&buf->b_s.b_langp);
while (first_lang != NULL)
--- 2875,2881 ----
buf_T *buf;
/* Go through all buffers and handle 'spelllang'. <VN> */
! FOR_ALL_BUFFERS(buf)
ga_clear(&buf->b_s.b_langp);
while (first_lang != NULL)
***************
*** 2911,2917 ****
spell_free_all();
/* Go through all buffers and handle 'spelllang'. */
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
{
/* Only load the wordlists when 'spelllang' is set and there is a
* window for this buffer in which 'spell' is set. */
--- 2911,2917 ----
spell_free_all();
/* Go through all buffers and handle 'spelllang'. */
! FOR_ALL_WINDOWS(wp)
{
/* Only load the wordlists when 'spelllang' is set and there is a
* window for this buffer in which 'spell' is set. */
*** ../vim-7.4.2100/src/term.c 2016-07-22 22:12:33.457219452 +0200
--- src/term.c 2016-07-24 21:51:19.908108841 +0200
***************
*** 1907,1913 ****
* loaded.
*/
set_bufref(&old_curbuf, curbuf);
! for (curbuf = firstbuf; curbuf != NULL; curbuf = curbuf->b_next)
{
if (curbuf->b_ml.ml_mfp != NULL)
apply_autocmds(EVENT_TERMCHANGED, NULL, NULL, FALSE,
--- 1907,1913 ----
* loaded.
*/
set_bufref(&old_curbuf, curbuf);
! FOR_ALL_BUFFERS(curbuf)
{
if (curbuf->b_ml.ml_mfp != NULL)
apply_autocmds(EVENT_TERMCHANGED, NULL, NULL, FALSE,
*** ../vim-7.4.2100/src/window.c 2016-07-19 23:12:18.712611729 +0200
--- src/window.c 2016-07-24 21:51:19.908108841 +0200
***************
*** 209,215 ****
/* cursor to preview window */
case 'P':
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
if (wp->w_p_pvw)
break;
if (wp == NULL)
--- 209,215 ----
/* cursor to preview window */
case 'P':
! FOR_ALL_WINDOWS(wp)
if (wp->w_p_pvw)
break;
if (wp == NULL)
***************
*** 1367,1373 ****
if (win == NULL)
return FALSE;
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
if (wp == win)
return TRUE;
return FALSE;
--- 1367,1373 ----
if (win == NULL)
return FALSE;
! FOR_ALL_WINDOWS(wp)
if (wp == win)
return TRUE;
return FALSE;
***************
*** 1382,1388 ****
win_T *wp;
int count = 0;
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
++count;
return count;
}
--- 1382,1388 ----
win_T *wp;
int count = 0;
! FOR_ALL_WINDOWS(wp)
++count;
return count;
}
***************
*** 3712,3718 ****
{
tabpage_T *tp;
! for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
if (tp == tpc)
return TRUE;
return FALSE;
--- 3712,3718 ----
{
tabpage_T *tp;
! FOR_ALL_TABPAGES(tp)
if (tp == tpc)
return TRUE;
return FALSE;
***************
*** 4012,4018 ****
first_tabpage = curtab->tp_next;
else
{
! for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
if (tp->tp_next == curtab)
break;
if (tp == NULL) /* "cannot happen" */
--- 4012,4018 ----
first_tabpage = curtab->tp_next;
else
{
! FOR_ALL_TABPAGES(tp)
if (tp->tp_next == curtab)
break;
if (tp == NULL) /* "cannot happen" */
***************
*** 4091,4097 ****
win_T *wp;
# ifdef FEAT_WINDOWS
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
if (--winnr == 0)
break;
return wp;
--- 4091,4097 ----
win_T *wp;
# ifdef FEAT_WINDOWS
! FOR_ALL_WINDOWS(wp)
if (--winnr == 0)
break;
return wp;
***************
*** 4112,4120 ****
win_T *wp;
tabpage_T *tp;
! for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
! for (wp = (tp == curtab ? firstwin : tp->tp_firstwin);
! wp != NULL; wp = wp->w_next)
if (wp == win)
return tp;
return NULL;
--- 4112,4118 ----
win_T *wp;
tabpage_T *tp;
! FOR_ALL_TAB_WINDOWS(tp, wp)
if (wp == win)
return tp;
return NULL;
***************
*** 4404,4410 ****
wp = curwin;
# ifdef FEAT_WINDOWS
else
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
if (wp->w_buffer == buf)
break;
if (wp != NULL)
--- 4402,4408 ----
wp = curwin;
# ifdef FEAT_WINDOWS
else
! FOR_ALL_WINDOWS(wp)
if (wp->w_buffer == buf)
break;
if (wp != NULL)
***************
*** 4428,4434 ****
if (wp != NULL)
return wp;
! for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
if (tp != curtab)
{
for (wp = tp->tp_firstwin; wp != NULL; wp = wp->w_next)
--- 4426,4432 ----
if (wp != NULL)
return wp;
! FOR_ALL_TABPAGES(tp)
if (tp != curtab)
{
for (wp = tp->tp_firstwin; wp != NULL; wp = wp->w_next)
***************
*** 4607,4613 ****
if (prevwin == wp)
prevwin = NULL;
! for (ttp = first_tabpage; ttp != NULL; ttp = ttp->tp_next)
if (ttp->tp_prevwin == wp)
ttp->tp_prevwin = NULL;
}
--- 4605,4611 ----
if (prevwin == wp)
prevwin = NULL;
! FOR_ALL_TABPAGES(ttp)
if (ttp->tp_prevwin == wp)
ttp->tp_prevwin = NULL;
}
***************
*** 4620,4626 ****
/* Remove the window from the b_wininfo lists, it may happen that the
* freed memory is re-used for another window. */
! for (buf = firstbuf; buf != NULL; buf = buf->b_next)
for (wip = buf->b_wininfo; wip != NULL; wip = wip->wi_next)
if (wip->wi_win == wp)
wip->wi_win = NULL;
--- 4618,4624 ----
/* Remove the window from the b_wininfo lists, it may happen that the
* freed memory is re-used for another window. */
! FOR_ALL_BUFFERS(buf)
for (wip = buf->b_wininfo; wip != NULL; wip = wip->wi_next)
if (wip->wi_win == wp)
wip->wi_win = NULL;
***************
*** 4863,4869 ****
ga_init2(gap, (int)sizeof(int), 1);
if (ga_grow(gap, win_count() * 2) == OK)
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
{
((int *)gap->ga_data)[gap->ga_len++] =
wp->w_width + wp->w_vsep_width;
--- 4861,4867 ----
ga_init2(gap, (int)sizeof(int), 1);
if (ga_grow(gap, win_count() * 2) == OK)
! FOR_ALL_WINDOWS(wp)
{
((int *)gap->ga_data)[gap->ga_len++] =
wp->w_width + wp->w_vsep_width;
***************
*** 4888,4894 ****
for (j = 0; j < 2; ++j)
{
i = 0;
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
{
frame_setwidth(wp->w_frame, ((int *)gap->ga_data)[i++]);
win_setheight_win(((int *)gap->ga_data)[i++], wp);
--- 4886,4892 ----
for (j = 0; j < 2; ++j)
{
i = 0;
! FOR_ALL_WINDOWS(wp)
{
frame_setwidth(wp->w_frame, ((int *)gap->ga_data)[i++]);
win_setheight_win(((int *)gap->ga_data)[i++], wp);
***************
*** 5384,5390 ****
{
/* TODO: handle vertical splits */
room = -p_wh;
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
room += wp->w_height - p_wmh;
if (room >= 0)
break;
--- 5382,5388 ----
{
/* TODO: handle vertical splits */
room = -p_wh;
! FOR_ALL_WINDOWS(wp)
room += wp->w_height - p_wmh;
if (room >= 0)
break;
***************
*** 6344,6350 ****
#ifdef FEAT_WINDOWS
total = 0;
! for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
{
n = frame_minheight(tp->tp_topframe, NULL);
if (total < n)
--- 6342,6348 ----
#ifdef FEAT_WINDOWS
total = 0;
! FOR_ALL_TABPAGES(tp)
{
n = frame_minheight(tp->tp_topframe, NULL);
if (total < n)
***************
*** 6374,6380 ****
if (first_tabpage->tp_next != NULL)
return FALSE;
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
if (wp->w_buffer != NULL
&& (!((wp->w_buffer->b_help && !curbuf->b_help)
# ifdef FEAT_QUICKFIX
--- 6372,6378 ----
if (first_tabpage->tp_next != NULL)
return FALSE;
! FOR_ALL_WINDOWS(wp)
if (wp->w_buffer != NULL
&& (!((wp->w_buffer->b_help && !curbuf->b_help)
# ifdef FEAT_QUICKFIX
***************
*** 7091,7097 ****
tabpage_T *tp;
int tabnr = get_tv_number(&argvars[1]);
! for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
if (--tabnr == 0)
break;
if (tp == NULL)
--- 7089,7095 ----
tabpage_T *tp;
int tabnr = get_tv_number(&argvars[1]);
! FOR_ALL_TABPAGES(tp)
if (--tabnr == 0)
break;
if (tp == NULL)
***************
*** 7112,7120 ****
tabpage_T *tp;
int id = get_tv_number(&argvars[0]);
! for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
! for (wp = tp == curtab ? firstwin : tp->tp_firstwin;
! wp != NULL; wp = wp->w_next)
if (wp->w_id == id)
{
goto_tabpage_win(tp, wp);
--- 7110,7116 ----
tabpage_T *tp;
int id = get_tv_number(&argvars[0]);
! FOR_ALL_TAB_WINDOWS(tp, wp)
if (wp->w_id == id)
{
goto_tabpage_win(tp, wp);
***************
*** 7132,7141 ****
int tabnr = 1;
int id = get_tv_number(&argvars[0]);
! for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
{
! for (wp = tp == curtab ? firstwin : tp->tp_firstwin;
! wp != NULL; wp = wp->w_next)
{
if (wp->w_id == id)
{
--- 7128,7136 ----
int tabnr = 1;
int id = get_tv_number(&argvars[0]);
! FOR_ALL_TABPAGES(tp)
{
! FOR_ALL_WINDOWS_IN_TAB(tp, wp)
{
if (wp->w_id == id)
{
***************
*** 7159,7165 ****
int nr = 1;
int id = get_tv_number(&argvars[0]);
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
{
if (wp->w_id == id)
return nr;
--- 7154,7160 ----
int nr = 1;
int id = get_tv_number(&argvars[0]);
! FOR_ALL_WINDOWS(wp)
{
if (wp->w_id == id)
return nr;
***************
*** 7175,7183 ****
tabpage_T *tp;
int bufnr = get_tv_number(&argvars[0]);
! for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
! for (wp = tp == curtab ? firstwin : tp->tp_firstwin;
! wp != NULL; wp = wp->w_next)
if (wp->w_buffer->b_fnum == bufnr)
list_append_number(list, wp->w_id);
}
--- 7170,7176 ----
tabpage_T *tp;
int bufnr = get_tv_number(&argvars[0]);
! FOR_ALL_TAB_WINDOWS(tp, wp)
if (wp->w_buffer->b_fnum == bufnr)
list_append_number(list, wp->w_id);
}
*** ../vim-7.4.2100/src/workshop.c 2016-01-30 21:29:52.232928463 +0100
--- src/workshop.c 2016-07-24 21:51:19.908108841 +0200
***************
*** 1319,1325 ****
{
win_T *wp = NULL; /* window filename is in */
! for (wp = firstwin; wp != NULL; wp = W_NEXT(wp))
if (buf == wp->w_buffer)
break;
return wp;
--- 1319,1325 ----
{
win_T *wp = NULL; /* window filename is in */
! FOR_ALL_WINDOWS(wp)
if (buf == wp->w_buffer)
break;
return wp;
*** ../vim-7.4.2100/src/version.c 2016-07-24 17:32:41.881505040 +0200
--- src/version.c 2016-07-24 20:08:55.668948234 +0200
***************
*** 760,761 ****
--- 760,763 ----
{ /* Add new patch number below this line */
+ /**/
+ 2101,
/**/
--
Why isn't there mouse-flavored cat food?
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.