docs(reg_recorded): add links to relevant docs
docs(Recording): update docs to match implementation
docs(Q) update references of Q to be gQ
docs(autocmd) add description about state of reg_record{ing,ed} for RecordingLeave
docs(vim_diff) add Recording{Enter,Leave} to features
docs(index) removed duplicate gQ
docs(options) removed line about gQ erroring in visual mode
Update runtime/doc/vim_diff.txt
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
docs(vim_diff) removed double mention of Q
feat(eval): add reg_recorded()
This function is used the get the last recorded register.
style(Recording): rename handler to match suggestions
fix(RecordingLeave): send autocommand earlier
This makes the autocommand fire just before setting reg_recorded to
reg_recording, this way we clearly show that we are actually just before
actually quitting the recording mode.
Line number and column are required and much of the diagnostic API
assumes that these are both present. When one of the two is missing,
cryptic errors pop up in other parts of the diagnostic subsystem.
Instead, assert that diagnostics are well formed when they are entered
into the cache, which provides a clearer error.
The Lua modules that make up vim.lua are embedded as raw source files into the
nvim binary. These sources are loaded by the Lua runtime on startuptime. We can
pre-compile these sources into Lua bytecode before embedding them into the
binary, which minimizes the size of the binary and improves startuptime.
* str_utf_start/end both cast the offset into the utf string
to a char_u, a pointer + long is well-defined and the cast is
unnecessary. This previously resulted in issues for offsets greater than
256.
refresh_scrollback assumes pending scrollback rows exist only if the
terminal window height decreased (or the screen was full).
However, after accumulating scrollback, it's possible in some cases for
the terminal height to increase before refresh_scrollback is called via
invalidation (especially when the terminal buffer isn't initially
displayed in a window before nvim_open_term), which may crash.
As we'll have enough room for some scrollback rows, just append them to
the top of the buffer until it fills the window, then continue with the
previous logic for any remaining scrollback rows if necessary.
When buffer is visible in two splits simultaneously, BufHidden event is
not triggered, causing the floating window to remain on screen after
switching to another buffer.
Remove BufHidden event from close_events defaults, and close the window
if we changed the buffer to something other than the buffer that spawned
the floating window or the floating window buffer itself.
When filling a quickfix/loclist from a string-typed VimL variable, the
complexity is O(N^2) in the number of lines in the variable.
The problem is caused by using `xstrlcpy(3)` to copy the characters from
the current position up to the next newline into the quickfix/loclist
buffer in a loop.
strlcpy(3) returns the length of `src`, so by necessity it has to
compute `strlen(src)`. This means scanning the full rest of the typval
on every iteration while only copying a small fraction (up to the next
'\n').
This is not a problem whenever the srclen-to-copylen ratio is close to
1, which it usually is. But not in this case. Since we already
calculated exactly how many bytes we want to copy, we should be using
memcpy(3).
This problem is not present in Vim, as it uses `vim_strncpy`, a
`strncpy(3)`-alike, which stops at either `\0` or `n`, whichever comes
first.
The quickfix/loclist window can be filled using a:
1. File (used by commands like :grep/:make/... to source directly
from their errorfile)
2. Buffer (used by :cbuffer and its variants)
3. Typval
a. String (used by :cexpr and its variants)
b. List of strings (used by setqflist(), setloclist(), :cepxr and its
variants)
This commit optimizes case (3a), especially when the typval is a long
string.
The pathological path is triggered by (e.g.) :grep enhancements as found
in https://gist.github.com/romainl/56f0c28ef953ffc157f36cc495947ab3:
function! Grep(...)
return system(join([&grepprg] + a:000), ' '))
endfunction
:cgetexpr Grep('foo')
It would've been better for Neovim to use `systemlist` here, before this
commit.
Based on https://github.com/neovim/neovim/pull/14445
This extends `vim.treesitter.query.get_node_text` to return the text
that spans a node's range even if start_row ~= end_row.
Calling vim.lsp.buf.definition() sometimes gives a deprecation warning.
This will likely solve that.
Co-authored-by: Christian Clason <christian.clason@uni-due.de>