aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/vim.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-08-20 23:53:13 +0200
committerJustin M. Keyes <justinkz@gmail.com>2019-08-27 21:19:10 +0200
commit93e5f0235b8e85423d0284231661ba4b0d7caa07 (patch)
treeaa1111e103437fe28f31a33fdf6d656495bc676f /src/nvim/api/vim.c
parent613296936ba30ae73f3391c2e3c36096f3703c06 (diff)
downloadrneovim-93e5f0235b8e85423d0284231661ba4b0d7caa07.tar.gz
rneovim-93e5f0235b8e85423d0284231661ba4b0d7caa07.tar.bz2
rneovim-93e5f0235b8e85423d0284231661ba4b0d7caa07.zip
API: nvim_put: "follow" parameter
Diffstat (limited to 'src/nvim/api/vim.c')
-rw-r--r--src/nvim/api/vim.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index d3e368d01b..02000907f9 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -1206,7 +1206,7 @@ Dictionary nvim_get_namespaces(void)
return retval;
}
-/// Inserts text at cursor.
+/// Puts text at cursor.
///
/// Compare |:put| and |p| which are always linewise.
///
@@ -1216,10 +1216,11 @@ Dictionary nvim_get_namespaces(void)
/// - "c" |characterwise| mode
/// - "l" |linewise| mode
/// - "" guess by contents
-/// @param direction Behave like |P| instead of |p|
+/// @param after Insert after cursor (like |p|), or before (like |P|).
+/// @param follow Place cursor at end of inserted text.
/// @param[out] err Error details, if any
-void nvim_put(ArrayOf(String) lines, String type, Boolean direction,
- Error *err)
+void nvim_put(ArrayOf(String) lines, String type, Boolean after,
+ Boolean follow, Error *err)
FUNC_API_SINCE(6)
{
yankreg_T *reg = xcalloc(sizeof(yankreg_T), 1);
@@ -1249,9 +1250,10 @@ void nvim_put(ArrayOf(String) lines, String type, Boolean direction,
finish_yankreg_from_object(reg, false);
bool VIsual_was_active = VIsual_active;
- int flags = PUT_CURSEND;
msg_silent++; // Avoid "N more lines" message.
- do_put(0, reg, direction ? BACKWARD : FORWARD, 1, flags);
+ do_put(0, reg,
+ after ? FORWARD : BACKWARD, 1,
+ follow ? PUT_CURSEND : 0);
msg_silent--;
VIsual_active = VIsual_was_active;