diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2017-05-28 16:11:13 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2019-08-27 21:19:10 +0200 |
commit | 9e25a36467228bbcb8c6db88d2acb69cf7145af3 (patch) | |
tree | 988183e95a50f7909a986f94031a91001c9a040c | |
parent | 4cc56905cb886327bcf2f0454a2164910dc5df3a (diff) | |
download | rneovim-9e25a36467228bbcb8c6db88d2acb69cf7145af3.tar.gz rneovim-9e25a36467228bbcb8c6db88d2acb69cf7145af3.tar.bz2 rneovim-9e25a36467228bbcb8c6db88d2acb69cf7145af3.zip |
API: nvim_put #6819: try to fix Insert, Visual
-rw-r--r-- | src/nvim/api/vim.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 4c1f8dcc39..31ddfa57f1 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -29,6 +29,7 @@ #include "nvim/ex_docmd.h" #include "nvim/screen.h" #include "nvim/memline.h" +#include "nvim/mark.h" #include "nvim/memory.h" #include "nvim/message.h" #include "nvim/popupmnu.h" @@ -1244,7 +1245,16 @@ void nvim_put(ArrayOf(String) lines, String type, String regname, Boolean prev, finish_yankreg_from_object(reg, false); int name = regname.size ? regname.data[0] : NUL; - do_put(name, reg, prev ? BACKWARD : FORWARD, (long)count, 0); + bool VIsual_was_active = VIsual_active; + int flags = 0; + if (State & INSERT) { + flags |= PUT_CURSEND; + } else if (VIsual_active) { + // TODO: fix VIsual when cursor is before, or emulate the delete as well + flags |= lt(VIsual, curwin->w_cursor) ? PUT_CURSEND : 0; + } + do_put(name, reg, prev ? BACKWARD : FORWARD, (long)count, flags); + VIsual_active = VIsual_was_active; cleanup: free_register(reg); |