diff options
author | Daniel Hahler <git@thequod.de> | 2017-12-29 20:52:56 +0100 |
---|---|---|
committer | Daniel Hahler <git@thequod.de> | 2017-12-29 20:52:56 +0100 |
commit | 5dd2ca767f3163cb9d051a9a2676ac88f600ebad (patch) | |
tree | ec99c351e1f6d5a0bd03de8dc5d3ea491094940a | |
parent | e84e1b68c13443efc3e0c39a16c6a6945fbde20b (diff) | |
download | rneovim-5dd2ca767f3163cb9d051a9a2676ac88f600ebad.tar.gz rneovim-5dd2ca767f3163cb9d051a9a2676ac88f600ebad.tar.bz2 rneovim-5dd2ca767f3163cb9d051a9a2676ac88f600ebad.zip |
use snprintf and has_event
-rw-r--r-- | src/nvim/window.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c index 81e986c5f2..2e1507c0ee 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -2102,9 +2102,10 @@ void win_close_othertab(win_T *win, int free_buf, tabpage_T *tp) /* When closing the last window in a tab page remove the tab page. */ if (tp->tp_firstwin == tp->tp_lastwin) { - // save index for tabclosed event char_u prev_idx[NUMBUFLEN]; - sprintf((char *)prev_idx, "%i", tabpage_index(tp)); + if (has_event(EVENT_TABCLOSED)) { + vim_snprintf((char *)prev_idx, NUMBUFLEN, "%i", tabpage_index(tp)); + } if (tp == first_tabpage) first_tabpage = tp->tp_next; @@ -2120,7 +2121,9 @@ void win_close_othertab(win_T *win, int free_buf, tabpage_T *tp) } free_tp = TRUE; - apply_autocmds(EVENT_TABCLOSED, prev_idx, prev_idx, false, win->w_buffer); + if (has_event(EVENT_TABCLOSED)) { + apply_autocmds(EVENT_TABCLOSED, prev_idx, prev_idx, false, win->w_buffer); + } } /* Free the memory used for the window. */ |