diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2016-06-19 21:06:03 +0200 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2016-08-31 21:40:20 +0200 |
commit | a2d25b7bf81728d913e7b317d33997c8b8268af2 (patch) | |
tree | 35a9a81aa16a7e0756a8d438207c7af0b53478b3 /src/nvim/buffer.c | |
parent | 3bd3b3b76859b3eef80fa4969147efa881b60f40 (diff) | |
download | rneovim-a2d25b7bf81728d913e7b317d33997c8b8268af2.tar.gz rneovim-a2d25b7bf81728d913e7b317d33997c8b8268af2.tar.bz2 rneovim-a2d25b7bf81728d913e7b317d33997c8b8268af2.zip |
api: unify buffer numbers and window ids with handles
also allow handle==0 meaning curbuf/curwin/curtab
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r-- | src/nvim/buffer.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index c934d44e70..af29798654 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -1397,8 +1397,7 @@ buflist_new ( } if (buf != curbuf || curbuf == NULL) { buf = xcalloc(1, sizeof(buf_T)); - handle_register_buffer(buf); - /* init b: variables */ + // init b: variables buf->b_vars = dict_alloc(); init_var_dict(buf->b_vars, &buf->b_bufvar, VAR_SCOPE); } @@ -1451,11 +1450,12 @@ buflist_new ( lastbuf = buf; buf->b_fnum = top_file_num++; - if (top_file_num < 0) { /* wrap around (may cause duplicates) */ + handle_register_buffer(buf); + if (top_file_num < 0) { // wrap around (may cause duplicates) EMSG(_("W14: Warning: List of file names overflow")); if (emsg_silent == 0) { ui_flush(); - os_delay(3000L, true); /* make sure it is noticed */ + os_delay(3000L, true); // make sure it is noticed } top_file_num = 1; } @@ -5231,12 +5231,12 @@ wipe_buffer ( int aucmd /* When TRUE trigger autocommands. */ ) { - if (buf->b_fnum == top_file_num - 1) - --top_file_num; - - if (!aucmd) /* Don't trigger BufDelete autocommands here. */ + if (!aucmd) { + // Don't trigger BufDelete autocommands here. block_autocmds(); - close_buffer(NULL, buf, DOBUF_WIPE, FALSE); - if (!aucmd) + } + close_buffer(NULL, buf, DOBUF_WIPE, false); + if (!aucmd) { unblock_autocmds(); + } } |