aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_docmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r--src/nvim/ex_docmd.c55
1 files changed, 30 insertions, 25 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 1117b6fbcf..7fb109403e 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -5267,9 +5267,6 @@ static void ex_tabclose(exarg_T *eap)
*/
static void ex_tabonly(exarg_T *eap)
{
- tabpage_T *tp;
- int done;
-
if (cmdwin_type != 0)
cmdwin_result = K_IGNORE;
else if (first_tabpage->tp_next == NULL)
@@ -5277,8 +5274,8 @@ static void ex_tabonly(exarg_T *eap)
else {
/* Repeat this up to a 1000 times, because autocommands may mess
* up the lists. */
- for (done = 0; done < 1000; ++done) {
- for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
+ for (int done = 0; done < 1000; ++done) {
+ FOR_ALL_TABS(tp) {
if (tp->tp_topframe != topframe) {
tabpage_close_other(tp, eap->forceit);
/* if we failed to close it quit */
@@ -5287,8 +5284,10 @@ static void ex_tabonly(exarg_T *eap)
/* start over, "tp" is now invalid */
break;
}
- if (first_tabpage->tp_next == NULL)
+ }
+ if (first_tabpage->tp_next == NULL) {
break;
+ }
}
}
}
@@ -5607,18 +5606,21 @@ alist_add (
*/
void alist_slash_adjust(void)
{
- int i;
- win_T *wp;
- tabpage_T *tp;
-
- for (i = 0; i < GARGCOUNT; ++i)
- if (GARGLIST[i].ae_fname != NULL)
+ for (int i = 0; i < GARGCOUNT; ++i) {
+ if (GARGLIST[i].ae_fname != NULL) {
slash_adjust(GARGLIST[i].ae_fname);
- FOR_ALL_TAB_WINDOWS(tp, wp)
- if (wp->w_alist != &global_alist)
- for (i = 0; i < WARGCOUNT(wp); ++i)
- if (WARGLIST(wp)[i].ae_fname != NULL)
- slash_adjust(WARGLIST(wp)[i].ae_fname);
+ }
+ }
+
+ FOR_ALL_TAB_WINDOWS(tp, wp) {
+ if (wp->w_alist != &global_alist) {
+ for (int i = 0; i < WARGCOUNT(wp); ++i) {
+ if (WARGLIST(wp)[i].ae_fname != NULL) {
+ slash_adjust(WARGLIST(wp)[i].ae_fname);
+ }
+ }
+ }
+ }
}
#endif
@@ -5808,24 +5810,27 @@ static void ex_tabmove(exarg_T *eap)
*/
static void ex_tabs(exarg_T *eap)
{
- tabpage_T *tp;
- win_T *wp;
int tabcount = 1;
msg_start();
msg_scroll = TRUE;
- for (tp = first_tabpage; tp != NULL && !got_int; tp = tp->tp_next) {
+
+ FOR_ALL_TABS(tp) {
+ if (got_int) {
+ break;
+ }
+
msg_putchar('\n');
vim_snprintf((char *)IObuff, IOSIZE, _("Tab page %d"), tabcount++);
msg_outtrans_attr(IObuff, hl_attr(HLF_T));
out_flush(); /* output one line at a time */
ui_breakcheck();
- if (tp == curtab)
- wp = firstwin;
- else
- wp = tp->tp_firstwin;
- for (; wp != NULL && !got_int; wp = wp->w_next) {
+ FOR_ALL_WINDOWS_IN_TAB(wp, tp) {
+ if (got_int) {
+ break;
+ }
+
msg_putchar('\n');
msg_putchar(wp == curwin ? '>' : ' ');
msg_putchar(' ');