aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/globals.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/globals.h')
-rw-r--r--src/nvim/globals.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index 851022cd62..465a48e5b2 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -519,15 +519,19 @@ EXTERN win_T *firstwin; /* first window */
EXTERN win_T *lastwin; /* last window */
EXTERN win_T *prevwin INIT(= NULL); /* previous window */
# define W_NEXT(wp) ((wp)->w_next)
-# define FOR_ALL_WINDOWS(wp) for (win_T *wp = firstwin; wp != NULL; wp = wp->w_next)
+# define FOR_ALL_WINDOWS(wp) \
+ FOR_ALL_WINDOWS_IN_TAB(wp, curtab)
/*
* When using this macro "break" only breaks out of the inner loop. Use "goto"
* to break out of the tabpage loop.
*/
# define FOR_ALL_TAB_WINDOWS(tp, wp) \
- for ((tp) = first_tabpage; (tp) != NULL; (tp) = (tp)->tp_next) \
- for ((wp) = ((tp) == curtab) \
- ? firstwin : (tp)->tp_firstwin; (wp); (wp) = (wp)->w_next)
+ FOR_ALL_TABS(tp) \
+ FOR_ALL_WINDOWS_IN_TAB(wp, tp)
+
+# define FOR_ALL_WINDOWS_IN_TAB(wp, tp) \
+ for (win_T *wp = ((tp) == curtab) \
+ ? firstwin : (tp)->tp_firstwin; wp != NULL; wp = wp->w_next)
EXTERN win_T *curwin; /* currently active window */
@@ -548,6 +552,9 @@ EXTERN tabpage_T *first_tabpage;
EXTERN tabpage_T *curtab;
EXTERN int redraw_tabline INIT(= FALSE); /* need to redraw tabline */
+// Iterates over all tabs in the tab list
+# define FOR_ALL_TABS(tp) for (tabpage_T *tp = first_tabpage; tp != NULL; tp = tp->tp_next)
+
/*
* All buffers are linked in a list. 'firstbuf' points to the first entry,
* 'lastbuf' to the last entry and 'curbuf' to the currently active buffer.