Mercurial > vim
comparison src/option.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 | b2aada04d84e |
children | e34e4547f3d1 |
comparison
equal
deleted
inserted
replaced
9648:227649fd4301 | 9649:fd9727ae3c49 |
---|---|
6340 * buffers using that value. */ | 6340 * buffers using that value. */ |
6341 if ((opt_flags & OPT_GLOBAL) && STRCMP(p_cm, oldval) != 0) | 6341 if ((opt_flags & OPT_GLOBAL) && STRCMP(p_cm, oldval) != 0) |
6342 { | 6342 { |
6343 buf_T *buf; | 6343 buf_T *buf; |
6344 | 6344 |
6345 for (buf = firstbuf; buf != NULL; buf = buf->b_next) | 6345 FOR_ALL_BUFFERS(buf) |
6346 if (buf != curbuf && *buf->b_p_cm == NUL) | 6346 if (buf != curbuf && *buf->b_p_cm == NUL) |
6347 ml_set_crypt_key(buf, buf->b_p_key, oldval); | 6347 ml_set_crypt_key(buf, buf->b_p_key, oldval); |
6348 } | 6348 } |
6349 } | 6349 } |
6350 } | 6350 } |
7862 if (curbuf->b_p_udf || p_udf) | 7862 if (curbuf->b_p_udf || p_udf) |
7863 { | 7863 { |
7864 char_u hash[UNDO_HASH_SIZE]; | 7864 char_u hash[UNDO_HASH_SIZE]; |
7865 buf_T *save_curbuf = curbuf; | 7865 buf_T *save_curbuf = curbuf; |
7866 | 7866 |
7867 for (curbuf = firstbuf; curbuf != NULL; curbuf = curbuf->b_next) | 7867 FOR_ALL_BUFFERS(curbuf) |
7868 { | 7868 { |
7869 /* When 'undofile' is set globally: for every buffer, otherwise | 7869 /* When 'undofile' is set globally: for every buffer, otherwise |
7870 * only for the current buffer: Try to read in the undofile, | 7870 * only for the current buffer: Try to read in the undofile, |
7871 * if one exists, the buffer wasn't changed and the buffer was | 7871 * if one exists, the buffer wasn't changed and the buffer was |
7872 * loaded */ | 7872 * loaded */ |
8038 { | 8038 { |
8039 if (curwin->w_p_pvw) | 8039 if (curwin->w_p_pvw) |
8040 { | 8040 { |
8041 win_T *win; | 8041 win_T *win; |
8042 | 8042 |
8043 for (win = firstwin; win != NULL; win = win->w_next) | 8043 FOR_ALL_WINDOWS(win) |
8044 if (win->w_p_pvw && win != curwin) | 8044 if (win->w_p_pvw && win != curwin) |
8045 { | 8045 { |
8046 curwin->w_p_pvw = FALSE; | 8046 curwin->w_p_pvw = FALSE; |
8047 return (char_u *)N_("E590: A preview window already exists"); | 8047 return (char_u *)N_("E590: A preview window already exists"); |
8048 } | 8048 } |
11649 * Save the current values, so they can be restored later. | 11649 * Save the current values, so they can be restored later. |
11650 */ | 11650 */ |
11651 if (!old_p_paste) | 11651 if (!old_p_paste) |
11652 { | 11652 { |
11653 /* save options for each buffer */ | 11653 /* save options for each buffer */ |
11654 for (buf = firstbuf; buf != NULL; buf = buf->b_next) | 11654 FOR_ALL_BUFFERS(buf) |
11655 { | 11655 { |
11656 buf->b_p_tw_nopaste = buf->b_p_tw; | 11656 buf->b_p_tw_nopaste = buf->b_p_tw; |
11657 buf->b_p_wm_nopaste = buf->b_p_wm; | 11657 buf->b_p_wm_nopaste = buf->b_p_wm; |
11658 buf->b_p_sts_nopaste = buf->b_p_sts; | 11658 buf->b_p_sts_nopaste = buf->b_p_sts; |
11659 buf->b_p_ai_nopaste = buf->b_p_ai; | 11659 buf->b_p_ai_nopaste = buf->b_p_ai; |
11681 /* | 11681 /* |
11682 * Always set the option values, also when 'paste' is set when it is | 11682 * Always set the option values, also when 'paste' is set when it is |
11683 * already on. | 11683 * already on. |
11684 */ | 11684 */ |
11685 /* set options for each buffer */ | 11685 /* set options for each buffer */ |
11686 for (buf = firstbuf; buf != NULL; buf = buf->b_next) | 11686 FOR_ALL_BUFFERS(buf) |
11687 { | 11687 { |
11688 buf->b_p_tw = 0; /* textwidth is 0 */ | 11688 buf->b_p_tw = 0; /* textwidth is 0 */ |
11689 buf->b_p_wm = 0; /* wrapmargin is 0 */ | 11689 buf->b_p_wm = 0; /* wrapmargin is 0 */ |
11690 buf->b_p_sts = 0; /* softtabstop is 0 */ | 11690 buf->b_p_sts = 0; /* softtabstop is 0 */ |
11691 buf->b_p_ai = 0; /* no auto-indent */ | 11691 buf->b_p_ai = 0; /* no auto-indent */ |
11717 * Paste switched from on to off: Restore saved values. | 11717 * Paste switched from on to off: Restore saved values. |
11718 */ | 11718 */ |
11719 else if (old_p_paste) | 11719 else if (old_p_paste) |
11720 { | 11720 { |
11721 /* restore options for each buffer */ | 11721 /* restore options for each buffer */ |
11722 for (buf = firstbuf; buf != NULL; buf = buf->b_next) | 11722 FOR_ALL_BUFFERS(buf) |
11723 { | 11723 { |
11724 buf->b_p_tw = buf->b_p_tw_nopaste; | 11724 buf->b_p_tw = buf->b_p_tw_nopaste; |
11725 buf->b_p_wm = buf->b_p_wm_nopaste; | 11725 buf->b_p_wm = buf->b_p_wm_nopaste; |
11726 buf->b_p_sts = buf->b_p_sts_nopaste; | 11726 buf->b_p_sts = buf->b_p_sts_nopaste; |
11727 buf->b_p_ai = buf->b_p_ai_nopaste; | 11727 buf->b_p_ai = buf->b_p_ai_nopaste; |