diff options
author | James McCoy <jamessan@jamessan.com> | 2017-03-10 16:13:37 -0500 |
---|---|---|
committer | James McCoy <jamessan@jamessan.com> | 2017-03-11 20:32:09 -0500 |
commit | 564e9dc17fd53ab6cb1bc63a55dba2df9538a31f (patch) | |
tree | 40c382cf733ab05a3d6c51dd684253ddce7b2cf9 /src/nvim/ex_docmd.c | |
parent | 5674057e3a5597f792a077d714bd7d32af81bfc8 (diff) | |
download | rneovim-564e9dc17fd53ab6cb1bc63a55dba2df9538a31f.tar.gz rneovim-564e9dc17fd53ab6cb1bc63a55dba2df9538a31f.tar.bz2 rneovim-564e9dc17fd53ab6cb1bc63a55dba2df9538a31f.zip |
vim-patch:7.4.2101
Problem: Looping over windows, buffers and tab pages is inconsistant.
Solution: Use FOR_ALL_ macros everywhere. (Yegappan Lakshmanan)
https://github.com/vim/vim/commit/2932359000b2f918d5fade79ea4d124d5943cd07
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r-- | src/nvim/ex_docmd.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 41cc7d70f7..ba0e8295bf 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -5851,7 +5851,7 @@ static void ex_quit_all(exarg_T *eap) */ static void ex_close(exarg_T *eap) { - win_T *win; + win_T *win = NULL; int winnr = 0; if (cmdwin_type != 0) cmdwin_result = Ctrl_C; @@ -5859,10 +5859,12 @@ static void 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_IN_TAB(wp, curtab) { winnr++; - if (winnr == eap->line2) + if (winnr == eap->line2) { + win = wp; break; + } } if (win == NULL) win = lastwin; @@ -6074,12 +6076,14 @@ static void ex_hide(exarg_T *eap) win_close(curwin, FALSE); /* don't free buffer */ else { int winnr = 0; - win_T *win; + win_T *win = NULL; - for (win = firstwin; win != NULL; win = win->w_next) { + FOR_ALL_WINDOWS_IN_TAB(wp, curtab) { winnr++; - if (winnr == eap->line2) + if (winnr == eap->line2) { + win = wp; break; + } } if (win == NULL) win = lastwin; @@ -6846,7 +6850,8 @@ static void ex_syncbind(exarg_T *eap) /* * Set all scrollbind windows to the same topline. */ - for (curwin = firstwin; curwin; curwin = curwin->w_next) { + FOR_ALL_WINDOWS_IN_TAB(wp, curtab) { + curwin = wp; if (curwin->w_p_scb) { curbuf = curwin->w_buffer; y = topline - curwin->w_topline; |