diff options
-rw-r--r-- | src/ex_docmd.c | 4 | ||||
-rw-r--r-- | src/globals.h | 2 | ||||
-rw-r--r-- | src/screen.c | 2 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/window.c | 67 |
5 files changed, 38 insertions, 39 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 466e77e9e..d3246f439 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -11688,7 +11688,7 @@ ses_skipframe(frame_T *fr) { frame_T *frc; - for (frc = fr; frc != NULL; frc = frc->fr_next) + FOR_ALL_FRAMES(frc, fr) if (ses_do_frame(frc)) break; return frc; @@ -11705,7 +11705,7 @@ ses_do_frame(frame_T *fr) if (fr->fr_layout == FR_LEAF) return ses_do_win(fr->fr_win); - for (frc = fr->fr_child; frc != NULL; frc = frc->fr_next) + FOR_ALL_FRAMES(frc, fr->fr_child) if (ses_do_frame(frc)) return TRUE; return FALSE; diff --git a/src/globals.h b/src/globals.h index 67fcb4b05..0a2951143 100644 --- a/src/globals.h +++ b/src/globals.h @@ -564,6 +564,8 @@ EXTERN win_T *prevwin INIT(= NULL); /* previous window */ # define ONE_WINDOW (firstwin == lastwin) # define W_NEXT(wp) ((wp)->w_next) # define FOR_ALL_WINDOWS(wp) for (wp = firstwin; wp != NULL; wp = wp->w_next) +# define FOR_ALL_FRAMES(frp, first_frame) \ + for (frp = first_frame; frp != NULL; frp = frp->fr_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) \ diff --git a/src/screen.c b/src/screen.c index 4a61807c9..ed1d4a391 100644 --- a/src/screen.c +++ b/src/screen.c @@ -6681,7 +6681,7 @@ win_redraw_last_status(frame_T *frp) frp->fr_win->w_redr_status = TRUE; else if (frp->fr_layout == FR_ROW) { - for (frp = frp->fr_child; frp != NULL; frp = frp->fr_next) + FOR_ALL_FRAMES(frp, frp->fr_child) win_redraw_last_status(frp); } else /* frp->fr_layout == FR_COL */ diff --git a/src/version.c b/src/version.c index bb0c81f7d..f57ffb3ff 100644 --- a/src/version.c +++ b/src/version.c @@ -800,6 +800,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 623, +/**/ 622, /**/ 621, diff --git a/src/window.c b/src/window.c index cba9785c3..b9617f037 100644 --- a/src/window.c +++ b/src/window.c @@ -836,8 +836,7 @@ win_split_ins( frp = frp->fr_parent) { if (frp->fr_layout == FR_ROW) - for (frp2 = frp->fr_child; frp2 != NULL; - frp2 = frp2->fr_next) + FOR_ALL_FRAMES(frp2, frp->fr_child) if (frp2 != prevfrp) minwidth += frame_minwidth(frp2, NOWIN); prevfrp = frp; @@ -920,8 +919,7 @@ win_split_ins( frp = frp->fr_parent) { if (frp->fr_layout == FR_COL) - for (frp2 = frp->fr_child; frp2 != NULL; - frp2 = frp2->fr_next) + FOR_ALL_FRAMES(frp2, frp->fr_child) if (frp2 != prevfrp) minheight += frame_minheight(frp2, NOWIN); prevfrp = frp; @@ -1078,7 +1076,7 @@ win_split_ins( if (frp->fr_win != NULL) oldwin->w_frame = frp; else - for (frp = frp->fr_child; frp != NULL; frp = frp->fr_next) + FOR_ALL_FRAMES(frp, frp->fr_child) frp->fr_parent = curfrp; } @@ -1605,8 +1603,7 @@ win_rotate(int upwards, int count) #endif /* Check if all frames in this row/col have one window. */ - for (frp = curwin->w_frame->fr_parent->fr_child; frp != NULL; - frp = frp->fr_next) + FOR_ALL_FRAMES(frp, curwin->w_frame->fr_parent->fr_child) if (frp->fr_win == NULL) { EMSG(_("E443: Cannot rotate when another window is split")); @@ -1856,7 +1853,7 @@ win_equal_rec( else { next_curwin_size = -1; - for (fr = topfr->fr_child; fr != NULL; fr = fr->fr_next) + FOR_ALL_FRAMES(fr, topfr->fr_child) { /* If 'winfixwidth' set keep the window width if * possible. @@ -1909,7 +1906,7 @@ win_equal_rec( --totwincount; /* don't count curwin */ } - for (fr = topfr->fr_child; fr != NULL; fr = fr->fr_next) + FOR_ALL_FRAMES(fr, topfr->fr_child) { wincount = 1; if (fr->fr_next == NULL) @@ -1997,7 +1994,7 @@ win_equal_rec( else { next_curwin_size = -1; - for (fr = topfr->fr_child; fr != NULL; fr = fr->fr_next) + FOR_ALL_FRAMES(fr, topfr->fr_child) { /* If 'winfixheight' set keep the window height if * possible. @@ -2050,7 +2047,7 @@ win_equal_rec( --totwincount; /* don't count curwin */ } - for (fr = topfr->fr_child; fr != NULL; fr = fr->fr_next) + FOR_ALL_FRAMES(fr, topfr->fr_child) { wincount = 1; if (fr->fr_next == NULL) @@ -2751,7 +2748,7 @@ winframe_remove( * and remove it. */ frp2->fr_parent->fr_layout = frp2->fr_layout; frp2->fr_parent->fr_child = frp2->fr_child; - for (frp = frp2->fr_child; frp != NULL; frp = frp->fr_next) + FOR_ALL_FRAMES(frp, frp2->fr_child) frp->fr_parent = frp2->fr_parent; frp2->fr_parent->fr_win = frp2->fr_win; if (frp2->fr_win != NULL) @@ -2883,7 +2880,7 @@ frame_has_win(frame_T *frp, win_T *wp) if (frp->fr_layout == FR_LEAF) return frp->fr_win == wp; - for (p = frp->fr_child; p != NULL; p = p->fr_next) + FOR_ALL_FRAMES(p, frp->fr_child) if (frame_has_win(p, wp)) return TRUE; return FALSE; @@ -2917,7 +2914,7 @@ frame_new_height( do { /* All frames in this row get the same new height. */ - for (frp = topfrp->fr_child; frp != NULL; frp = frp->fr_next) + FOR_ALL_FRAMES(frp, topfrp->fr_child) { frame_new_height(frp, height, topfirst, wfh); if (frp->fr_height > height) @@ -3014,7 +3011,7 @@ frame_fixed_height(frame_T *frp) { /* The frame is fixed height if one of the frames in the row is fixed * height. */ - for (frp = frp->fr_child; frp != NULL; frp = frp->fr_next) + FOR_ALL_FRAMES(frp, frp->fr_child) if (frame_fixed_height(frp)) return TRUE; return FALSE; @@ -3022,7 +3019,7 @@ frame_fixed_height(frame_T *frp) /* frp->fr_layout == FR_COL: The frame is fixed height if all of the * frames in the row are fixed height. */ - for (frp = frp->fr_child; frp != NULL; frp = frp->fr_next) + FOR_ALL_FRAMES(frp, frp->fr_child) if (!frame_fixed_height(frp)) return FALSE; return TRUE; @@ -3043,7 +3040,7 @@ frame_fixed_width(frame_T *frp) { /* The frame is fixed width if one of the frames in the row is fixed * width. */ - for (frp = frp->fr_child; frp != NULL; frp = frp->fr_next) + FOR_ALL_FRAMES(frp, frp->fr_child) if (frame_fixed_width(frp)) return TRUE; return FALSE; @@ -3051,7 +3048,7 @@ frame_fixed_width(frame_T *frp) /* frp->fr_layout == FR_ROW: The frame is fixed width if all of the * frames in the row are fixed width. */ - for (frp = frp->fr_child; frp != NULL; frp = frp->fr_next) + FOR_ALL_FRAMES(frp, frp->fr_child) if (!frame_fixed_width(frp)) return FALSE; return TRUE; @@ -3079,7 +3076,7 @@ frame_add_statusline(frame_T *frp) else if (frp->fr_layout == FR_ROW) { /* Handle all the frames in the row. */ - for (frp = frp->fr_child; frp != NULL; frp = frp->fr_next) + FOR_ALL_FRAMES(frp, frp->fr_child) frame_add_statusline(frp); } else /* frp->fr_layout == FR_COL */ @@ -3125,7 +3122,7 @@ frame_new_width( do { /* All frames in this column get the same new width. */ - for (frp = topfrp->fr_child; frp != NULL; frp = frp->fr_next) + FOR_ALL_FRAMES(frp, topfrp->fr_child) { frame_new_width(frp, width, leftfirst, wfw); if (frp->fr_width > width) @@ -3228,7 +3225,7 @@ frame_add_vsep(frame_T *frp) else if (frp->fr_layout == FR_COL) { /* Handle all the frames in the column. */ - for (frp = frp->fr_child; frp != NULL; frp = frp->fr_next) + FOR_ALL_FRAMES(frp, frp->fr_child) frame_add_vsep(frp); } else /* frp->fr_layout == FR_ROW */ @@ -3295,7 +3292,7 @@ frame_minheight(frame_T *topfrp, win_T *next_curwin) { /* get the minimal height from each frame in this row */ m = 0; - for (frp = topfrp->fr_child; frp != NULL; frp = frp->fr_next) + FOR_ALL_FRAMES(frp, topfrp->fr_child) { n = frame_minheight(frp, next_curwin); if (n > m) @@ -3306,7 +3303,7 @@ frame_minheight(frame_T *topfrp, win_T *next_curwin) { /* Add up the minimal heights for all frames in this column. */ m = 0; - for (frp = topfrp->fr_child; frp != NULL; frp = frp->fr_next) + FOR_ALL_FRAMES(frp, topfrp->fr_child) m += frame_minheight(frp, next_curwin); } @@ -3344,7 +3341,7 @@ frame_minwidth( { /* get the minimal width from each frame in this column */ m = 0; - for (frp = topfrp->fr_child; frp != NULL; frp = frp->fr_next) + FOR_ALL_FRAMES(frp, topfrp->fr_child) { n = frame_minwidth(frp, next_curwin); if (n > m) @@ -3355,7 +3352,7 @@ frame_minwidth( { /* Add up the minimal widths for all frames in this row. */ m = 0; - for (frp = topfrp->fr_child; frp != NULL; frp = frp->fr_next) + FOR_ALL_FRAMES(frp, topfrp->fr_child) m += frame_minwidth(frp, next_curwin); } @@ -5023,7 +5020,7 @@ frame_comp_pos(frame_T *topfrp, int *row, int *col) { startrow = *row; startcol = *col; - for (frp = topfrp->fr_child; frp != NULL; frp = frp->fr_next) + FOR_ALL_FRAMES(frp, topfrp->fr_child) { if (topfrp->fr_layout == FR_ROW) *row = startrow; /* all frames are at the same row */ @@ -5143,8 +5140,7 @@ frame_setheight(frame_T *curfrp, int height) { room = 0; room_reserved = 0; - for (frp = curfrp->fr_parent->fr_child; frp != NULL; - frp = frp->fr_next) + FOR_ALL_FRAMES(frp, curfrp->fr_parent->fr_child) { if (frp != curfrp && frp->fr_win != NULL @@ -5337,8 +5333,7 @@ frame_setwidth(frame_T *curfrp, int width) { room = 0; room_reserved = 0; - for (frp = curfrp->fr_parent->fr_child; frp != NULL; - frp = frp->fr_next) + FOR_ALL_FRAMES(frp, curfrp->fr_parent->fr_child) { if (frp != curfrp && frp->fr_win != NULL @@ -5562,7 +5557,7 @@ win_drag_status_line(win_T *dragwin, int offset) if (room < 0) room = 0; /* sum up the room of frames below of the current one */ - for (fr = curfr->fr_next; fr != NULL; fr = fr->fr_next) + FOR_ALL_FRAMES(fr, curfr->fr_next) room += fr->fr_height - frame_minheight(fr, NULL); fr = curfr; /* put fr at window that grows */ } @@ -5676,7 +5671,7 @@ win_drag_vsep_line(win_T *dragwin, int offset) left = FALSE; /* sum up the room of frames right of the current one */ room = 0; - for (fr = curfr->fr_next; fr != NULL; fr = fr->fr_next) + FOR_ALL_FRAMES(fr, curfr->fr_next) room += fr->fr_width - frame_minwidth(fr, NULL); fr = curfr; /* put fr at window that grows */ } @@ -6073,7 +6068,7 @@ last_status_rec(frame_T *fr, int statusline) else if (fr->fr_layout == FR_ROW) { /* vertically split windows, set status line for each one */ - for (fp = fr->fr_child; fp != NULL; fp = fp->fr_next) + FOR_ALL_FRAMES(fp, fr->fr_child) last_status_rec(fp, statusline); } else @@ -6751,7 +6746,7 @@ win_hasvertsplit(void) return TRUE; if (topframe->fr_layout == FR_COL) - for (fr = topframe->fr_child; fr != NULL; fr = fr->fr_next) + FOR_ALL_FRAMES(fr, topframe->fr_child) if (fr->fr_layout == FR_ROW) return TRUE; @@ -7097,7 +7092,7 @@ frame_check_height(frame_T *topfrp, int height) return FALSE; if (topfrp->fr_layout == FR_ROW) - for (frp = topfrp->fr_child; frp != NULL; frp = frp->fr_next) + FOR_ALL_FRAMES(frp, topfrp->fr_child) if (frp->fr_height != height) return FALSE; @@ -7116,7 +7111,7 @@ frame_check_width(frame_T *topfrp, int width) return FALSE; if (topfrp->fr_layout == FR_COL) - for (frp = topfrp->fr_child; frp != NULL; frp = frp->fr_next) + FOR_ALL_FRAMES(frp, topfrp->fr_child) if (frp->fr_width != width) return FALSE; |