aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/vim.c
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2019-03-04 17:52:55 +0100
committerBjörn Linse <bjorn.linse@gmail.com>2019-03-12 12:49:11 +0100
commitaf966afaa448dc78eb065e61be36ac9a577b0419 (patch)
treefccf058a8e9af45d552199e530280364a4a021ba /src/nvim/api/vim.c
parent9312e2d06ae29db2e21b575b007c29da514e5df3 (diff)
downloadrneovim-af966afaa448dc78eb065e61be36ac9a577b0419.tar.gz
rneovim-af966afaa448dc78eb065e61be36ac9a577b0419.tar.bz2
rneovim-af966afaa448dc78eb065e61be36ac9a577b0419.zip
window: simplify logic for entering new float
Diffstat (limited to 'src/nvim/api/vim.c')
-rw-r--r--src/nvim/api/vim.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index cb5ed5ecda..955920d6ae 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -15,6 +15,7 @@
#include "nvim/api/private/defs.h"
#include "nvim/api/private/dispatch.h"
#include "nvim/api/buffer.h"
+#include "nvim/api/window.h"
#include "nvim/msgpack_rpc/channel.h"
#include "nvim/msgpack_rpc/helpers.h"
#include "nvim/lua/executor.h"
@@ -1049,7 +1050,6 @@ Window nvim_open_win(Buffer buffer, Boolean enter,
Dictionary options, Error *err)
FUNC_API_SINCE(6)
{
- win_T *old = curwin;
FloatConfig config = FLOAT_CONFIG_INIT;
if (!parse_float_config(options, &config, false, err)) {
return 0;
@@ -1058,11 +1058,11 @@ Window nvim_open_win(Buffer buffer, Boolean enter,
if (!wp) {
return 0;
}
- if (buffer > 0) {
- nvim_set_current_buf(buffer, err);
+ if (enter) {
+ win_enter(wp, false);
}
- if (!enter) {
- win_enter(old, false);
+ if (buffer > 0) {
+ nvim_win_set_buf(wp->handle, buffer, err);
}
return wp->handle;
}