`vim.lsp.buf.format()` silently did nothing if no servers supported
`textDocument/rangeFormatting` when formatting with a range.
Issue found by `@hwrd:matrix.org` in the Matrix chat.
In most places where one_window() or last_window() is called, aucmd_win
has already been checked, so there is no need to check for it again.
The only place where this isn't checked is when using `:wincmd T`.
Before this PR using `:wincmd T` in an aucmd_win will give a warning
when there is only one non-floating window, but E813 error if there are
multiple. Now it consistently gives E813 error.
Problem: Code is indented more than necessary.
Solution: Use an early return where it makes sense. (Yegappan Lakshmanan,
closesvim/vim#11858)
6ec6666047
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
The files generated by test/includes/CMakeLists.txt have been unused
since commit c49e22d396. The unittests include the headers in
test/includes directly without any processing, meaning that the
CMakeLists.txt file is no longer necessary.
In Windows 8.1 and later, GetVersionEx does not automatically give the
correct information if a manifest file doesn't explicitly mention we
support that version. This will enable further detection for Windows 8.1
and Windows 10/11 when using windowsversion(), with an easy way to add
future versions. A list of all operating system versions can be found
here:
https://learn.microsoft.com/en-us/windows/win32/sysinfo/operating-system-version
Problem:
The "force" flag of win_close() complicates the code and adds edge cases
where it is not clear what the correct behavior should be.
The "free_buf" flag of win_close() is passed on to float windows when
closing the last window of a tabpage, which doesn't make much sense.
Solution:
Remove the "force" flag and always close float windows as if :close! is
used when closing the last window of a tabpage, and set the "free_buf"
flag for a float window based on whether its buffer can be freed.
As 'hidden' is on by default, this change shouldn't affect many people.
Test using the following test script (timings with ASAN):
let start = reltime()
for i in range(100)
call getcompletion('', 'filetype')
endfor
echomsg reltimefloat(reltime(start))
Without this PR: 3.251825 seconds
With this PR: 2.747285 seconds
Problem:
Build is not reproducible, because generated source files (.c/.h/) are not
deterministic, mostly because Lua pairs() is unordered by design (for security).
https://github.com/LuaJIT/LuaJIT/issues/626#issuecomment-707005671https://www.lua.org/manual/5.1/manual.html#pdf-next
> The order in which the indices are enumerated is not specified [...]
>
>> The hardening of the VM deliberately randomizes string hashes. This in
>> turn randomizes the iteration order of tables with string keys.
Solution:
- Update the code generation scripts to be deterministic.
- That is only a partial solution: the exported function
(funcs_metadata.generated.h) and ui event
(ui_events_metadata.generated.h) metadata have some mpack'ed
tables, which are not serialized deterministically.
- As a workaround, introduce `PRG_GEN_LUA` cmake setting, so you can
inject a modified build of luajit (with LUAJIT_SECURITY_PRN=0)
that preserves table order.
- Longer-term we should change the mpack'ed data structure so it no
longer uses tables keyed by strings.
Closes#20124
Co-Authored-By: dundargoc <gocdundar@gmail.com>
Co-Authored-By: Arnout Engelen <arnout@bzzt.net>
Problem: When a folded line has virtual lines attached, the following
problems occur:
- The virtual lines are drawn empty.
- The 'foldtext' line is drawn empty.
- The cursor is drawn incorrectly.
Solution: Check whether virtual lines belong to a folded line.
Fix#17027Fix#19557Fix#21837
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Problem: search() loops forever if "skip" is TRUE for all matches.
Solution: Keep the position of the first match.
3d79f0a430
Co-authored-by: Bram Moolenaar <Bram@vim.org>
According to the specification `workspace/applyEdit` must be called with
`ApplyWorkspaceEditParams`.
So far the client just returned, which could lead to a misleading error
on the server side because `workspace/applyEdit` must respond with a
`ApplyWorkspaceEditResult`.
This adds an assertion to clarify that the server is violating the
specification.
See https://github.com/neovim/neovim/issues/21925
It's simpler to let cmake figure out what flags to add to each platforms
to create position independent code rather than handling it ourselves.
Also remove code that sets POSITION_INDEPENDENT_CODE property on SHARED
and MODULE libraries, as it's already on by default.
Problem: Reading past the end of a line when formatting text.
Solution: Check for not going over the end of the line.
11977f9175
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Some tests fail when run under valgrind.
Solution: Increase timeouts.
353c351bd2
Cherry-pick Test_pum_with_preview_win() from patch 8.2.0011.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
A blob is used as a sequence of bytes and usually accessed individually,
not as as a NUL-terminuated string, so uint8_t should be better.
Not sure about ga_append(), but using uint8_t leads to fewer casts.
* build: various cmake refactors and simplifications
- Add STATUS keyword to message to ensure messages are shown in the
correct order.
- Remove DEPS_CXX_COMPILER as we don't rely on C++ for any of our
dependencies.
- Simplify how msgpack and luv configure options are constructed.
- Rely on the default installation for luv instead of manually passing
configure, build and install commands.
- Simplify return code conditional.
* build: remove CMAKE_OSX_ARCHITECTURES_ALT_SEP workaround
CMAKE_OSX_ARCHITECTURES_ALT_SEP was defined as a workaround to prevent
the shell from interpreting `;`, which CMake uses as a list separator.
However, the same thing can be achieved by instead passing
CMAKE_OSX_ARCHITECTURES as a cache variable instead, which is a more
idiomatic way of achieving the same thing.
* build: define CMAKE_BUILD_TYPE before adding it to BUILD_TYPE_STRING
The problem with the current setup is that CMAKE_BUILD_TYPE is defined
after BUILD_TYPE_STRING. BUILD_TYPE_STRING will then be empty on the
first run, meaning that dependencies are built without a build type.
However, since CMAKE_BUILD_TYPE is a cache variable its value will
persist in subsequent runs. On the second run BUILD_TYPE_STRING will
have the correct value, but it's a different value from the ones the
dependencies were built with. This will force some dependencies to be
built again.
Fixes https://github.com/neovim/neovim/issues/21672.
Problem: 'breakindent' does not indent non-lists with
"breakindentopt=list:-1".
Solution: Adjust indent computation. (Maxim Kim, closesvim/vim#11038)
119167265e
Co-authored-by: Maxim Kim <habamax@gmail.com>
Problem: 'statuscolumn' click definitions are cleared, evaluated,
allocated and filled each redraw for every row in a window.
This despite the fact that we only store a single click
definition array for the entire column as opposed to one
for each row.
Solution: Only fill the 'statuscolumn' click definition array once per
window per redraw.
Resolve https://github.com/neovim/neovim/issues/21767.
Unittests rely on nvim-test and not nvim, leading to both nvim and
nvim-test being compiled each time a file is changed. Furthermore, the
dependencies are already specified by CMakeLists.txt and shouldn't need
to be specified in Makefile as it's only meant to be syntactic sugar.
Workflow presets allows combining configure, build, test and packaging
steps and makes it possible to run everything in a single command. So
cmake --preset iwyu
cmake --build --preset iwyu
instead becomes
cmake --workflow --preset iwyu
Workflow presets requires at least cmake version 3.25 to use.
Problem: Command line completion popup menu positioned wrong when using a
terminal window.
Solution: Position the popup menu differently when editing the command line.
(Yegappan Lakshmanan, closesvim/vim#10050, closesvim/vim#10035)
1104a6d0c2
The test in the patch looks a bit hard to understand.
Add a Lua test that is more straightforward.
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>