aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/window.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/window.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/window.c')
-rw-r--r--src/nvim/api/window.c32
1 files changed, 2 insertions, 30 deletions
diff --git a/src/nvim/api/window.c b/src/nvim/api/window.c
index f942d6b19f..a26213af98 100644
--- a/src/nvim/api/window.c
+++ b/src/nvim/api/window.c
@@ -46,35 +46,7 @@ void nvim_win_set_buf(Window window, Buffer buffer, Error *err)
FUNC_API_SINCE(5)
FUNC_API_CHECK_TEXTLOCK
{
- win_T *win = find_window_by_handle(window, err), *save_curwin = curwin;
- buf_T *buf = find_buffer_by_handle(buffer, err);
- tabpage_T *tab = win_find_tabpage(win), *save_curtab = curtab;
-
- if (!win || !buf) {
- return;
- }
-
- if (switch_win(&save_curwin, &save_curtab, win, tab, false) == FAIL) {
- api_set_error(err,
- kErrorTypeException,
- "Failed to switch to window %d",
- window);
- }
-
- try_start();
- int result = do_buffer(DOBUF_GOTO, DOBUF_FIRST, FORWARD, buf->b_fnum, 0);
- if (!try_end(err) && result == FAIL) {
- api_set_error(err,
- kErrorTypeException,
- "Failed to set buffer %d",
- buffer);
- }
-
- // If window is not current, state logic will not validate its cursor.
- // So do it now.
- validate_cursor();
-
- restore_win(save_curwin, save_curtab, false);
+ win_set_buf(window, buffer, false, err);
}
/// Gets the (1,0)-indexed cursor position in the window. |api-indexing|
@@ -423,7 +395,7 @@ void nvim_win_set_config(Window window, Dictionary config, Error *err)
// reuse old values, if not overriden
FloatConfig fconfig = new_float ? FLOAT_CONFIG_INIT : win->w_float_config;
- if (!parse_float_config(config, &fconfig, !new_float, err)) {
+ if (!parse_float_config(config, &fconfig, !new_float, false, err)) {
return;
}
if (new_float) {