Problem: "verbose set efm" reports the location of the :compiler command.
(Gary Johnson)
Solution: Add the "-keepscript" argument to :command and use it when
defining CompilerSet.
58ef8a31d7
This includes a partial port of Vim patch 8.2.2569 and some changes to
nvim_eval_statusline() to allow a multibyte fillchar. Literally every
line of C code touched by that patch has been refactored in Nvim, and
that patch contains some irrelevant foldcolumn tests I'm not sure how to
port (as Nvim's foldcolumn behavior has diverged from Vim's).
Behavioral changes:
1. Added support for lua function in keymaps in
--------------------------------------------
- nvim_set_keymap
Can set lua function as keymap rhs like following:
```lua
vim.api.nvim_{buf_}set_keymap('n', '<leader>lr', '', {callback = vim.lsp.buf.references})
```
Note: lua function can only be set from lua . If api function being
called from viml or over rpc this option isn't available.
- nvim_{buf_}get_keymap
When called from lua, lua function is returned is `callback` key .
But in other cases callback contains number of the function ref.
- :umap, nvim_del_keymap & nvim_buf_del_keymap clears lua keymaps correctly.
- :map commands for displaing rhs .
For lua keymaps rhs is displayed as <Lua function ref_no>
Note: lua keymap cannot be set through viml command / functions.
- mapargs()
When dict is false it returns string in `<Lua function ref_no>`
format (same format as :map commands).
When dict is true it returns ref_no number in `callback` key.
- mapcheck()
returns string in `<Lua function ref_no>` format (same format as :map commands).
2. Added support for keymap description
---------------------------------------
- nvim_{buf_}set_keymap: added `desc` option in opts table .
```lua
vim.api.nvim_set_keymap('n', '<leader>w', '<cmd>w<cr>', {desc='Save current file'})
```
- nvim_{buf_}get_keymap: contains `desc` in returned list.
- commands like `:nmap <leader>w` will show description in a new line below rhs.
- `maparg()` return dict contains `desc`.
nvim_buf_get_extmark uses "end_row" rather than "end_line" in its
'details' dict, which means callers must modify the key names if they
want to re-use the information. Change the parameter name in
nvim_buf_set_extmark to "end_row" and use "end_line" as an alias
to make this more consistent.
This is already skipped in all CI environments, so it should also be
skipped in environments that don't like fragile tests. Since there's no
convenient way to express these concisely, add the explicit fragile
skip.
"works with &opt" is flaky; now it always fails after #15999 for some reason.
This test was skipped in #10773 due to previous flakiness, but after the switch away from appveyor
the check no longer works. Just skip for any CI running the MSVC_32 job.
For anonymous scripts, defer the creation of script items until an attempt to access a script-local
variable is made. This dramatically reduces the number of script items created when using lots of
vim.cmd and nvim_exec especially.
This will mean <SID> usage fails until a script-local variable access is first made.
Based on #13143 (and #11507) with changes:
- Omit script_type_E. Use sn_name == NULL to determine anon items.
- Keep SID_STR. Used by anon :source for .lua files (no item).
- Show SID in get_scriptname output (:verbose set).
- Factor item creation into new_script_item.
- Leave sc_seq = 0 (anon scripts don't re-use the same item when re-sourced).
- Add tests for anon :source.
Co-authored-by: Vikram Pal <vikrampal659@gmail.com>
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
Adds the following API functions.
- nvim_buf_set_mark(buf, name, line, col)
* Set marks in a buffer.
- nvim_buf_del_mark(buf, name)
* Delete a mark that belongs to buffer.
- nvim_del_mark(name)
* Delete a global mark.
- nvim_get_mark(name)
* Get a global mark.
Tests:
- Adds test to all the new api functions, and adds more for the existing
nvim_buf_get_mark.
* Tests include failure cases.
Documentation:
- Adds documentation for all the new functions, and improves the
existing fucntion docs.
Do not copy a lot of lua strings (dict keys) to just strequal() them
Just compare them directly to a dedicated hash function.
feat(generators): HASHY McHASHFACE
Problem:
This crashes Nvim:
tabedit
call nvim_win_set_option(1000, 'statusline', 'status')
split
wincmd J
wincmd j
Solution:
- Change `no_display` parameter value to be the same as in matching
`restore_win_noblock` call. In case of different values `topframe`
isn't restored to `curtab->tp_topframe`.
- Call `restore_win_noblock` if `switch_win_noblock` returns `FAIL`
(`switch_win` must always have matching `restore_win`)
- Change `switch_win`/`restore_win` to `_noblock` versions to allow
autocommands.
fixes#14097fixes#13577
It was not possible to run the tests under the gdbserver because we were
not closing the old session before starting a new one. This caused the
server to not to be able to bind to the given address and crashing the
tests.
This commit closes the session before starting a new one.
Signed-off-by: Shreyansh Chouhan <chouhan.shreyansh2702@gmail.com>
Now remove the addition of "start/*" packages in 'packpath' as
explicit items in 'runtimepath'. This avoids 'runtimepath' from becoming
very long when using a lot of plugins as packages.
To get the effective search path as a list, use |nvim_list_runtime_paths()|
Problem:
Anonymous :source (no args) and nvim_exec() don't support Vimscript line continuations.
Solution:
Factor out the concat logic into concat_continued_line() and a
CONCAT_CONTINUED_LINES macro for simple concatenations where lines are
fetched individually.
Closes#14807
Problem: No error when using :complete for :command without -nargs.
Solution: Give an error. (Martin Tournoij, closesvim/vim#8544, closesvim/vim#8541)
de69a7353e
N/A patches for version.c:
vim-patch:8.1.1801: cannot build without the +eval feature
Problem: Cannot build without the +eval feature.
Solution: Always define funcexe_T.
505e43a20e
vim-patch:8.1.1818: unused variable
Problem: Unused variable.
Solution: Remove the variable. (Mike Williams)
b4a88a0441
vim-patch:8.2.1464: Vim9: build warning for unused variable
Problem: Vim9: build warning for unused variable.
Solution: Delete the variable declaration.
829ac868b7
vim-patch:8.2.2639: build failure when fsync() is not available
Problem: Build failure when fsync() is not available.
Solution: Add #ifdef.
5ea79a2599
vim-patch:8.2.2814: Vim9: unused variable
Problem: Vim9: unused variable. (John Marriott)
Solution: Adjust #ifdef.
b06b50dfa0
vim-patch:8.2.2947: build failure without the channel feature
Problem: Build failure without the channel feature.
Solution: Add back #ifdef. (John Marriott)
f5bfa8faa7
vim-patch:8.2.2976: build failure without the +eval feature
Problem: Build failure without the +eval feature.
Solution: Add #ifdefs.
8de901e1f1
vim-patch:8.2.2986: build failure without the profile feature
Problem: Build failure without the profile feature.
Solution: Add #ifdef.
d9f31c13d2
vim-patch:8.2.3114: Amiga-like systems: build error using stat()
Problem: Amiga-like systems: build error using stat().
Solution: Only build swapfile_process_running() on systems where it is
actually used. (Ola Söder, closesvim/vim#8519)
599a6e5b36
This option, when set, stops nvim_open_win() from potentially firing
buffer-related autocmd events
(BufEnter, BufLeave and BufWinEnter in the case of nvim_open_win()).
Iterating over PARAM_COUNT is wrong as PARAM_COUNT also counts the last
element of the options array, which has a NULL fullname in order to
signal the end of the array.
removing pending virtcol tests
Allow passing in empty array as a shorthand for array with empty string; add more documentation
add check for start_row as well
fix double free because intermediary lines weren't xmemdup'd.
NL-for-NUL dance.
Normalize row indices and perform more validation.
Adjust the cursor position if it's on the right side of the replacement.
Tests and documentation.
- The previous commit lost information in the tests. Instead, add some
more "normalization" substitutions in pcall_err(), so that the general
shape of the stacktrace is included in the asserted text.
- Eliminate contains(), it is redundant with matches()
54ce101 changed the way undo entries are created when adding decorations.
This creates all sorts of problems.This change fixes the problem by
reverting to the previous behavior.
Add new "splice" interface for tracking buffer changes at the byte
level. This will later be reused for byte-resolution buffer updates.
(Implementation has been started, but using undocumented "_on_bytes"
option now as interface hasn't been finalized).
Use this interface to improve many edge cases of extmark adjustment.
Changed tests indicate previously incorrect behavior. Adding tests for
more edge cases will be follow-up work (overlaps on_bytes tests)
Don't consider creation/deletion of marks an undoable event by itself.
This behavior was never documented, and imposes complexity for little gain.
Add nvim__buf_add_decoration temporary API for direct access to the new
implementation. This should be refactored into a proper API for
decorations, probably involving a huge dict.
fixes#11598
Problem: When Normal highlight group defines ctermfg/bg, but other
highlight group lacks ctermfg/bg, nvim_get_hl_by_id(hl_id,
v:false) returns -1 for the missing ctermfg/bg instead of just
omitting it.
Solution: checking for -1 in hlattrs2dict()
fix#11680
- We already find ourselves renaming nvim_execute_lua in tests and
scripts, which suggests "exec" is the verb we actually want.
- Add "exec" verb to `:help dev-api`.
This covers all "small" inserts and deletes in insert mode, as well
as a few more cases like small normal mode deletes
vim-patch:8.1.0678: text properties as not adjusted for inserted text
It is perfectly fine and expected to detach from the screen just by
the UI disconnecting from nvim or exiting nvim. Just keep detach() in
screen_basic_spec, to get some coverage of the detach method itself.
This avoids hang on failure in many situations (though one could argue
that detach() should be "fast", or at least "as fast as resize",
which works in press-return already).
Never use detach() just to change the size of the screen, try_resize()
method exists for that specifically.
Before this, --embed UIs (without --headless) would not trigger UIEnter.
For TUI, maybe UIEnter isn't useful, but:
- It is less "surprising"/special.
- Makes documentation simpler.
- When TUI becomes a coprocess, it will happen anyway.
- Rename `meth_pcall`.
- Make `pcall_err` raise an error if the function does not fail.
- Add `vim.pesc()` to treat a string as literal where a Lua pattern is
expected.
- Always load files when cleaning up jumplist.
- For Shada: avoids writing duplicate entries, which happens when you read
from a shada file with duplicate entries (merging the jumplist while
writing sometimes produces duplicate entries, bug?) and then write right
away (i.e.: without any `:jumps`, `getjumplist()`, or any jump movement,
that is: nothing that calls `cleanup_jumplist` with `loadfiles == true`).
- For Context: avoids non-idempotent behavior for the same reason (i.e.:
first call to `shada_encode_jumps` does not remove duplicate entries).
- Do not set pcmark when dumping jumplist for Context.
- Retrieving current Context shouldn't add an entry to the jumplist
(which will be removed by a subsequent `cleanup_jumplist` anyway, i.e.:
tail entry matching current position), just act like `getjumplist` for
instance.
luassert uses 3 by default, which is often not enough.
Instead of documenting how to increase it, let's use a more fitting
(sane) default of 100 levels.
NB: the `!(flags & SOPT_GLOBAL)` exception is for 'statusline'.
Because `:set statusline=...` sets the global value for _all_ windows,
`:setlocal` is the best we can do there. This is a one-of-a-kind option
that doesn't work like any other option.
- All "chunks" in a paste-stream should form a single undo-block. Side
effect of 7a85792884 was to create an undo-block for each chunk.
- Also: remove old :redraw force logic, irrelevant after 7a85792884.
- Introduce TRY_WRAP() until we have an *architectural* solution.
- TODO: bfredl idea: prepare error-handling at "top level" (nv_event).
- nvim_paste(): Revert luaeval() hack (see parent commit).
- With TRY_WRAP() in nvim_put(), 'nomodifiable' error now correctly
"bubbles up".
- nvim_paste(): Marshal through luaeval() instead of nvim_execute_lua()
because the latter seems to hide some errors.
- Handle 'nomodifiable' in `nvim_put()` explicitly.
- Require explicit `false` from `vim.paste()` in order to "cancel",
otherwise assume true ("continue").
- Show error only once per "paste stream".
- Drain remaining chunks until phase=3.
- Lay groundwork for "cancel".
- Constrain semantics of "cancel" to mean "client must stop"; it is
unrelated to presence of error(s).
Fixes strange behavior where sometimes the buffer contents of a series
of paste chunks (vim._paste) would be out-of-order.
Now the tui_spec.lua screen-tests are much more reliable. But they still
sometimes fail because of off-by-one cursor (caused by "typeahead race"
resulting in wrong mode; fixed later in this patch-series).