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.
This commit is contained in:
Raphael
2023-12-14 16:08:00 +08:00
committed by GitHub
parent 36552adb39
commit 619407eb54
11 changed files with 91 additions and 13 deletions

View File

@@ -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