diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2021-05-27 22:10:42 +0100 |
---|---|---|
committer | Sean Dewar <seandewar@users.noreply.github.com> | 2021-06-01 03:05:04 +0100 |
commit | 802f8429d5d908457658e4b9859d8ed110bc0247 (patch) | |
tree | 7436cfb300621c512d8580ca07e3cb591837831d /src/nvim/api/vim.c | |
parent | 27c616d688c73c406726c949a3b664f52d4e4f04 (diff) | |
download | rneovim-802f8429d5d908457658e4b9859d8ed110bc0247.tar.gz rneovim-802f8429d5d908457658e4b9859d8ed110bc0247.tar.bz2 rneovim-802f8429d5d908457658e4b9859d8ed110bc0247.zip |
api(nvim_open_win): add "noautocmd" option
This option, when set, stops nvim_open_win() from potentially firing
buffer-related autocmd events
(BufEnter, BufLeave and BufWinEnter in the case of nvim_open_win()).
Diffstat (limited to 'src/nvim/api/vim.c')
-rw-r--r-- | src/nvim/api/vim.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index a76cefe294..99a41f4f6f 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -1459,6 +1459,9 @@ void nvim_chan_send(Integer chan, String data, Error *err) /// By default `FloatBorder` highlight is used which links to `VertSplit` /// when not defined. It could also be specified by character: /// [ {"+", "MyCorner"}, {"x", "MyBorder"} ] +/// - `noautocmd`: If true then no buffer-related autocommand events such as +/// |BufEnter|, |BufLeave| or |BufWinEnter| may fire from +/// calling this function. /// /// @param[out] err Error details, if any /// @@ -1469,7 +1472,7 @@ Window nvim_open_win(Buffer buffer, Boolean enter, Dictionary config, FUNC_API_CHECK_TEXTLOCK { FloatConfig fconfig = FLOAT_CONFIG_INIT; - if (!parse_float_config(config, &fconfig, false, err)) { + if (!parse_float_config(config, &fconfig, false, true, err)) { return 0; } win_T *wp = win_new_float(NULL, fconfig, err); @@ -1484,7 +1487,7 @@ Window nvim_open_win(Buffer buffer, Boolean enter, Dictionary config, return 0; } if (buffer > 0) { - nvim_win_set_buf(wp->handle, buffer, err); + win_set_buf(wp->handle, buffer, fconfig.noautocmd, err); } if (fconfig.style == kWinStyleMinimal) { |