Fix TabClose autocommand via close_windows

Fixes https://github.com/neovim/neovim/issues/7781
This commit is contained in:
Daniel Hahler 2017-12-29 16:56:14 +01:00
parent ddcfb49262
commit 2c436b3362

View File

@ -1741,6 +1741,11 @@ void close_windows(buf_T *buf, int keep_curwin)
} else } else
wp = wp->w_next; wp = wp->w_next;
} }
if (count != tabpage_index(NULL)) {
char_u prev_idx[NUMBUFLEN];
sprintf((char *)prev_idx, "%i", tabpage_index(curtab));
apply_autocmds(EVENT_TABCLOSED, prev_idx, prev_idx, false, curbuf);
}
/* Also check windows in other tab pages. */ /* Also check windows in other tab pages. */
for (tp = first_tabpage; tp != NULL; tp = nexttp) { for (tp = first_tabpage; tp != NULL; tp = nexttp) {
@ -1757,15 +1762,16 @@ void close_windows(buf_T *buf, int keep_curwin)
break; break;
} }
} }
if (count != tabpage_index(NULL)) {
char_u prev_idx[NUMBUFLEN];
sprintf((char *)prev_idx, "%i", tabpage_index(tp));
apply_autocmds(EVENT_TABCLOSED, prev_idx, prev_idx, false, curbuf);
}
} }
} }
--RedrawingDisabled; --RedrawingDisabled;
if (count != tabpage_index(NULL)) {
apply_autocmds(EVENT_TABCLOSED, NULL, NULL, false, curbuf);
}
redraw_tabline = true; redraw_tabline = true;
if (h != tabline_height()) { if (h != tabline_height()) {
shell_new_rows(); shell_new_rows();