aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/private/helpers.c
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2021-05-27 22:10:42 +0100
committerSean Dewar <seandewar@users.noreply.github.com>2021-06-01 03:05:04 +0100
commit802f8429d5d908457658e4b9859d8ed110bc0247 (patch)
tree7436cfb300621c512d8580ca07e3cb591837831d /src/nvim/api/private/helpers.c
parent27c616d688c73c406726c949a3b664f52d4e4f04 (diff)
downloadrneovim-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/private/helpers.c')
-rw-r--r--src/nvim/api/private/helpers.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c
index 5abdc33709..8b881762e8 100644
--- a/src/nvim/api/private/helpers.c
+++ b/src/nvim/api/private/helpers.c
@@ -1645,7 +1645,7 @@ bool api_object_to_bool(Object obj, const char *what,
} else if (obj.type == kObjectTypeNil) {
return nil_value; // caller decides what NIL (missing retval in lua) means
} else {
- api_set_error(err, kErrorTypeValidation, "%s is not an boolean", what);
+ api_set_error(err, kErrorTypeValidation, "%s is not a boolean", what);
return false;
}
}
@@ -1868,7 +1868,7 @@ static void parse_border_style(Object style, FloatConfig *fconfig, Error *err)
}
bool parse_float_config(Dictionary config, FloatConfig *fconfig, bool reconf,
- Error *err)
+ bool new_win, Error *err)
{
// TODO(bfredl): use a get/has_key interface instead and get rid of extra
// flags
@@ -2015,6 +2015,12 @@ bool parse_float_config(Dictionary config, FloatConfig *fconfig, bool reconf,
api_set_error(err, kErrorTypeValidation,
"Invalid value of 'style' key");
}
+ } else if (strequal(key, "noautocmd") && new_win) {
+ fconfig->noautocmd
+ = api_object_to_bool(val, "'noautocmd' key", false, err);
+ if (ERROR_SET(err)) {
+ return false;
+ }
} else {
api_set_error(err, kErrorTypeValidation,
"Invalid key '%s'", key);