aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/autoload/provider/clipboard.vim3
-rw-r--r--runtime/doc/api.txt4
-rw-r--r--runtime/doc/deprecated.txt5
-rw-r--r--runtime/doc/intro.txt1
-rw-r--r--runtime/doc/lsp.txt42
-rw-r--r--runtime/doc/motion.txt6
-rw-r--r--runtime/doc/news.txt20
-rw-r--r--runtime/doc/options.txt18
-rw-r--r--runtime/doc/term.txt42
-rw-r--r--runtime/doc/vim_diff.txt8
-rw-r--r--runtime/lua/vim/lsp.lua45
-rw-r--r--runtime/lua/vim/lsp/buf.lua11
-rw-r--r--runtime/lua/vim/lsp/health.lua2
-rw-r--r--runtime/lua/vim/lsp/util.lua10
-rw-r--r--src/nvim/api/window.c46
-rw-r--r--src/nvim/ex_getln.c5
-rw-r--r--src/nvim/file_search.c2
-rw-r--r--src/nvim/option.c109
-rw-r--r--src/nvim/optionstr.c2
-rw-r--r--src/nvim/path.c2
-rw-r--r--src/nvim/plines.c38
-rw-r--r--src/nvim/terminal.c2
-rw-r--r--src/nvim/window.c8
-rw-r--r--test/functional/api/window_spec.lua141
-rw-r--r--test/functional/core/fileio_spec.lua28
-rw-r--r--test/functional/legacy/autocmd_option_spec.lua7
-rw-r--r--test/functional/lua/watch_spec.lua9
-rw-r--r--test/functional/plugin/lsp/utils_spec.lua13
-rw-r--r--test/functional/plugin/lsp_spec.lua16
-rw-r--r--test/functional/terminal/buffer_spec.lua24
-rw-r--r--test/functional/ui/inccommand_spec.lua18
-rw-r--r--test/old/testdir/test_backspace_opt.vim18
-rw-r--r--test/old/testdir/test_options.vim28
33 files changed, 377 insertions, 356 deletions
diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim
index 6d238ddb55..6ba28dcbfc 100644
--- a/runtime/autoload/provider/clipboard.vim
+++ b/runtime/autoload/provider/clipboard.vim
@@ -25,7 +25,8 @@ function! s:selection.on_exit(jobid, data, event) abort
if self.owner == a:jobid
let self.owner = 0
endif
- if a:data != 0
+ " Don't print if exit code is >= 128 ( exit is 128+SIGNUM if by signal (e.g. 143 on SIGTERM))
+ if a:data > 0 && a:data < 128
echohl WarningMsg
echomsg 'clipboard: error invoking '.get(self.argv, 0, '?').': '.join(self.stderr)
echohl None
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index a20ba9a348..b33d251786 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -2989,7 +2989,9 @@ nvim_win_text_height({window}, {*opts}) *nvim_win_text_height()*
omitted include the whole line.
Return: ~
- The number of screen lines that the range of text occupy.
+ Dictionary containing text height information, with these keys:
+ • all: The total number of screen lines occupied by the range.
+ • fill: The number of diff filler or virtual lines among them.
See also: ~
• |virtcol()| for text width.
diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt
index 6317789d22..81dd1e64bf 100644
--- a/runtime/doc/deprecated.txt
+++ b/runtime/doc/deprecated.txt
@@ -129,7 +129,7 @@ LSP FUNCTIONS
- *vim.lsp.util.diagnostics_to_items()* Use |vim.diagnostic.toqflist()| instead.
- *vim.lsp.util.set_qflist()* Use |setqflist()| instead.
- *vim.lsp.util.set_loclist()* Use |setloclist()| instead.
-- *vim.lsp.buf_get_clients()* Use |vim.lsp.get_active_clients()| with
+- *vim.lsp.buf_get_clients()* Use |vim.lsp.get_clients()| with
{buffer=bufnr} instead.
- *vim.lsp.buf.formatting()* Use |vim.lsp.buf.format()| with
{async=true} instead.
@@ -139,7 +139,8 @@ LSP FUNCTIONS
or |vim.lsp.buf.format()| instead.
- *vim.lsp.util.get_progress_messages()* Use |vim.lsp.status()| or access
`progress` of |vim.lsp.client|
-- *vim.lsp.for_each_buffer_client()* Use |vim.lsp.get_active_clients()|
+- *vim.lsp.get_active_clients()* Use |vim.lsp.get_clients()|
+- *vim.lsp.for_each_buffer_client()* Use |vim.lsp.get_clients()|
TREESITTER FUNCTIONS
- *vim.treesitter.language.require_language()* Use |vim.treesitter.language.add()|
diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt
index ab380184fc..b496dc5240 100644
--- a/runtime/doc/intro.txt
+++ b/runtime/doc/intro.txt
@@ -372,6 +372,7 @@ notation meaning equivalent decimal value(s) ~
<C-…> control-key *control* *ctrl* *<C-*
<M-…> alt-key or meta-key *META* *ALT* *<M-*
<A-…> same as <M-…> *<A-*
+<T-…> meta-key when it's not alt *<T-*
<D-…> command-key or "super" key *<D-*
----------------------------------------------------------------------- ~
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt
index 5de3e98b5a..fa109dbc26 100644
--- a/runtime/doc/lsp.txt
+++ b/runtime/doc/lsp.txt
@@ -38,7 +38,7 @@ Follow these steps to get LSP features:
})
<
3. Check that the server attached to the buffer: >
- :lua =vim.lsp.get_active_clients()
+ :lua =vim.lsp.get_clients()
4. Configure keymaps and autocmds to use LSP features. See |lsp-config|.
@@ -105,7 +105,7 @@ calls behind capability checks:
To learn what capabilities are available you can run the following command in
a buffer with a started LSP client: >vim
- :lua =vim.lsp.get_active_clients()[1].server_capabilities
+ :lua =vim.lsp.get_clients()[1].server_capabilities
Full list of features provided by default can be found in |lsp-buf|.
@@ -114,7 +114,7 @@ FAQ *lsp-faq*
- Q: How to force-reload LSP?
- A: Stop all clients, then reload the buffer. >vim
- :lua vim.lsp.stop_client(vim.lsp.get_active_clients())
+ :lua vim.lsp.stop_client(vim.lsp.get_clients())
:edit
- Q: Why isn't completion working?
@@ -690,7 +690,7 @@ buf_request_sync({bufnr}, {method}, {params}, {timeout_ms})
client() *vim.lsp.client*
LSP client object. You can get an active client object via
- |vim.lsp.get_client_by_id()| or |vim.lsp.get_active_clients()|.
+ |vim.lsp.get_client_by_id()| or |vim.lsp.get_clients()|.
• Methods:
• request(method, params, [handler], bufnr) Sends a request to the
@@ -773,22 +773,6 @@ formatexpr({opts}) *vim.lsp.formatexpr()*
• timeout_ms (default 500ms). The timeout period for the
formatting request.
-get_active_clients({filter}) *vim.lsp.get_active_clients()*
- Get active clients.
-
- Parameters: ~
- • {filter} (table|nil) A table with key-value pairs used to filter the
- returned clients. The available keys are:
- • id (number): Only return clients with the given id
- • bufnr (number): Only return clients attached to this
- buffer
- • name (string): Only return clients with the given name
- • method (string): Only return clients supporting the given
- method
-
- Return: ~
- lsp.Client []: List of |vim.lsp.client| objects
-
*vim.lsp.get_buffers_by_client_id()*
get_buffers_by_client_id({client_id})
Returns list of buffers attached to client_id.
@@ -809,6 +793,22 @@ get_client_by_id({client_id}) *vim.lsp.get_client_by_id()*
Return: ~
(nil|lsp.Client) client rpc object
+get_clients({filter}) *vim.lsp.get_clients()*
+ Get active clients.
+
+ Parameters: ~
+ • {filter} (table|nil) A table with key-value pairs used to filter the
+ returned clients. The available keys are:
+ • id (number): Only return clients with the given id
+ • bufnr (number): Only return clients attached to this
+ buffer
+ • name (string): Only return clients with the given name
+ • method (string): Only return clients supporting the given
+ method
+
+ Return: ~
+ lsp.Client []: List of |vim.lsp.client| objects
+
get_log_path() *vim.lsp.get_log_path()*
Gets the path of the logfile used by the LSP client.
@@ -1040,7 +1040,7 @@ stop_client({client_id}, {force}) *vim.lsp.stop_client()*
You can also use the `stop()` function on a |vim.lsp.client| object. To stop all clients: >lua
- vim.lsp.stop_client(vim.lsp.get_active_clients())
+ vim.lsp.stop_client(vim.lsp.get_clients())
<
By default asks the server to shutdown, unless stop was requested already
diff --git a/runtime/doc/motion.txt b/runtime/doc/motion.txt
index d7a0205ebd..9ce22c9b78 100644
--- a/runtime/doc/motion.txt
+++ b/runtime/doc/motion.txt
@@ -1026,6 +1026,12 @@ CTRL-O Go to [count] Older cursor position in jump list
CTRL-I Go to [count] newer cursor position in jump list
(not a motion command).
+ NOTE: In the GUI and in a terminal supporting
+ |tui-modifyOtherKeys| or |tui-csiu|, CTRL-I can be
+ mapped separately from <Tab>, on the condition that
+ both keys are mapped, otherwise the mapping applies to
+ both.
+
*:ju* *:jumps*
:ju[mps] Print the jump list (not a motion command).
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
index e16bcafac2..6294a8b505 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -51,6 +51,16 @@ The following changes may require adaptations in user config or plugins.
• `vim.json.null` is redundant with `vim.NIL`.
• `vim.json.array_mt` (and related) is redundant with `vim.empty_dict()`.
+• Removed some Vim 5.0<= option compatibilities:
+ • |'backspace'| no longer supports number values. Instead:
+ • for `backspace=0` set `backspace=` (empty)
+ • for `backspace=1` set `backspace=indent,eol`
+ • for `backspace=2` set `backspace=indent,eol,start` (default behavior in Nvim)
+ • for `backspace=3` set `backspace=indent,eol,nostop`
+ • paths in |'backupdir'|, |'path'| and |'cdpath'| can no longer be separated with
+ spaces (but paths themselves may contain spaces now).
+ • |'directory'| will no longer remove a `>` at the start of the option.
+
==============================================================================
NEW FEATURES *news-features*
@@ -99,11 +109,14 @@ The following new APIs and features were added.
• |vim.system()| for running system commands.
-• Added |nvim_win_text_height()| to get the number of screen lines occupied by
- a range of text in a given window.
+• Added |nvim_win_text_height()| to compute the number of screen lines occupied
+ by a range of text in a given window.
• |nvim_set_keymap()| and |nvim_del_keymap()| now support abbreviations.
+• Builtin TUI can now recognize "super" (|<D-|) and "meta" (|<T-|) modifiers in a
+ terminal emulator that supports |tui-csiu|.
+
• Implemented LSP inlay hints: |vim.lsp.inlay_hint()|
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_inlayHint
@@ -191,7 +204,8 @@ release.
• vim.lsp functions:
- |vim.lsp.util.get_progress_messages()| Use |vim.lsp.status()| instead.
- - |vim.lsp.for_each_buffer_client()| Use |vim.lsp.get_active_clients()| instead.
+ - |vim.lsp.get_active_clients()| Use |vim.lsp.get_clients()| instead.
+ - |vim.lsp.for_each_buffer_client()| Use |vim.lsp.get_clients()| instead.
• `vim.loop` has been renamed to `vim.uv`.
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index da634966f9..4b9797408c 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -762,13 +762,6 @@ A jump table for the options with a short description can be found at |Q_op|.
When the value is empty, Vi compatible backspacing is used, none of
the ways mentioned for the items above are possible.
- For backwards compatibility with version 5.4 and earlier:
- value effect ~
- 0 same as ":set backspace=" (Vi compatible)
- 1 same as ":set backspace=indent,eol"
- 2 same as ":set backspace=indent,eol,start"
- 3 same as ":set backspace=indent,eol,nostop"
-
*'backup'* *'bk'* *'nobackup'* *'nobk'*
'backup' 'bk' boolean (default off)
global
@@ -880,8 +873,7 @@ A jump table for the options with a short description can be found at |Q_op|.
- Careful with '\' characters, type one before a space, type two to
get one in the option (see |option-backslash|), for example: >
:set bdir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces
-< - For backwards compatibility with Vim version 3.0 a '>' at the start
- of the option is removed.
+<
See also 'backup' and 'writebackup' options.
If you want to hide your backup files on Unix, consider this value: >
:set backupdir=./.backup,~/.backup,.,/tmp
@@ -2083,9 +2075,7 @@ A jump table for the options with a short description can be found at |Q_op|.
- Careful with '\' characters, type one before a space, type two to
get one in the option (see |option-backslash|), for example: >
:set dir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces
-< - For backwards compatibility with Vim version 3.0 a '>' at the start
- of the option is removed.
-
+<
Editing the same file twice will result in a warning. Using "/tmp" on
is discouraged: if the system crashes you lose the swap file. And
others on the computer may be able to see the files.
@@ -4490,10 +4480,6 @@ A jump table for the options with a short description can be found at |Q_op|.
option may be relative or absolute.
- Use commas to separate directory names: >
:set path=.,/usr/local/include,/usr/include
-< - Spaces can also be used to separate directory names (for backwards
- compatibility with version 3.0). To have a space in a directory
- name, precede it with an extra backslash, and escape the space: >
- :set path=.,/dir/with\\\ space
< - To include a comma in a directory name precede it with an extra
backslash: >
:set path=.,/dir/with\\,comma
diff --git a/runtime/doc/term.txt b/runtime/doc/term.txt
index 847b4b6112..ee8a4d8732 100644
--- a/runtime/doc/term.txt
+++ b/runtime/doc/term.txt
@@ -108,10 +108,22 @@ and right scroll margins as well. If Nvim detects that the terminal is Xterm,
it will make use of this ability to speed up scrolling that is not the full
width of the terminal.
- *tui-input*
+ *tui-input*
+Historically, terminal emulators could not distinguish between certain control
+key modifiers and other keys. For example, <C-I> and <Tab> are represented in
+the same way, as are <Esc> and <C-[>, <CR> and <C-M>, and <NL> and <C-J>.
+
+Modern terminal emulators are able to distinguish between these pairs of keys
+by encoding control modifiers differently. There are two common but distinct
+ways of doing this, known as "modifyOtherKeys" and "CSI u". Nvim supports both
+encoding methods and at startup will tell the terminal emulator that it
+understands these key encodings. If your terminal emulator supports it then
+this will allow you to map the key pairs listed above separately. |<Tab>|
+
Nvim uses libtermkey to convert terminal escape sequences to key codes.
|terminfo| is used first, and CSI sequences not in |terminfo| (including
-extended keys a.k.a. modifyOtherKeys or "CSI u") can also be parsed.
+extended keys a.k.a. "modifyOtherKeys" or "CSI u") can also be parsed.
+
For example, when running Nvim in tmux, this makes Nvim leave Insert mode and
go to the window below: >
tmux send-keys 'Escape' [ 2 7 u 'C-W' j
@@ -124,42 +136,22 @@ For example, this sequence is recognized by Nvim as <C-kEnter>: >
and can be used differently from <C-CR> in mappings.
*tui-modifyOtherKeys* *tui-csiu*
-Historically, terminal emulators could not distinguish between certain control
-key modifiers and other keys. For example, <C-I> and <Tab> are represented the
-same way, as are <Esc> and <C-[>, <CR> and <C-M>, and <NL> and <C-J>. This
-meant that Nvim also could not map these keys separately.
-
-Modern terminal emulators are able to distinguish between these pairs of keys
-by encoding control modifiers differently. There are two common but distinct
-ways of doing this, known as "modifyOtherKeys" and "CSI u". Nvim supports both
-encoding methods and at startup will tell the terminal emulator that it
-understands these key encodings. If your terminal emulator supports it then
-this will allow you to map the key pairs listed above separately.
-
-At startup Nvim will query your terminal to see if it supports the CSI u
+At startup Nvim will query your terminal to see if it supports the "CSI u"
encoding by writing the sequence >
-
CSI ? u CSI c
-
If your terminal emulator responds with >
-
CSI ? <flags> u
-
-this means your terminal supports the CSI u encoding and Nvim will tell your
+this means your terminal supports the "CSI u" encoding and Nvim will tell your
terminal to enable it by writing the sequence >
-
CSI > 1 u
-
-If your terminal does not support CSI u then Nvim will instead enable the
+If your terminal does not support "CSI u" then Nvim will instead enable the
"modifyOtherKeys" encoding by writing the sequence >
-
CSI > 4 ; 2 m
When Nvim exits cleanly it will send the corresponding sequence to disable the
special key encoding. If Nvim does not exit cleanly then your terminal
emulator could be in a bad state. If this happens, simply run "reset".
-
*tui-colors*
Nvim uses 256 colours by default, ignoring |terminfo| for most terminal types,
including "linux" (whose virtual terminals have had 256-colour support since
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
index f7d0330744..8e87c7ee6c 100644
--- a/runtime/doc/vim_diff.txt
+++ b/runtime/doc/vim_diff.txt
@@ -623,10 +623,17 @@ Highlight groups:
Options:
*'aleph'* *'al'*
antialias
+ 'backspace' no longer supports number values. Instead:
+ - for `backspace=0` set `backspace=` (empty)
+ - for `backspace=1` set `backspace=indent,eol`
+ - for `backspace=2` set `backspace=indent,eol,start` (default behavior in Nvim)
+ - for `backspace=3` set `backspace=indent,eol,nostop`
*'balloondelay'* *'bdlay'*
*'ballooneval'* *'beval'* *'noballooneval'* *'nobeval'*
*'balloonexpr'* *'bexpr'*
+ 'backupdir': paths can no longer be separated with spaces.
bioskey (MS-DOS)
+ 'cdpath': paths can no longer be separated with spaces.
conskey (MS-DOS)
*'cp'* *'nocompatible'* *'nocp'* *'compatible'* (Nvim is always "nocompatible".)
'cpoptions' (gjkHw<*- and all POSIX flags were removed)
@@ -691,6 +698,7 @@ Options:
Use |g8| or |ga|. See |mbyte-combining|.
*'maxmem'* Nvim delegates memory-management to the OS.
*'maxmemtot'* Nvim delegates memory-management to the OS.
+ |'path'|: paths can no longer be separated with spaces.
printoptions
*'printdevice'*
*'printencoding'*
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
index e9a1423d2d..97aab45f2c 100644
--- a/runtime/lua/vim/lsp.lua
+++ b/runtime/lua/vim/lsp.lua
@@ -612,7 +612,7 @@ do
---@private
function changetracking.send_changes(bufnr, firstline, lastline, new_lastline)
local groups = {} ---@type table<string,CTGroup>
- for _, client in pairs(lsp.get_active_clients({ bufnr = bufnr })) do
+ for _, client in pairs(lsp.get_clients({ bufnr = bufnr })) do
local group = get_group(client)
groups[group_key(group)] = group
end
@@ -734,7 +734,7 @@ end
-- FIXME: DOC: Shouldn't need to use a dummy function
--
--- LSP client object. You can get an active client object via
---- |vim.lsp.get_client_by_id()| or |vim.lsp.get_active_clients()|.
+--- |vim.lsp.get_client_by_id()| or |vim.lsp.get_clients()|.
---
--- - Methods:
---
@@ -880,7 +880,7 @@ function lsp.start(config, opts)
if bufnr == nil or bufnr == 0 then
bufnr = api.nvim_get_current_buf()
end
- for _, clients in ipairs({ uninitialized_clients, lsp.get_active_clients() }) do
+ for _, clients in ipairs({ uninitialized_clients, lsp.get_clients() }) do
for _, client in pairs(clients) do
if reuse_client(client, config) then
lsp.buf_attach_client(bufnr, client.id)
@@ -903,7 +903,7 @@ end
function lsp.status()
local percentage = nil
local messages = {}
- for _, client in ipairs(vim.lsp.get_active_clients()) do
+ for _, client in ipairs(vim.lsp.get_clients()) do
for progress in client.progress do
local value = progress.value
if type(value) == 'table' and value.kind then
@@ -1755,7 +1755,7 @@ local function text_document_did_save_handler(bufnr)
bufnr = resolve_bufnr(bufnr)
local uri = vim.uri_from_bufnr(bufnr)
local text = once(buf_get_full_text)
- for _, client in ipairs(lsp.get_active_clients({ bufnr = bufnr })) do
+ for _, client in ipairs(lsp.get_clients({ bufnr = bufnr })) do
local name = api.nvim_buf_get_name(bufnr)
local old_name = changetracking._get_and_set_name(client, bufnr, name)
if old_name and name ~= old_name then
@@ -1823,7 +1823,7 @@ function lsp.buf_attach_client(bufnr, client_id)
buffer = bufnr,
desc = 'vim.lsp: textDocument/willSave',
callback = function(ctx)
- for _, client in ipairs(lsp.get_active_clients({ bufnr = ctx.buf })) do
+ for _, client in ipairs(lsp.get_clients({ bufnr = ctx.buf })) do
local params = {
textDocument = {
uri = uri,
@@ -1858,7 +1858,7 @@ function lsp.buf_attach_client(bufnr, client_id)
on_lines = text_document_did_change_handler,
on_reload = function()
local params = { textDocument = { uri = uri } }
- for _, client in ipairs(lsp.get_active_clients({ bufnr = bufnr })) do
+ for _, client in ipairs(lsp.get_clients({ bufnr = bufnr })) do
changetracking.reset_buf(client, bufnr)
if vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'openClose') then
client.notify('textDocument/didClose', params)
@@ -1868,7 +1868,7 @@ function lsp.buf_attach_client(bufnr, client_id)
end,
on_detach = function()
local params = { textDocument = { uri = uri } }
- for _, client in ipairs(lsp.get_active_clients({ bufnr = bufnr })) do
+ for _, client in ipairs(lsp.get_clients({ bufnr = bufnr })) do
changetracking.reset_buf(client, bufnr)
if vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'openClose') then
client.notify('textDocument/didClose', params)
@@ -1985,7 +1985,7 @@ end
--- You can also use the `stop()` function on a |vim.lsp.client| object.
--- To stop all clients:
--- <pre>lua
---- vim.lsp.stop_client(vim.lsp.get_active_clients())
+--- vim.lsp.stop_client(vim.lsp.get_clients())
--- </pre>
---
--- By default asks the server to shutdown, unless stop was requested
@@ -2006,7 +2006,7 @@ function lsp.stop_client(client_id, force)
end
end
----@class vim.lsp.get_active_clients.filter
+---@class vim.lsp.get_clients.filter
---@field id integer|nil Match clients by id
---@field bufnr integer|nil match clients attached to the given buffer
---@field name string|nil match clients by name
@@ -2014,7 +2014,7 @@ end
--- Get active clients.
---
----@param filter vim.lsp.get_active_clients.filter|nil (table|nil) A table with
+---@param filter vim.lsp.get_clients.filter|nil (table|nil) A table with
--- key-value pairs used to filter the returned clients.
--- The available keys are:
--- - id (number): Only return clients with the given id
@@ -2022,7 +2022,7 @@ end
--- - name (string): Only return clients with the given name
--- - method (string): Only return clients supporting the given method
---@return lsp.Client[]: List of |vim.lsp.client| objects
-function lsp.get_active_clients(filter)
+function lsp.get_clients(filter)
validate({ filter = { filter, 't', true } })
filter = filter or {}
@@ -2045,6 +2045,13 @@ function lsp.get_active_clients(filter)
return clients
end
+---@private
+---@deprecated
+function lsp.get_active_clients(filter)
+ -- TODO: add vim.deprecate call after 0.10 is out for removal in 0.12
+ return lsp.get_clients(filter)
+end
+
api.nvim_create_autocmd('VimLeavePre', {
desc = 'vim.lsp: exit handler',
callback = function()
@@ -2125,7 +2132,7 @@ function lsp.buf_request(bufnr, method, params, handler)
bufnr = resolve_bufnr(bufnr)
local method_supported = false
- local clients = lsp.get_active_clients({ bufnr = bufnr })
+ local clients = lsp.get_clients({ bufnr = bufnr })
local client_request_ids = {}
for _, client in ipairs(clients) do
if client.supports_method(method, { bufnr = bufnr }) then
@@ -2173,7 +2180,7 @@ function lsp.buf_request_all(bufnr, method, params, handler)
local expected_result_count = 0
local set_expected_result_count = once(function()
- for _, client in ipairs(lsp.get_active_clients({ bufnr = bufnr })) do
+ for _, client in ipairs(lsp.get_clients({ bufnr = bufnr })) do
if client.supports_method(method, { bufnr = bufnr }) then
expected_result_count = expected_result_count + 1
end
@@ -2240,7 +2247,7 @@ function lsp.buf_notify(bufnr, method, params)
method = { method, 's' },
})
local resp = false
- for _, client in ipairs(lsp.get_active_clients({ bufnr = bufnr })) do
+ for _, client in ipairs(lsp.get_clients({ bufnr = bufnr })) do
if client.rpc.notify(method, params) then
resp = true
end
@@ -2367,7 +2374,7 @@ function lsp.formatexpr(opts)
return 0
end
local bufnr = api.nvim_get_current_buf()
- for _, client in pairs(lsp.get_active_clients({ bufnr = bufnr })) do
+ for _, client in pairs(lsp.get_clients({ bufnr = bufnr })) do
if client.supports_method('textDocument/rangeFormatting') then
local params = util.make_formatting_params()
local end_line = vim.fn.getline(end_lnum) --[[@as string]]
@@ -2424,10 +2431,10 @@ end
---
---@param bufnr (integer|nil): Buffer handle, or 0 for current
---@return table result is table of (client_id, client) pairs
----@deprecated Use |vim.lsp.get_active_clients()| instead.
+---@deprecated Use |vim.lsp.get_clients()| instead.
function lsp.buf_get_clients(bufnr)
local result = {}
- for _, client in ipairs(lsp.get_active_clients({ bufnr = resolve_bufnr(bufnr) })) do
+ for _, client in ipairs(lsp.get_clients({ bufnr = resolve_bufnr(bufnr) })) do
result[client.id] = client
end
return result
@@ -2478,7 +2485,7 @@ end
--- vim.print(client)
--- end)
--- </pre>
----@deprecated use lsp.get_active_clients({ bufnr = bufnr }) with regular loop
+---@deprecated use lsp.get_clients({ bufnr = bufnr }) with regular loop
function lsp.for_each_buffer_client(bufnr, fn)
return for_each_buffer_client(bufnr, fn)
end
diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua
index b238b5c221..2140d3ae37 100644
--- a/runtime/lua/vim/lsp/buf.lua
+++ b/runtime/lua/vim/lsp/buf.lua
@@ -197,7 +197,6 @@ end
function M.format(options)
options = options or {}
local bufnr = options.bufnr or api.nvim_get_current_buf()
-
local mode = api.nvim_get_mode().mode
local range = options.range
if not range and mode == 'v' or mode == 'V' then
@@ -205,7 +204,7 @@ function M.format(options)
end
local method = range and 'textDocument/rangeFormatting' or 'textDocument/formatting'
- local clients = vim.lsp.get_active_clients({
+ local clients = vim.lsp.get_clients({
id = options.id,
bufnr = bufnr,
name = options.name,
@@ -271,7 +270,7 @@ end
function M.rename(new_name, options)
options = options or {}
local bufnr = options.bufnr or api.nvim_get_current_buf()
- local clients = vim.lsp.get_active_clients({
+ local clients = vim.lsp.get_clients({
bufnr = bufnr,
name = options.name,
-- Clients must at least support rename, prepareRename is optional
@@ -468,7 +467,7 @@ end
---
function M.list_workspace_folders()
local workspace_folders = {}
- for _, client in pairs(vim.lsp.get_active_clients({ bufnr = 0 })) do
+ for _, client in pairs(vim.lsp.get_clients({ bufnr = 0 })) do
for _, folder in pairs(client.workspace_folders or {}) do
table.insert(workspace_folders, folder.name)
end
@@ -493,7 +492,7 @@ function M.add_workspace_folder(workspace_folder)
{ { uri = vim.uri_from_fname(workspace_folder), name = workspace_folder } },
{}
)
- for _, client in pairs(vim.lsp.get_active_clients({ bufnr = 0 })) do
+ for _, client in pairs(vim.lsp.get_clients({ bufnr = 0 })) do
local found = false
for _, folder in pairs(client.workspace_folders or {}) do
if folder.name == workspace_folder then
@@ -526,7 +525,7 @@ function M.remove_workspace_folder(workspace_folder)
{ {} },
{ { uri = vim.uri_from_fname(workspace_folder), name = workspace_folder } }
)
- for _, client in pairs(vim.lsp.get_active_clients({ bufnr = 0 })) do
+ for _, client in pairs(vim.lsp.get_clients({ bufnr = 0 })) do
for idx, folder in pairs(client.workspace_folders or {}) do
if folder.name == workspace_folder then
vim.lsp.buf_notify(0, 'workspace/didChangeWorkspaceFolders', params)
diff --git a/runtime/lua/vim/lsp/health.lua b/runtime/lua/vim/lsp/health.lua
index 8817bb71de..023b1c26be 100644
--- a/runtime/lua/vim/lsp/health.lua
+++ b/runtime/lua/vim/lsp/health.lua
@@ -28,7 +28,7 @@ function M.check()
local report_fn = (log_size / 1000000 > 100 and report_warn or report_info)
report_fn(string.format('Log size: %d KB', log_size / 1000))
- local clients = vim.lsp.get_active_clients()
+ local clients = vim.lsp.get_clients()
vim.health.start('vim.lsp: Active Clients')
if next(clients) then
for _, client in pairs(clients) do
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index 8d6f88bb2c..59b9916f64 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -360,7 +360,7 @@ function M.get_progress_messages()
local new_messages = {}
local progress_remove = {}
- for _, client in ipairs(vim.lsp.get_active_clients()) do
+ for _, client in ipairs(vim.lsp.get_clients()) do
local groups = {}
for progress in client.progress do
local value = progress.value
@@ -1347,7 +1347,7 @@ function M.stylize_markdown(bufnr, contents, opts)
-- table of fence types to {ft, begin, end}
-- when ft is nil, we get the ft from the regex match
local matchers = {
- block = { nil, '```+([a-zA-Z0-9_]*)', '```+' },
+ block = { nil, '```+%s*([a-zA-Z0-9_]*)', '```+' },
pre = { nil, '<pre>([a-z0-9]*)', '</pre>' },
code = { '', '<code>', '</code>' },
text = { 'text', '<text>', '</text>' },
@@ -1841,7 +1841,7 @@ function M.locations_to_items(locations, offset_encoding)
'locations_to_items must be called with valid offset encoding',
vim.log.levels.WARN
)
- offset_encoding = vim.lsp.get_active_clients({ bufnr = 0 })[1].offset_encoding
+ offset_encoding = vim.lsp.get_clients({ bufnr = 0 })[1].offset_encoding
end
local items = {}
@@ -2036,7 +2036,7 @@ function M._get_offset_encoding(bufnr)
local offset_encoding
- for _, client in pairs(vim.lsp.get_active_clients({ bufnr = bufnr })) do
+ for _, client in pairs(vim.lsp.get_clients({ bufnr = bufnr })) do
if client.offset_encoding == nil then
vim.notify_once(
string.format(
@@ -2183,7 +2183,7 @@ function M.character_offset(buf, row, col, offset_encoding)
'character_offset must be called with valid offset encoding',
vim.log.levels.WARN
)
- offset_encoding = vim.lsp.get_active_clients({ bufnr = buf })[1].offset_encoding
+ offset_encoding = vim.lsp.get_clients({ bufnr = buf })[1].offset_encoding
end
-- If the col is past the EOL, use the line length.
if col > #line then
diff --git a/src/nvim/api/window.c b/src/nvim/api/window.c
index 07aad2cd88..5480584aa5 100644
--- a/src/nvim/api/window.c
+++ b/src/nvim/api/window.c
@@ -488,15 +488,20 @@ void nvim_win_set_hl_ns(Window window, Integer ns_id, Error *err)
/// - end_vcol: Ending virtual column index on "end_row",
/// 0-based exclusive, rounded up to full screen lines.
/// When omitted include the whole line.
-/// @return The number of screen lines that the range of text occupy.
+/// @return Dictionary containing text height information, with these keys:
+/// - all: The total number of screen lines occupied by the range.
+/// - fill: The number of diff filler or virtual lines among them.
///
/// @see |virtcol()| for text width.
-Object nvim_win_text_height(Window window, Dict(win_text_height) *opts, Error *err)
+Dictionary nvim_win_text_height(Window window, Dict(win_text_height) *opts, Arena *arena,
+ Error *err)
FUNC_API_SINCE(12)
{
+ Dictionary rv = arena_dict(arena, 2);
+
win_T *const win = find_window_by_handle(window, err);
if (!win) {
- return NIL;
+ return rv;
}
buf_T *const buf = win->w_buffer;
const linenr_T line_count = buf->b_ml.ml_line_count;
@@ -510,58 +515,65 @@ Object nvim_win_text_height(Window window, Dict(win_text_height) *opts, Error *e
if (HAS_KEY(opts->start_row)) {
VALIDATE_T("start_row", kObjectTypeInteger, opts->start_row.type, {
- return NIL;
+ return rv;
});
start_lnum = (linenr_T)normalize_index(buf, opts->start_row.data.integer, false, &oob);
}
if (HAS_KEY(opts->end_row)) {
VALIDATE_T("end_row", kObjectTypeInteger, opts->end_row.type, {
- return NIL;
+ return rv;
});
end_lnum = (linenr_T)normalize_index(buf, opts->end_row.data.integer, false, &oob);
}
VALIDATE(!oob, "%s", "Line index out of bounds", {
- return NIL;
+ return rv;
});
VALIDATE((start_lnum <= end_lnum), "%s", "'start_row' is higher than 'end_row'", {
- return NIL;
+ return rv;
});
if (HAS_KEY(opts->start_vcol)) {
VALIDATE(HAS_KEY(opts->start_row), "%s", "'start_vcol' specified without 'start_row'", {
- return NIL;
+ return rv;
});
VALIDATE_T("start_vcol", kObjectTypeInteger, opts->start_vcol.type, {
- return NIL;
+ return rv;
});
start_vcol = opts->start_vcol.data.integer;
VALIDATE_RANGE((start_vcol >= 0 && start_vcol <= MAXCOL), "start_vcol", {
- return NIL;
+ return rv;
});
}
if (HAS_KEY(opts->end_vcol)) {
VALIDATE(HAS_KEY(opts->end_row), "%s", "'end_vcol' specified without 'end_row'", {
- return NIL;
+ return rv;
});
VALIDATE_T("end_vcol", kObjectTypeInteger, opts->end_vcol.type, {
- return NIL;
+ return rv;
});
end_vcol = opts->end_vcol.data.integer;
VALIDATE_RANGE((end_vcol >= 0 && end_vcol <= MAXCOL), "end_vcol", {
- return NIL;
+ return rv;
});
}
if (start_lnum == end_lnum && start_vcol >= 0 && end_vcol >= 0) {
VALIDATE((start_vcol <= end_vcol), "%s", "'start_vcol' is higher than 'end_vcol'", {
- return NIL;
+ return rv;
});
}
- const int64_t res = win_text_height(win, start_lnum, start_vcol, end_lnum, end_vcol)
- + (HAS_KEY(opts->end_row) ? 0 : win_get_fill(win, line_count + 1));
- return INTEGER_OBJ(res);
+ int64_t fill = 0;
+ int64_t all = win_text_height(win, start_lnum, start_vcol, end_lnum, end_vcol, &fill);
+ if (!HAS_KEY(opts->end_row)) {
+ const int64_t end_fill = win_get_fill(win, line_count + 1);
+ fill += end_fill;
+ all += end_fill;
+ }
+ PUT_C(rv, "all", INTEGER_OBJ(all));
+ PUT_C(rv, "fill", INTEGER_OBJ(fill));
+ return rv;
}
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 6bb980d501..927877dc74 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -261,6 +261,7 @@ static bool do_incsearch_highlighting(int firstc, int *search_delim, incsearch_s
return false;
}
+ emsg_off++;
exarg_T ea = {
.line1 = 1,
.line2 = 1,
@@ -368,6 +369,7 @@ static bool do_incsearch_highlighting(int firstc, int *search_delim, incsearch_s
curwin->w_cursor = save_cursor;
retval = true;
theend:
+ emsg_off--;
return retval;
}
@@ -2427,9 +2429,12 @@ static bool cmdpreview_may_show(CommandLineState *s)
int cmdpreview_type = 0;
char *cmdline = xstrdup(ccline.cmdbuff);
const char *errormsg = NULL;
+ emsg_off++; // Block errors when parsing the command line, and don't update v:errmsg
if (!parse_cmdline(cmdline, &ea, &cmdinfo, &errormsg)) {
+ emsg_off--;
goto end;
}
+ emsg_off--;
// Check if command is previewable, if not, don't attempt to show preview
if (!(ea.argt & EX_PREVIEW)) {
diff --git a/src/nvim/file_search.c b/src/nvim/file_search.c
index 1bfbe2e634..b5cdeff21c 100644
--- a/src/nvim/file_search.c
+++ b/src/nvim/file_search.c
@@ -1469,7 +1469,7 @@ char *find_file_in_path_option(char *ptr, size_t len, int options, int first, ch
// copy next path
buf[0] = 0;
- copy_option_part(&dir, buf, MAXPATHL, " ,");
+ copy_option_part(&dir, buf, MAXPATHL, ",");
// get the stopdir string
r_ptr = vim_findfile_stopdir(buf);
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 598ae8e490..bece6f3605 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -842,77 +842,6 @@ static void do_set_num(int opt_idx, int opt_flags, char **argp, int nextchar, co
errbuf, errbuflen, opt_flags);
}
-// Handle some special cases with string option values
-static void munge_string_opt_val(char **varp, char **oldval, char **const origval,
- char **const origval_l, char **const origval_g, char **const argp,
- char *const whichwrap, size_t whichwraplen, char **const save_argp)
-{
- // Set 'keywordprg' to ":help" if an empty
- // value was passed to :set by the user.
- if (varp == &p_kp && (**argp == NUL || **argp == ' ')) {
- *save_argp = *argp;
- *argp = ":help";
- } else if (varp == &p_bs && ascii_isdigit((uint8_t)(**varp))) {
- // Convert 'backspace' number to string, for
- // adding, prepending and removing string.
- const int i = getdigits_int(varp, true, 0);
- switch (i) {
- case 0:
- *varp = empty_option;
- break;
- case 1:
- *varp = xstrdup("indent,eol");
- break;
- case 2:
- *varp = xstrdup("indent,eol,start");
- break;
- case 3:
- *varp = xstrdup("indent,eol,nostop");
- break;
- }
- xfree(*oldval);
- if (*origval == *oldval) {
- *origval = *varp;
- }
- if (*origval_l == *oldval) {
- *origval_l = *varp;
- }
- if (*origval_g == *oldval) {
- *origval_g = *varp;
- }
- *oldval = *varp;
- } else if (varp == &p_ww && ascii_isdigit(**argp)) {
- // Convert 'whichwrap' number to string, for backwards compatibility
- // with Vim 3.0.
- *whichwrap = NUL;
- int i = getdigits_int(argp, true, 0);
- if (i & 1) {
- xstrlcat(whichwrap, "b,", whichwraplen);
- }
- if (i & 2) {
- xstrlcat(whichwrap, "s,", whichwraplen);
- }
- if (i & 4) {
- xstrlcat(whichwrap, "h,l,", whichwraplen);
- }
- if (i & 8) {
- xstrlcat(whichwrap, "<,>,", whichwraplen);
- }
- if (i & 16) {
- xstrlcat(whichwrap, "[,],", whichwraplen);
- }
- if (*whichwrap != NUL) { // remove trailing ,
- whichwrap[strlen(whichwrap) - 1] = NUL;
- }
- *save_argp = *argp;
- *argp = whichwrap;
- } else if (**argp == '>' && (varp == &p_dir || varp == &p_bdir)) {
- // Remove '>' before 'dir' and 'bdir', for backwards compatibility with
- // version 3.0
- (*argp)++;
- }
-}
-
/// Get the default value for a string option.
static char *stropt_get_default_val(int opt_idx, uint64_t flags)
{
@@ -1084,20 +1013,14 @@ static void stropt_remove_dupflags(char *newval, uint32_t flags)
/// set {opt}<
/// set {opt}={val}
/// set {opt}:{val}
-static char *stropt_get_newval(int nextchar, int opt_idx, char **argp, void *varp,
- char **origval_arg, char **origval_l_arg, char **origval_g_arg,
- char **oldval_arg, set_op_T *op_arg, uint32_t flags)
+static char *stropt_get_newval(int nextchar, int opt_idx, char **argp, void *varp, char *origval,
+ set_op_T *op_arg, uint32_t flags)
{
char *arg = *argp;
- char *origval = *origval_arg;
- char *origval_l = *origval_l_arg;
- char *origval_g = *origval_g_arg;
- char *oldval = *oldval_arg;
set_op_T op = *op_arg;
char *save_arg = NULL;
char *newval;
char *s = NULL;
- char whichwrap[80];
if (nextchar == '&') { // set to default val
newval = stropt_get_default_val(opt_idx, flags);
} else if (nextchar == '<') { // set to global val
@@ -1105,8 +1028,12 @@ static char *stropt_get_newval(int nextchar, int opt_idx, char **argp, void *var
} else {
arg++; // jump to after the '=' or ':'
- munge_string_opt_val((char **)varp, &oldval, &origval, &origval_l, &origval_g, &arg,
- whichwrap, sizeof(whichwrap), &save_arg);
+ // Set 'keywordprg' to ":help" if an empty
+ // value was passed to :set by the user.
+ if (varp == &p_kp && (*arg == NUL || *arg == ' ')) {
+ save_arg = arg;
+ arg = ":help";
+ }
// Copy the new string into allocated memory.
newval = stropt_copy_value(origval, &arg, op, flags);
@@ -1155,10 +1082,6 @@ static char *stropt_get_newval(int nextchar, int opt_idx, char **argp, void *var
arg = save_arg; // arg was temporarily changed, restore it
}
*argp = arg;
- *origval_arg = origval;
- *origval_l_arg = origval_l;
- *origval_g_arg = origval_g;
- *oldval_arg = oldval;
*op_arg = op;
return newval;
@@ -1207,8 +1130,7 @@ static void do_set_option_string(int opt_idx, int opt_flags, char **argp, int ne
}
// Get the new value for the option
- char *newval = stropt_get_newval(nextchar, opt_idx, &arg, varp, &origval,
- &origval_l, &origval_g, &oldval, &op, flags);
+ char *newval = stropt_get_newval(nextchar, opt_idx, &arg, varp, origval, &op, flags);
// Set the new value.
*(char **)(varp) = newval;
@@ -5903,16 +5825,13 @@ bool can_bs(int what)
if (what == BS_START && bt_prompt(curbuf)) {
return false;
}
- switch (*p_bs) {
- case '3':
- return true;
- case '2':
+
+ // support for number values was removed but we keep '2' since it is used in
+ // legacy tests
+ if (*p_bs == '2') {
return what != BS_NOSTOP;
- case '1':
- return what != BS_START;
- case '0':
- return false;
}
+
return vim_strchr(p_bs, what) != NULL;
}
diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c
index 3750574613..f07c05c113 100644
--- a/src/nvim/optionstr.c
+++ b/src/nvim/optionstr.c
@@ -1664,7 +1664,7 @@ const char *did_set_foldcolumn(optset_T *args)
const char *did_set_backspace(optset_T *args FUNC_ATTR_UNUSED)
{
if (ascii_isdigit(*p_bs)) {
- if (*p_bs > '3' || p_bs[1] != NUL) {
+ if (*p_bs != '2') {
return e_invarg;
}
} else if (check_opt_strings(p_bs, p_bs_values, true) != OK) {
diff --git a/src/nvim/path.c b/src/nvim/path.c
index d1e0947038..3b36c2a550 100644
--- a/src/nvim/path.c
+++ b/src/nvim/path.c
@@ -847,7 +847,7 @@ static void expand_path_option(char *curdir, garray_T *gap)
char *buf = xmalloc(MAXPATHL);
while (*path_option != NUL) {
- copy_option_part(&path_option, buf, MAXPATHL, " ,");
+ copy_option_part(&path_option, buf, MAXPATHL, ",");
if (buf[0] == '.' && (buf[1] == NUL || vim_ispathsep(buf[1]))) {
// Relative to current buffer:
diff --git a/src/nvim/plines.c b/src/nvim/plines.c
index 73b15edb27..236a992bf9 100644
--- a/src/nvim/plines.c
+++ b/src/nvim/plines.c
@@ -600,16 +600,17 @@ static int win_nolbr_chartabsize(chartabsize_T *cts, int *headp)
/// Get the number of screen lines a range of text will take in window "wp".
///
-/// @param start_lnum Starting line number, 1-based inclusive.
-/// @param start_vcol >= 0: Starting virtual column index on "start_lnum",
-/// 0-based inclusive, rounded down to full screen lines.
-/// < 0: Count a full "start_lnum", including filler lines above.
-/// @param end_lnum Ending line number, 1-based inclusive.
-/// @param end_vcol >= 0: Ending virtual column index on "end_lnum",
-/// 0-based exclusive, rounded up to full screen lines.
-/// < 0: Count a full "end_lnum", not including fillers lines below.
+/// @param[in] start_lnum Starting line number, 1-based inclusive.
+/// @param[in] start_vcol >= 0: Starting virtual column index on "start_lnum",
+/// 0-based inclusive, rounded down to full screen lines.
+/// < 0: Count a full "start_lnum", including filler lines above.
+/// @param[in] end_lnum Ending line number, 1-based inclusive.
+/// @param[in] end_vcol >= 0: Ending virtual column index on "end_lnum",
+/// 0-based exclusive, rounded up to full screen lines.
+/// < 0: Count a full "end_lnum", not including filler lines below.
+/// @param[out] fill If not NULL, set to the number of filler lines in the range.
int64_t win_text_height(win_T *const wp, const linenr_T start_lnum, const int64_t start_vcol,
- const linenr_T end_lnum, const int64_t end_vcol)
+ const linenr_T end_lnum, const int64_t end_vcol, int64_t *const fill)
{
int width1 = 0;
int width2 = 0;
@@ -620,39 +621,44 @@ int64_t win_text_height(win_T *const wp, const linenr_T start_lnum, const int64_
width2 = MAX(width2, 0);
}
- int64_t height_sum = 0;
+ int64_t height_sum_fill = 0;
int64_t height_cur_nofill = 0;
+ int64_t height_sum_nofill = 0;
linenr_T lnum = start_lnum;
if (start_vcol >= 0) {
linenr_T lnum_next = lnum;
const bool folded = hasFoldingWin(wp, lnum, &lnum, &lnum_next, true, NULL);
height_cur_nofill = folded ? 1 : plines_win_nofill(wp, lnum, false);
- height_sum += height_cur_nofill;
+ height_sum_nofill += height_cur_nofill;
const int64_t row_off = (start_vcol < width1 || width2 <= 0)
? 0
: 1 + (start_vcol - width1) / width2;
- height_sum -= MIN(row_off, height_cur_nofill);
+ height_sum_nofill -= MIN(row_off, height_cur_nofill);
lnum = lnum_next + 1;
}
while (lnum <= end_lnum) {
linenr_T lnum_next = lnum;
const bool folded = hasFoldingWin(wp, lnum, &lnum, &lnum_next, true, NULL);
+ height_sum_fill += win_get_fill(wp, lnum);
height_cur_nofill = folded ? 1 : plines_win_nofill(wp, lnum, false);
- height_sum += win_get_fill(wp, lnum) + height_cur_nofill;
+ height_sum_nofill += height_cur_nofill;
lnum = lnum_next + 1;
}
if (end_vcol >= 0) {
- height_sum -= height_cur_nofill;
+ height_sum_nofill -= height_cur_nofill;
const int64_t row_off = end_vcol == 0
? 0
: (end_vcol <= width1 || width2 <= 0)
? 1
: 1 + (end_vcol - width1 + width2 - 1) / width2;
- height_sum += MIN(row_off, height_cur_nofill);
+ height_sum_nofill += MIN(row_off, height_cur_nofill);
}
- return height_sum;
+ if (fill != NULL) {
+ *fill = height_sum_fill;
+ }
+ return height_sum_fill + height_sum_nofill;
}
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c
index 1479656bca..caa4674cef 100644
--- a/src/nvim/terminal.c
+++ b/src/nvim/terminal.c
@@ -766,7 +766,7 @@ void terminal_send_key(Terminal *term, int c)
if (key) {
vterm_keyboard_key(term->vt, key, mod);
- } else {
+ } else if (!IS_SPECIAL(c)) {
vterm_keyboard_unichar(term->vt, (uint32_t)c, mod);
}
}
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 1a78918b09..e230bde95c 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -1052,19 +1052,19 @@ void ui_ext_win_viewport(win_T *wp)
|| (cur_topline == last_topline && wp->w_skipcol < last_skipcol)) {
if (last_topline > 0 && cur_botline < last_topline) {
// Scrolling too many lines: only give an approximate "scroll_delta".
- delta -= win_text_height(wp, cur_topline, wp->w_skipcol, cur_botline, 0);
+ delta -= win_text_height(wp, cur_topline, wp->w_skipcol, cur_botline, 0, NULL);
delta -= last_topline - cur_botline;
} else {
- delta -= win_text_height(wp, cur_topline, wp->w_skipcol, last_topline, last_skipcol);
+ delta -= win_text_height(wp, cur_topline, wp->w_skipcol, last_topline, last_skipcol, NULL);
}
} else if (cur_topline > last_topline
|| (cur_topline == last_topline && wp->w_skipcol > last_skipcol)) {
if (last_botline > 0 && cur_topline > last_botline) {
// Scrolling too many lines: only give an approximate "scroll_delta".
- delta += win_text_height(wp, last_topline, last_skipcol, last_botline, 0);
+ delta += win_text_height(wp, last_topline, last_skipcol, last_botline, 0, NULL);
delta += cur_topline - last_botline;
} else {
- delta += win_text_height(wp, last_topline, last_skipcol, cur_topline, wp->w_skipcol);
+ delta += win_text_height(wp, last_topline, last_skipcol, cur_topline, wp->w_skipcol, NULL);
}
}
delta += last_topfill;
diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua
index 8038a84139..19511f30f1 100644
--- a/test/functional/api/window_spec.lua
+++ b/test/functional/api/window_spec.lua
@@ -687,42 +687,42 @@ describe('API/win', function()
{8:[No Name] [+] }{9:[No Name] [+] }|
|
]]}
- eq(20, meths.win_text_height(1000, {}))
- eq(20, meths.win_text_height(1001, {}))
- eq(20, meths.win_text_height(1000, { start_row = 0 }))
- eq(20, meths.win_text_height(1001, { start_row = 0 }))
- eq(15, meths.win_text_height(1000, { end_row = -1 }))
- eq(20, meths.win_text_height(1001, { end_row = -1 }))
- eq(15, meths.win_text_height(1000, { end_row = 40 }))
- eq(20, meths.win_text_height(1001, { end_row = 40 }))
- eq(10, meths.win_text_height(1000, { start_row = 23 }))
- eq(13, meths.win_text_height(1001, { start_row = 18 }))
- eq(11, meths.win_text_height(1000, { end_row = 23 }))
- eq(11, meths.win_text_height(1001, { end_row = 18 }))
- eq(11, meths.win_text_height(1000, { start_row = 3, end_row = 39 }))
- eq(11, meths.win_text_height(1001, { start_row = 1, end_row = 34 }))
- eq(9, meths.win_text_height(1000, { start_row = 4, end_row = 38 }))
- eq(9, meths.win_text_height(1001, { start_row = 2, end_row = 33 }))
- eq(9, meths.win_text_height(1000, { start_row = 5, end_row = 37 }))
- eq(9, meths.win_text_height(1001, { start_row = 3, end_row = 32 }))
- eq(9, meths.win_text_height(1000, { start_row = 17, end_row = 25 }))
- eq(9, meths.win_text_height(1001, { start_row = 15, end_row = 20 }))
- eq(7, meths.win_text_height(1000, { start_row = 18, end_row = 24 }))
- eq(7, meths.win_text_height(1001, { start_row = 16, end_row = 19 }))
- eq(6, meths.win_text_height(1000, { start_row = -1 }))
- eq(5, meths.win_text_height(1000, { start_row = -1, start_vcol = X }))
- eq(0, meths.win_text_height(1000, { start_row = -1, start_vcol = X, end_row = -1 }))
- eq(0, meths.win_text_height(1000, { start_row = -1, start_vcol = X, end_row = -1, end_vcol = X }))
- eq(1, meths.win_text_height(1000, { start_row = -1, start_vcol = 0, end_row = -1, end_vcol = X }))
- eq(3, meths.win_text_height(1001, { end_row = 0 }))
- eq(2, meths.win_text_height(1001, { end_row = 0, end_vcol = 0 }))
- eq(2, meths.win_text_height(1001, { start_row = 0, end_row = 0, end_vcol = 0 }))
- eq(0, meths.win_text_height(1001, { start_row = 0, start_vcol = 0, end_row = 0, end_vcol = 0 }))
- eq(1, meths.win_text_height(1001, { start_row = 0, start_vcol = 0, end_row = 0, end_vcol = X }))
- eq(11, meths.win_text_height(1001, { end_row = 18 }))
- eq(9, meths.win_text_height(1001, { start_row = 0, start_vcol = 0, end_row = 18 }))
- eq(10, meths.win_text_height(1001, { end_row = 18, end_vcol = 0 }))
- eq(8, meths.win_text_height(1001, { start_row = 0, start_vcol = 0, end_row = 18, end_vcol = 0 }))
+ eq({ all = 20, fill = 5 }, meths.win_text_height(1000, {}))
+ eq({ all = 20, fill = 5 }, meths.win_text_height(1001, {}))
+ eq({ all = 20, fill = 5 }, meths.win_text_height(1000, { start_row = 0 }))
+ eq({ all = 20, fill = 5 }, meths.win_text_height(1001, { start_row = 0 }))
+ eq({ all = 15, fill = 0 }, meths.win_text_height(1000, { end_row = -1 }))
+ eq({ all = 15, fill = 0 }, meths.win_text_height(1000, { end_row = 40 }))
+ eq({ all = 20, fill = 5 }, meths.win_text_height(1001, { end_row = -1 }))
+ eq({ all = 20, fill = 5 }, meths.win_text_height(1001, { end_row = 40 }))
+ eq({ all = 10, fill = 5 }, meths.win_text_height(1000, { start_row = 23 }))
+ eq({ all = 13, fill = 3 }, meths.win_text_height(1001, { start_row = 18 }))
+ eq({ all = 11, fill = 0 }, meths.win_text_height(1000, { end_row = 23 }))
+ eq({ all = 11, fill = 5 }, meths.win_text_height(1001, { end_row = 18 }))
+ eq({ all = 11, fill = 0 }, meths.win_text_height(1000, { start_row = 3, end_row = 39 }))
+ eq({ all = 11, fill = 3 }, meths.win_text_height(1001, { start_row = 1, end_row = 34 }))
+ eq({ all = 9, fill = 0 }, meths.win_text_height(1000, { start_row = 4, end_row = 38 }))
+ eq({ all = 9, fill = 3 }, meths.win_text_height(1001, { start_row = 2, end_row = 33 }))
+ eq({ all = 9, fill = 0 }, meths.win_text_height(1000, { start_row = 5, end_row = 37 }))
+ eq({ all = 9, fill = 3 }, meths.win_text_height(1001, { start_row = 3, end_row = 32 }))
+ eq({ all = 9, fill = 0 }, meths.win_text_height(1000, { start_row = 17, end_row = 25 }))
+ eq({ all = 9, fill = 3 }, meths.win_text_height(1001, { start_row = 15, end_row = 20 }))
+ eq({ all = 7, fill = 0 }, meths.win_text_height(1000, { start_row = 18, end_row = 24 }))
+ eq({ all = 7, fill = 3 }, meths.win_text_height(1001, { start_row = 16, end_row = 19 }))
+ eq({ all = 6, fill = 5 }, meths.win_text_height(1000, { start_row = -1 }))
+ eq({ all = 5, fill = 5 }, meths.win_text_height(1000, { start_row = -1, start_vcol = X }))
+ eq({ all = 0, fill = 0 }, meths.win_text_height(1000, { start_row = -1, start_vcol = X, end_row = -1 }))
+ eq({ all = 0, fill = 0 }, meths.win_text_height(1000, { start_row = -1, start_vcol = X, end_row = -1, end_vcol = X }))
+ eq({ all = 1, fill = 0 }, meths.win_text_height(1000, { start_row = -1, start_vcol = 0, end_row = -1, end_vcol = X }))
+ eq({ all = 3, fill = 2 }, meths.win_text_height(1001, { end_row = 0 }))
+ eq({ all = 2, fill = 2 }, meths.win_text_height(1001, { end_row = 0, end_vcol = 0 }))
+ eq({ all = 2, fill = 2 }, meths.win_text_height(1001, { start_row = 0, end_row = 0, end_vcol = 0 }))
+ eq({ all = 0, fill = 0 }, meths.win_text_height(1001, { start_row = 0, start_vcol = 0, end_row = 0, end_vcol = 0 }))
+ eq({ all = 1, fill = 0 }, meths.win_text_height(1001, { start_row = 0, start_vcol = 0, end_row = 0, end_vcol = X }))
+ eq({ all = 11, fill = 5 }, meths.win_text_height(1001, { end_row = 18 }))
+ eq({ all = 9, fill = 3 }, meths.win_text_height(1001, { start_row = 0, start_vcol = 0, end_row = 18 }))
+ eq({ all = 10, fill = 5 }, meths.win_text_height(1001, { end_row = 18, end_vcol = 0 }))
+ eq({ all = 8, fill = 3 }, meths.win_text_height(1001, { start_row = 0, start_vcol = 0, end_row = 18, end_vcol = 0 }))
end)
it('with wrapped lines', function()
@@ -770,39 +770,42 @@ describe('API/win', function()
{1: 1 }^foobar-foobar-foobar-foobar-foobar-foobar|
|
]]}
- eq(21, meths.win_text_height(0, {}))
- eq(6, meths.win_text_height(0, { start_row = 0, end_row = 0 }))
- eq(7, meths.win_text_height(0, { start_row = 1, end_row = 1 }))
- eq(8, meths.win_text_height(0, { start_row = 2, end_row = 2 }))
- eq(1, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 41 }))
- eq(2, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 42 }))
- eq(2, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 86 }))
- eq(3, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 87 }))
- eq(6, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 266 }))
- eq(7, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 267 }))
- eq(7, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 311 }))
- eq(7, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 312 }))
- eq(7, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = X }))
- eq(7, meths.win_text_height(0, { start_row = 1, start_vcol = 40, end_row = 1, end_vcol = X }))
- eq(6, meths.win_text_height(0, { start_row = 1, start_vcol = 41, end_row = 1, end_vcol = X }))
- eq(6, meths.win_text_height(0, { start_row = 1, start_vcol = 85, end_row = 1, end_vcol = X }))
- eq(5, meths.win_text_height(0, { start_row = 1, start_vcol = 86, end_row = 1, end_vcol = X }))
- eq(2, meths.win_text_height(0, { start_row = 1, start_vcol = 265, end_row = 1, end_vcol = X }))
- eq(1, meths.win_text_height(0, { start_row = 1, start_vcol = 266, end_row = 1, end_vcol = X }))
- eq(1, meths.win_text_height(0, { start_row = 1, start_vcol = 310, end_row = 1, end_vcol = X }))
- eq(0, meths.win_text_height(0, { start_row = 1, start_vcol = 311, end_row = 1, end_vcol = X }))
- eq(18, meths.win_text_height(0, { start_row = 0, start_vcol = 131 }))
- eq(19, meths.win_text_height(0, { start_row = 0, start_vcol = 130 }))
- eq(20, meths.win_text_height(0, { end_row = 2, end_vcol = 311 }))
- eq(21, meths.win_text_height(0, { end_row = 2, end_vcol = 312 }))
- eq(17, meths.win_text_height(0, { start_row = 0, start_vcol = 131, end_row = 2, end_vcol = 311 }))
- eq(19, meths.win_text_height(0, { start_row = 0, start_vcol = 130, end_row = 2, end_vcol = 312 }))
- eq(16, meths.win_text_height(0, { start_row = 0, start_vcol = 221 }))
- eq(17, meths.win_text_height(0, { start_row = 0, start_vcol = 220 }))
- eq(14, meths.win_text_height(0, { end_row = 2, end_vcol = 41 }))
- eq(15, meths.win_text_height(0, { end_row = 2, end_vcol = 42 }))
- eq(9, meths.win_text_height(0, { start_row = 0, start_vcol = 221, end_row = 2, end_vcol = 41 }))
- eq(11, meths.win_text_height(0, { start_row = 0, start_vcol = 220, end_row = 2, end_vcol = 42 }))
+ eq({ all = 21, fill = 0 }, meths.win_text_height(0, {}))
+ eq({ all = 6, fill = 0 }, meths.win_text_height(0, { start_row = 0, end_row = 0 }))
+ eq({ all = 7, fill = 0 }, meths.win_text_height(0, { start_row = 1, end_row = 1 }))
+ eq({ all = 8, fill = 0 }, meths.win_text_height(0, { start_row = 2, end_row = 2 }))
+ eq({ all = 0, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 0 }))
+ eq({ all = 1, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 41 }))
+ eq({ all = 2, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 42 }))
+ eq({ all = 2, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 86 }))
+ eq({ all = 3, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 87 }))
+ eq({ all = 6, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 266 }))
+ eq({ all = 7, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 267 }))
+ eq({ all = 7, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 311 }))
+ eq({ all = 7, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = 312 }))
+ eq({ all = 7, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 0, end_row = 1, end_vcol = X }))
+ eq({ all = 7, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 40, end_row = 1, end_vcol = X }))
+ eq({ all = 6, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 41, end_row = 1, end_vcol = X }))
+ eq({ all = 6, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 85, end_row = 1, end_vcol = X }))
+ eq({ all = 5, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 86, end_row = 1, end_vcol = X }))
+ eq({ all = 2, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 265, end_row = 1, end_vcol = X }))
+ eq({ all = 1, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 266, end_row = 1, end_vcol = X }))
+ eq({ all = 1, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 310, end_row = 1, end_vcol = X }))
+ eq({ all = 0, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 311, end_row = 1, end_vcol = X }))
+ eq({ all = 1, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 86, end_row = 1, end_vcol = 131 }))
+ eq({ all = 1, fill = 0 }, meths.win_text_height(0, { start_row = 1, start_vcol = 221, end_row = 1, end_vcol = 266 }))
+ eq({ all = 18, fill = 0 }, meths.win_text_height(0, { start_row = 0, start_vcol = 131 }))
+ eq({ all = 19, fill = 0 }, meths.win_text_height(0, { start_row = 0, start_vcol = 130 }))
+ eq({ all = 20, fill = 0 }, meths.win_text_height(0, { end_row = 2, end_vcol = 311 }))
+ eq({ all = 21, fill = 0 }, meths.win_text_height(0, { end_row = 2, end_vcol = 312 }))
+ eq({ all = 17, fill = 0 }, meths.win_text_height(0, { start_row = 0, start_vcol = 131, end_row = 2, end_vcol = 311 }))
+ eq({ all = 19, fill = 0 }, meths.win_text_height(0, { start_row = 0, start_vcol = 130, end_row = 2, end_vcol = 312 }))
+ eq({ all = 16, fill = 0 }, meths.win_text_height(0, { start_row = 0, start_vcol = 221 }))
+ eq({ all = 17, fill = 0 }, meths.win_text_height(0, { start_row = 0, start_vcol = 220 }))
+ eq({ all = 14, fill = 0 }, meths.win_text_height(0, { end_row = 2, end_vcol = 41 }))
+ eq({ all = 15, fill = 0 }, meths.win_text_height(0, { end_row = 2, end_vcol = 42 }))
+ eq({ all = 9, fill = 0 }, meths.win_text_height(0, { start_row = 0, start_vcol = 221, end_row = 2, end_vcol = 41 }))
+ eq({ all = 11, fill = 0 }, meths.win_text_height(0, { start_row = 0, start_vcol = 220, end_row = 2, end_vcol = 42 }))
end)
end)
diff --git a/test/functional/core/fileio_spec.lua b/test/functional/core/fileio_spec.lua
index 4236a4ff47..8de78234ce 100644
--- a/test/functional/core/fileio_spec.lua
+++ b/test/functional/core/fileio_spec.lua
@@ -19,7 +19,6 @@ local meths = helpers.meths
local mkdir = helpers.mkdir
local sleep = helpers.sleep
local read_file = helpers.read_file
-local tmpname = helpers.tmpname
local trim = helpers.trim
local currentdir = helpers.funcs.getcwd
local assert_alive = helpers.assert_alive
@@ -46,6 +45,7 @@ describe('fileio', function()
os.remove('Xtest-overwrite-forced')
rmdir('Xtest_startup_swapdir')
rmdir('Xtest_backupdir')
+ rmdir('Xtest_backupdir with spaces')
end)
it('fsync() codepaths #8304', function()
@@ -133,6 +133,28 @@ describe('fileio', function()
eq('foo', foo_contents);
end)
+ it('backup with full path with spaces', function()
+ skip(is_ci('cirrus'))
+ clear()
+ mkdir('Xtest_backup with spaces')
+ command('set backup')
+ command('set backupdir=Xtest_backupdir\\ with\\ spaces//')
+ command('write Xtest_startup_file1')
+ feed('ifoo<esc>')
+ command('write')
+ feed('Abar<esc>')
+ command('write')
+
+ -- Backup filename = fullpath, separators replaced with "%".
+ local backup_file_name = string.gsub(currentdir()..'/Xtest_startup_file1',
+ is_os('win') and '[:/\\]' or '/', '%%') .. '~'
+ local foo_contents = trim(read_file('Xtest_backupdir with spaces/'..backup_file_name))
+ local foobar_contents = trim(read_file('Xtest_startup_file1'))
+
+ eq('foobar', foobar_contents);
+ eq('foo', foo_contents);
+ end)
+
it('backup symlinked files #11349', function()
skip(is_ci('cirrus'))
clear()
@@ -266,9 +288,7 @@ describe('tmpdir', function()
before_each(function()
-- Fake /tmp dir so that we can mess it up.
- os_tmpdir = tmpname()
- os.remove(os_tmpdir)
- mkdir(os_tmpdir)
+ os_tmpdir = vim.uv.fs_mkdtemp(vim.fs.dirname(helpers.tmpname()) .. '/nvim_XXXXXXXXXX')
end)
after_each(function()
diff --git a/test/functional/legacy/autocmd_option_spec.lua b/test/functional/legacy/autocmd_option_spec.lua
index 8f17f509f5..2d17439a78 100644
--- a/test/functional/legacy/autocmd_option_spec.lua
+++ b/test/functional/legacy/autocmd_option_spec.lua
@@ -542,13 +542,6 @@ describe('au OptionSet', function()
expected_combination({'cursorcolumn', 0, 0, 0, 1, 'global', 'set'})
end)
- it('with option value converted internally', function()
- command('noa set backspace=1')
- command('set backspace=2')
- expected_combination(({
- 'backspace', 'indent,eol', 'indent,eol', 'indent,eol', '2', 'global', 'set'
- }))
- end)
end)
describe('with specific option', function()
diff --git a/test/functional/lua/watch_spec.lua b/test/functional/lua/watch_spec.lua
index f041f4f1b6..ee31975063 100644
--- a/test/functional/lua/watch_spec.lua
+++ b/test/functional/lua/watch_spec.lua
@@ -3,7 +3,6 @@ local eq = helpers.eq
local exec_lua = helpers.exec_lua
local clear = helpers.clear
local is_os = helpers.is_os
-local mkdir = helpers.mkdir
describe('vim._watch', function()
before_each(function()
@@ -12,9 +11,7 @@ describe('vim._watch', function()
describe('watch', function()
it('detects file changes', function()
- local root_dir = helpers.tmpname()
- os.remove(root_dir)
- mkdir(root_dir)
+ local root_dir = vim.uv.fs_mkdtemp(vim.fs.dirname(helpers.tmpname()) .. '/nvim_XXXXXXXXXX')
local result = exec_lua(
[[
@@ -100,9 +97,7 @@ describe('vim._watch', function()
describe('poll', function()
it('detects file changes', function()
- local root_dir = helpers.tmpname()
- os.remove(root_dir)
- mkdir(root_dir)
+ local root_dir = vim.uv.fs_mkdtemp(vim.fs.dirname(helpers.tmpname()) .. '/nvim_XXXXXXXXXX')
local result = exec_lua(
[[
diff --git a/test/functional/plugin/lsp/utils_spec.lua b/test/functional/plugin/lsp/utils_spec.lua
index 3e53b6d574..c91fffa90f 100644
--- a/test/functional/plugin/lsp/utils_spec.lua
+++ b/test/functional/plugin/lsp/utils_spec.lua
@@ -34,6 +34,19 @@ describe('vim.lsp.util', function()
eq(expected, stylize_markdown(lines, opts))
end)
+ it('code fences with whitespace surrounded info string', function()
+ local lines = {
+ "``` lua ",
+ "local hello = 'world'",
+ "```",
+ }
+ local expected = {
+ "local hello = 'world'",
+ }
+ local opts = {}
+ eq(expected, stylize_markdown(lines, opts))
+ end)
+
it('adds separator after code block', function()
local lines = {
"```lua",
diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua
index 38176c8749..9a777e2742 100644
--- a/test/functional/plugin/lsp_spec.lua
+++ b/test/functional/plugin/lsp_spec.lua
@@ -82,7 +82,7 @@ describe('LSP', function()
describe('server_name specified', function()
it('start_client(), stop_client()', function()
retry(nil, 4000, function()
- eq(1, exec_lua('return #lsp.get_active_clients()'))
+ eq(1, exec_lua('return #lsp.get_clients()'))
end)
eq(2, exec_lua([[
TEST_CLIENT2 = test__start_client()
@@ -93,20 +93,20 @@ describe('LSP', function()
return TEST_CLIENT3
]]))
retry(nil, 4000, function()
- eq(3, exec_lua('return #lsp.get_active_clients()'))
+ eq(3, exec_lua('return #lsp.get_clients()'))
end)
eq(false, exec_lua('return lsp.get_client_by_id(TEST_CLIENT1) == nil'))
eq(false, exec_lua('return lsp.get_client_by_id(TEST_CLIENT1).is_stopped()'))
exec_lua('return lsp.get_client_by_id(TEST_CLIENT1).stop()')
retry(nil, 4000, function()
- eq(2, exec_lua('return #lsp.get_active_clients()'))
+ eq(2, exec_lua('return #lsp.get_clients()'))
end)
eq(true, exec_lua('return lsp.get_client_by_id(TEST_CLIENT1) == nil'))
exec_lua('lsp.stop_client({TEST_CLIENT2, TEST_CLIENT3})')
retry(nil, 4000, function()
- eq(0, exec_lua('return #lsp.get_active_clients()'))
+ eq(0, exec_lua('return #lsp.get_clients()'))
end)
end)
@@ -116,12 +116,12 @@ describe('LSP', function()
TEST_CLIENT3 = test__start_client()
]])
retry(nil, 4000, function()
- eq(3, exec_lua('return #lsp.get_active_clients()'))
+ eq(3, exec_lua('return #lsp.get_clients()'))
end)
-- Stop all clients.
- exec_lua('lsp.stop_client(lsp.get_active_clients())')
+ exec_lua('lsp.stop_client(lsp.get_clients())')
retry(nil, 4000, function()
- eq(0, exec_lua('return #lsp.get_active_clients()'))
+ eq(0, exec_lua('return #lsp.get_clients()'))
end)
end)
end)
@@ -151,7 +151,7 @@ describe('LSP', function()
describe('basic_init test', function()
after_each(function()
stop()
- exec_lua("lsp.stop_client(lsp.get_active_clients(), true)")
+ exec_lua("lsp.stop_client(lsp.get_clients(), true)")
exec_lua("vim.api.nvim_exec_autocmds('VimLeavePre', { modeline = false })")
end)
diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua
index bd898ba99e..8b43f5cf9c 100644
--- a/test/functional/terminal/buffer_spec.lua
+++ b/test/functional/terminal/buffer_spec.lua
@@ -431,6 +431,30 @@ it('terminal truncates number of composing characters to 5', function()
retry(nil, nil, function() eq('a' .. composing:rep(5), meths.get_current_line()) end)
end)
+describe('terminal input', function()
+ before_each(function()
+ clear()
+ exec_lua([[
+ _G.input_data = ''
+ vim.api.nvim_open_term(0, { on_input = function(_, _, _, data)
+ _G.input_data = _G.input_data .. data
+ end })
+ ]])
+ command('startinsert')
+ poke_eventloop()
+ end)
+
+ it('<C-Space> is sent as NUL byte', function()
+ feed('aaa<C-Space>bbb')
+ eq('aaa\0bbb', exec_lua([[return _G.input_data]]))
+ end)
+
+ it('unknown special keys are not sent', function()
+ feed('aaa<Help>bbb')
+ eq('aaabbb', exec_lua([[return _G.input_data]]))
+ end)
+end)
+
if is_os('win') then
describe(':terminal in Windows', function()
local screen
diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua
index 23b200bd24..dc4aeb9c83 100644
--- a/test/functional/ui/inccommand_spec.lua
+++ b/test/functional/ui/inccommand_spec.lua
@@ -3086,8 +3086,7 @@ end)
it('long :%s/ with inccommand does not collapse cmdline', function()
clear()
local screen = Screen.new(10,5)
- common_setup(screen)
- command('set inccommand=nosplit')
+ common_setup(screen, 'nosplit')
feed(':%s/AAAAAAA', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A',
'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A')
screen:expect([[
@@ -3099,6 +3098,21 @@ it('long :%s/ with inccommand does not collapse cmdline', function()
]])
end)
+it("with 'inccommand' typing invalid `={expr}` does not show error", function()
+ clear()
+ local screen = Screen.new(30, 6)
+ common_setup(screen, 'nosplit')
+ feed(':edit `=`')
+ screen:expect([[
+ |
+ {15:~ }|
+ {15:~ }|
+ {15:~ }|
+ {15:~ }|
+ :edit `=`^ |
+ ]])
+end)
+
it("with 'inccommand' typing :filter doesn't segfault or leak memory #19057", function()
clear()
common_setup(nil, 'nosplit')
diff --git a/test/old/testdir/test_backspace_opt.vim b/test/old/testdir/test_backspace_opt.vim
index 59e94d2898..78c51cb874 100644
--- a/test/old/testdir/test_backspace_opt.vim
+++ b/test/old/testdir/test_backspace_opt.vim
@@ -36,15 +36,15 @@ func Test_backspace_option()
" NOTE: Vim doesn't check following error...
"call assert_fails('set backspace-=ghi', 'E474:')
- " Check backwards compatibility with version 5.4 and earlier
- set backspace=0
- call assert_equal('0', &backspace)
- set backspace=1
- call assert_equal('1', &backspace)
- set backspace=2
- call assert_equal('2', &backspace)
- set backspace=3
- call assert_equal('3', &backspace)
+ " " Check backwards compatibility with version 5.4 and earlier
+ " set backspace=0
+ " call assert_equal('0', &backspace)
+ " set backspace=1
+ " call assert_equal('1', &backspace)
+ " set backspace=2
+ " call assert_equal('2', &backspace)
+ " set backspace=3
+ " call assert_equal('3', &backspace)
call assert_fails('set backspace=4', 'E474:')
call assert_fails('set backspace=10', 'E474:')
diff --git a/test/old/testdir/test_options.vim b/test/old/testdir/test_options.vim
index 6390b9c37a..aabb11a76a 100644
--- a/test/old/testdir/test_options.vim
+++ b/test/old/testdir/test_options.vim
@@ -22,20 +22,20 @@ func Test_whichwrap()
set whichwrap=h,h,h
call assert_equal('h', &whichwrap)
- " For compatibility with Vim 3.0 and before, number values are also
- " supported for 'whichwrap'
- set whichwrap=1
- call assert_equal('b', &whichwrap)
- set whichwrap=2
- call assert_equal('s', &whichwrap)
- set whichwrap=4
- call assert_equal('h,l', &whichwrap)
- set whichwrap=8
- call assert_equal('<,>', &whichwrap)
- set whichwrap=16
- call assert_equal('[,]', &whichwrap)
- set whichwrap=31
- call assert_equal('b,s,h,l,<,>,[,]', &whichwrap)
+ " " For compatibility with Vim 3.0 and before, number values are also
+ " " supported for 'whichwrap'
+ " set whichwrap=1
+ " call assert_equal('b', &whichwrap)
+ " set whichwrap=2
+ " call assert_equal('s', &whichwrap)
+ " set whichwrap=4
+ " call assert_equal('h,l', &whichwrap)
+ " set whichwrap=8
+ " call assert_equal('<,>', &whichwrap)
+ " set whichwrap=16
+ " call assert_equal('[,]', &whichwrap)
+ " set whichwrap=31
+ " call assert_equal('b,s,h,l,<,>,[,]', &whichwrap)
set whichwrap&
endfunc