aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorRaphael <glephunter@gmail.com>2023-12-14 16:08:00 +0800
committerGitHub <noreply@github.com>2023-12-14 16:08:00 +0800
commit619407eb548c7df56bc99b945338e9446f846fbb (patch)
tree7e3b4e11f467c32de90cdc1afa7de08cc725c4e7 /runtime
parent36552adb39edff2d909743f16c1f061bc74b5c4e (diff)
downloadrneovim-619407eb548c7df56bc99b945338e9446f846fbb.tar.gz
rneovim-619407eb548c7df56bc99b945338e9446f846fbb.tar.bz2
rneovim-619407eb548c7df56bc99b945338e9446f846fbb.zip
feat(nvim_open_term): convert LF => CRLF (#26384)
Problem: Unlike termopen(), nvim_open_term() PTYs do not carriage-return the cursor on newline ("\n") input. nvim --clean :let chan_id = nvim_open_term(1, {}) :call chansend(chan_id, ["here", "are", "some", "lines"]) Actual behavior: here are some lines Expected behaviour: here are some lines Solution: Add `force_crlf` option, and enable it by default.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/api.txt2
-rw-r--r--runtime/doc/news.txt2
-rw-r--r--runtime/lua/vim/_meta/api.lua2
-rw-r--r--runtime/lua/vim/_meta/api_keysets.lua1
4 files changed, 7 insertions, 0 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index 4aba1f8141..48bbdc33df 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -1231,6 +1231,8 @@ nvim_open_term({buffer}, {*opts}) *nvim_open_term()*
is sent as a "\r", not as a "\n". |textlock| applies. It
is possible to call |nvim_chan_send()| directly in the
callback however. ["input", term, bufnr, data]
+ • force_crlf: (boolean, default true) Convert "\n" to
+ "\r\n".
Return: ~
Channel id, or 0 on error
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
index 04f143f0c3..9bfc577e87 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -344,6 +344,8 @@ The following changes to existing APIs or features add new behavior.
• Diagnostic sign text is no longer configured with |sign_define()|.
Use |vim.diagnostic.config()| instead.
+• Added "force_crlf" option field in |nvim_open_term()|.
+
==============================================================================
REMOVED FEATURES *news-removed*
diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua
index 4ad0a2e791..231e1c3404 100644
--- a/runtime/lua/vim/_meta/api.lua
+++ b/runtime/lua/vim/_meta/api.lua
@@ -1446,6 +1446,8 @@ function vim.api.nvim_notify(msg, log_level, opts) end
--- is sent as a "\r", not as a "\n". `textlock` applies. It
--- is possible to call `nvim_chan_send()` directly in the
--- callback however. ["input", term, bufnr, data]
+--- • force_crlf: (boolean, default true) Convert "\n" to
+--- "\r\n".
--- @return integer
function vim.api.nvim_open_term(buffer, opts) end
diff --git a/runtime/lua/vim/_meta/api_keysets.lua b/runtime/lua/vim/_meta/api_keysets.lua
index 6a3e574455..f64cdb8afd 100644
--- a/runtime/lua/vim/_meta/api_keysets.lua
+++ b/runtime/lua/vim/_meta/api_keysets.lua
@@ -217,6 +217,7 @@ error('Cannot require a meta file')
--- @class vim.api.keyset.open_term
--- @field on_input? function
+--- @field force_crlf? boolean
--- @class vim.api.keyset.option
--- @field scope? string