Problem: Typos in tests; one lua line not covered by test.
Solution: Fix typos. Add test case. (Dominique Pellé, closesvim/vim#9994)
81b573d7e5
Cherry-pick test_menu.vim change from patch 9.0.1453.
N/A patch:
vim-patch:8.2.3045: minor typos
Co-authored-by: Dominique Pelle <dominique.pelle@gmail.com>
Problem: Autocmd test is a bit flaky on MS-Windows.
Solution: Add a bit more sleeping. (Ken Takata, closesvim/vim#11095)
ae04a6049b
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: On MS-Windows some tests are flaky.
Solution: Add sleeps, disable swapfile, mark test as flaky. (Ken Takata,
closesvim/vim#11082)
0500e87eba
Co-authored-by: K.Takata <kentkt@csc.jp>
Problem: Using separate delete() call instead of writefile() 'D' flag.
Solution: Use the writefile 'D' flag.
3411265a36
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Deleting files in tests is a hassle.
Solution: Use the new 'D' flag of writefile().
e1f3ab73bc
vim-patch:e1f3ab73bc7c
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: "for" and "while" not recognized after :vim9cmd and :legacy.
(Emanuele Torre)
Solution: Recognize all the command modifiers. (closesvim/vim#11087)
Add a test to check the list of modifiers.
9132426334
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Using common name in tests leads to flaky tests.
Solution: Rename files and directories to be more specific.
e7cda97b6b
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: When switching window in autocmd the restored cursor position may
be wrong.
Solution: Do not restore the cursor if it was not set. (closesvim/vim#10775)
b03950fafa
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Window title test still fails in some configurations.
Solution: Explicitly set the 'title' option.
1450112eef
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Window title test fails in some configurations.
Solution: Only run the test if the title can be obtained.
a6c09a7c20
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Using setbufvar() may change the window title.
Solution: Do not redraw when creating the autocommand window. (closesvim/vim#9613)
dff97e65eb
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: CTRL-A does not work properly with the cmdline popup menu.
Solution: Fix issues with CTRL-A. Add more tests for the cmdline popup
menu. Remove TermWait() before VeriryScreenDump(). Refactor the
cmdline popup code. (Yegappan Lakshmanan, closesvim/vim#9735)
560dff49c0
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: Test_xrestore sometimes fails.
Solution: Mark the test as flayky. Move marking test as flaky to the test
instead of listing them in runtest.
f08b0eb869
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Test for cmdline window and terminal fails on MS-Windows.
Solution: Skip the test on MS-Windows.
0b49648486
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Crash when using a terminal popup window from the cmdline window.
Solution: Instead of checking cmdwin_type call cmdwin_is_active().
(closesvim/vim#8286)
e5b4486c42
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Tests using term_wait() can still be flaky.
Solution: Increase the wait time when rerunning a test. (James McCoy,
closesvim/vim#5899) Halve the initial times to make tests run faster
when there is no rerun.
6a2c5a7dd5
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Some tests fail when the system is slow.
Solution: Make the run number global, use in the test to increase the
waiting time. (closesvim/vim#5841)
3ed9efc2b1
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Autocmd test fails on a slow system.
Solution: Adjust the expectations. (James McCoy, closesvim/vim#5685)
8fb1b47a5e
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Some tests fail when run in the GUI.
Solution: Make sure the window width is enough. In the GUI run terminal Vim
in the terminal, if possible.
3180fe6c6d
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: A couple of tests may fail when features are missing.
Solution: Check for features. (Dominique Pelle, closesvim/vim#5561)
705724e430
Just copy the two 'wincolor' test functions from Vim.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: state() test fails on some Mac systems.
Solution: Increase the wait time. (closesvim/vim#4983)
b7a97ef340
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Test for SafeStateAgain may still fail.
Solution: Send another message to trigger SafeStateAgain.
0f6629a08a
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Test for SafeState and SafeStateAgain may fail.
Solution: Accept more possible responses
513537bfff
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: No tests for SafeState and SafeStateAgain.
Solution: Add tests.
cadbe1b1fb
This test is quite useless. Don't port to Lua.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: No tests for state().
Solution: Add tests. Clean up some feature checks. Make "a" flag work.
c258549032
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Runtime: no support for bicep files
Solution: Add filetype support for bicepparam
closes: vim/vim#127842d0988ef93
Co-authored-by: Scott McKendry <scott.c.mckendry@gmail.com>
Problem: Runtime: Missing QML support
Solution: Add QML support to Vim
closes: vim/vim#12810bedc69f9d6
Co-authored-by: ChaseKnowlden <haroldknowlden@gmail.com>
Problem: Cursor is adjusted in window that did not change in size by
'splitkeep'.
Solution: Only check that cursor position is valid in a window that
has changed in size.
closes: vim/vim#1250916af913eee
Co-authored-by: Luuk van Baal <luukvbaal@gmail.com>
Problem: no support for custom cmdline completion
Solution: Add new vimscript functions
Add the following two functions:
- getcmdcompltype() returns custom and customlist functions
- getcompletion() supports both custom and customlist
closes: vim/vim#1222892997dda78
Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Problem: crash when passing invalid buffer to undotree()
Solution: Use get_buf_arg() instead of tv_get_buf_from_arg().
closes: vim/vim#12862closes: vim/vim#12830ab9f2ecfd4
Problem: Visual highlight not working with cursor at end of screen line
and 'showbreak'.
Solution: Only update "vcol_prev" when drawing buffer text.
closes: vim/vim#128658fc6a1dae0
Problem: can't move to last non-blank char
Solution: Make g<end> behave like that
Make it possible to move to last non-blank char on a line
We can distinguish between g0 and g^ to move to the very first character
and the first non-blank char.
And while we can move to the last screen char, we cannot go to the last
non-blank screen char.
Since I think g$ is the more widely used and known movement command (and
g<end> is synonymous to it) change the behaviour of g<end> to move to
last non-screen char instead and don't have this be the same command as
the g$ command anymore.
If you want to keep the old behaviour, you can use:
```
nnoremap g<end> g$
```
Add a test to verify the behaviour.
closes: vim/vim#12593b5f6fe9ca2
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: Missing test coverage for blockwise Visual highlight with
virtual that starts with a double-width char.
Solution: Add a new virtual text to the test. Some other small fixes.
closes: vim/vim#12835fc3058495d
Problem: Wrong curswant when clicking and the second cell of a
double-width char.
Solution: Don't copy virtcol of the first char to the second one.
closes: vim/vim#128429994160bfe
Problem: reverse() on string doesn't work in compiled function.
Solution: Accept string in argument type check. (Yegappan Lakshmanan,
closesvim/vim#12377)
f9dc278946
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: reverse() does not work for a String.
Solution: Implement reverse() for a String. (Yegappan Lakshmanan,
closesvim/vim#12179)
03ff1c2dde
vim-patch:9.0.1738: Duplicate code to reverse a string
Problem: Duplicate code to reverse a string
Solution: Move reverse_text() to strings.c and remove string_reverse().
closes: vim/vim#128474dd266cb66
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: Wrong cursor position when clicking after concealed text
with 'virtualedit'.
Solution: Store virtual columns in ScreenCols[] instead of text
columns, and always use coladvance() when clicking.
This also fixes incorrect curswant when clicking on a TAB, so now
Test_normal_click_on_ctrl_char() asserts the same results as the ones
before patch 9.0.0048.
closes: vim/vim#12808e500ae8e29
Remove the mouse_adjust_click() function.
There is a difference in behavior with the old mouse_adjust_click()
approach: when clicking on the character immediately after concealed
text that is completely hidden, cursor is put on the clicked character
rather than at the start of the concealed text. The new behavior is
better, but it causes unnecessary scrolling in a functional test (which
is an existing issue unrelated to these patches), so adjust the test.
Now fully merged:
vim-patch:9.0.0177: cursor position wrong with 'virtualedit' and mouse click
Problem: cursor position wrong when clicking on an unprintable char
Solution: Don't update prev_ptr when wlv.n_extra is not zero.
closes: vim/vim#12664b25dbb3f9b
Tests only. Code superseded by patch 9.0.1725.
Problem: Cursor in wrong column with mouse click after concealed text.
Solution: Store the text column when drawing text.
b90818867c
Tests only. Code changes moved to the port of patch 9.0.1725.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: blockwise Visual highlight not working with virtual text
Solution: Reset the correct variable at the end of virtual selection and
Check for double-width char inside virtual text.
closes: vim/vim#126066e940d9a1d
Need to remove area_active and use wlv.fromcol and wlv.tocol directly.
Problem: A double-width char in a floating window causes an extra
space to be drawn to the left of its boundary.
Solution: Only reset skipstart at the first column.
Fix#24775
Problem: screenpos() wrong result with w_skipcol and cpoptions+=n
Solution: Use adjust_plines_for_skipcol() instead of subtracting
w_skipcol.
closes: vim/vim#12625bfe377b8f2
Problem: missing winid argument for virtcol()
Solution: Add a {winid} argument to virtcol()
Other functions col(), charcol() and virtcol2col() support a {winid}
argument, so it makes sense for virtcol() to also support than.
Also add test for virtcol2col() with 'showbreak' and {winid}.
closes: vim/vim#12633825cf813fa
Problem: incorrect heights in win_size_restore()
Solution: avoid restoring incorrect heights in win_size_restore()
876f5fb570
I already merged this prior, so just replace the new test with the old one,
but add a test case for the global statusline.
Problem: Fix regression in {func} argument of reduce()
Solution: pass function name as string again
Before patch 9.0.0548, passing a string as {func} argument of reduce()
is treated as a function name, but after patch 9.0.0548 it is treated as
an expression instead, which is useless as reduce() doesn't set any v:
variables. This PR restores the behavior of {func} before that patch.
Also correct an emsg() call, as e_string_list_or_blob_required doesn't
contain format specifiers.
closes: vim/vim#12824ad0c442f1f
Problem: wrong error messages when passing wrong types to count()
Solution: fix it
This fixes two problems:
1. When passing wrong type to {ic} argument of count(), two error
messages are given, the second of which is misleading.
2. When passing wrong type to {comp} argument of count(), the error
message doesn't mention that {comp} may be a String.
closes: vim/vim#128254f389e7c0f
Problem: Crash when collection is modified when using filter().
Solution: Lock the list/dict/blob. (Ernie Rael, closesvim/vim#12183)
e6d40dcdc7
Co-authored-by: Ernie Rael <errael@raelity.com>
Problem: reduce() with a compiled lambda could be faster.
Solution: Call eval_expr_typval() instead of call_func() directly.
f1c60d4bf1
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Error message for wrong argument type is not specific.
Solution: Include more information in the error. (Yegappan Lakshmanan,
closesvim/vim#11037)
8deb2b30c7
Cherry-pick test_listdict.vim changes from patch 8.2.4809.
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: Accepting one and zero for the second sort() argument is strange.
Solution: Disallow using one and zero in Vim9 script.
2007dd49f5
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Functions implementing reduce and map are too long.
Solution: Use a function for each type of value. Add a few more test cases
and add to the help. (Yegappan Lakshmanan, closesvim/vim#9370)
389b72196e
Partial port as this doesn't include handling for non-materialized List.
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: Cannot use reduce() for a string.
Solution: Make reduce() work with a string. (Naruhiko Nishino, closesvim/vim#9366)
0ccb5842f5
Omit tv_get_first_char() as it doesn't really save much code.
Co-authored-by: rbtnn <naru123456789@gmail.com>
Problem: Some lines of code not covered by tests.
Solution: Add a few more test cases. (Dominique Pellé, closesvim/vim#9453)
8bfa0eb863
Co-authored-by: Dominique Pelle <dominique.pelle@gmail.com>
Problem: Cannot use a script-local function for 'foldtext'.
Solution: Expand "s:" and "<SID>". (Yegappan Lakshmanan, closesvim/vim#9411)
27708e6c7b
Cherry-pick test_filter_map.vim change from patch 8.2.3871.
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: Leaking memory in map() and filter(), cannot use a string argument
in Vim9 script.
Solution: Fix the leak, adjust the argument check, also run the tests as
Vim9 script. (Yegappan Lakshmanan, closesvim/vim#9354)
2d877599ee
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Cannot filter or map characters in a string.
Solution: Make filter() and map() work on a string. (Naruhiko Nishino,
closesvim/vim#9327)
c479ce032f
Co-authored-by: rbtnn <naru123456789@gmail.com>
Problem: Error for const argument to mapnew().
Solution: Don't give an error. (closesvim/vim#7400)
57cf4973a2
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Vim9: not enough tests run with Vim9.
Solution: Run a few more tests in Vim9 script and :def function. Fix
islocked(). Fix error for locking local variable.
bd77aa9274
Omit GLV_NO_DECL: Vim9 script only.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Vim9: not enough tests run with Vim9.
Solution: Run a few more tests in Vim9 script and :def function.
3e9c0b9608
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: dict-completion does not respect region
Solution: respect selected region in dict completion
Set do_region to zero as we don't want a complete dump of the matching
words, we want the code to filter them according to the user's selected
region.
closes: vim/vim#12792closes: vim/vim#7025e98fb643ec
Co-authored-by: LemonBoy <thatlemon@gmail.com>
Problem: virtcol2col returns last byte of a multi-byte char
Solution: Make it return the first byte for a multi-byte char
closes: vim/vim#12786closes: vim/vim#12799b209b86e66
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: getcompletion() "cmdline" fails after :autocmd
Solution: Use set_cmd_context() instead of set_one_cmd_context().
closes: vim/vim#12804e4c79d3615
Problem: Cannot use positional arguments for printf()
Solution: Support positional arguments in string formatting
closes: vim/vim#121400c6181fec4
Co-authored-by: Christ van Willegen <cvwillegen@gmail.com>
Problem: getcompletion() failes for user-defined commands
Solution: set context for completion function
closes: vim/vim#12681closes: vim/vim#126808ef1fbc0c3
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: incsearch test not sufficient (after 9.0.1691)
Solution: add an additional test
73b8209266
Co-authored-by: Christ van Willegen <cvwillegen@gmail.com>
Problem:
Treesitter highlighting is slow for large files with lots of injections.
Solution:
Only parse injections we are going to render during a redraw cycle.
---
- `LanguageTree:parse()` will no longer parse injections by default and
now requires an explicit range argument to be passed.
- `TSHighlighter` now parses injections incrementally during on_win
callbacks for the line range being rendered.
- Plugins which require certain injections to be parsed must run
`parser:parse({ start_row, end_row })` before using the tree.
Problem: Temporarily changing current window in a script causes
CursorMoved to be triggerd.
Solution: Don't trigger CursorMoved if neither curwin nor cursor
changed between two checks.
Problem: cannot store custom data in quickfix list
Solution: add `user_data` field for the quickfix list
closes: vim/vim#11818ca6ac99077
Co-authored-by: Tom Praschan <13141438+tom-anders@users.noreply.github.com>
Problem: Ctrl-Q not handled like Ctrl-V in replace mode
Solution: Handle Ctrl-Q like Ctrl-V
closes: vim/vim#12686closes: vim/vim#126842d63e4b3cc
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: mapset() not properly handling script ID
Solution: replace_termcodes() may accept a script ID
closes: vim/vim#12699closes: vim/vim#126977e0bae024d
Problem: undotree() only works for the current buffer
Solution: Add an optional "buffer number" parameter to undotree(). If
omitted, use the current buffer for backwards compatibility.
closes: vim/vim#4001closes: vim/vim#122925fee111149
Co-authored-by: Devin J. Pohly <djpohly@gmail.com>
* feat(treesitter): add injection language fallback
Problem: injection languages are often specified via aliases (e.g.,
filetype or in upper case), requiring custom directives.
Solution: include lookup logic (try as parser name, then filetype, then
lowercase) in LanguageTree itself and remove `#inject-language`
directive.
Co-authored-by: Lewis Russell <me@lewisr.dev>
The terminal buffer closes automatically when using `:terminal` and the
command exits without an error. This messes up some tests that expect
the terminal buffer to still be open. We can force the buffer not to
close by passing an argument to `:terminal`. This can be anything, since
the shell-test stub simply prints whatever argument it's given.
This is a collection of various PRs from github that all require a minor
patch number:
1) https://github.com/vim/vim/pull/12612
Do not conflate dictionary key with end of block
2) https://github.com/vim/vim/pull/12729:
When saving and restoring 'undolevels', the constructs `&undolevels` and
`:set undolevels` are problematic.
The construct `&undolevels` reads an unpredictable value; it will be the
local option value (if one has been set), or the global option value
(otherwise), making it unsuitable for saving a value for later
restoration.
Similarly, if a local option value has been set for 'undolevels',
temporarily modifying the option via `:set undolevels` changes the local
value as well as the global value, requiring extra work to restore both
values.
Saving and restoring the option value in one step via the construct
`:let &undolevels = &undolevels` appears to make no changes to the
'undolevels' option, but if a local option has been set to a different
value than the global option, it has the unintended effect of changing
the global 'undolevels' value to the local value.
Update the documentation to explain these issues and recommend explicit
use of global and local option values when saving and restoring. Update
some unit tests to use `g:undolevels`.
3) https://github.com/vim/vim/pull/12702:
Problem: Pip requirements files are not recognized.
Solution: Add a pattern to match pip requirements files.
4) https://github.com/vim/vim/pull/12688:
Add indent file and tests for ABB Rapid
5) https://github.com/vim/vim/pull/12668:
Use Lua 5.1 numeric escapes in tests and add to CI
Only Lua 5.2+ and LuaJIT understand hexadecimal escapes in strings. Lua
5.1 only supports decimal escapes:
> A character in a string can also be specified by its numerical value
> using the escape sequence \ddd, where ddd is a sequence of up to three
> decimal digits. (Note that if a numerical escape is to be followed by a
> digit, it must be expressed using exactly three digits.) Strings in Lua
> can contain any 8-bit value, including embedded zeros, which can be
> specified as '\0'.
To make sure this works with Lua 5.4 and Lua 5.1 change the Vim CI to
run with Lua 5.1 as well as Lua 5.4
6) https://github.com/vim/vim/pull/12631:
Add hurl filetype detection
7) https://github.com/vim/vim/pull/12573:
Problem: Files for haskell persistent library are not recognized
Solution: Add pattern persistentmodels for haskell persistent library
closes: vim/vim#12612closes: vim/vim#12729closes: vim/vim#12702closes: vim/vim#12688closes: vim/vim#12668closes: vim/vim#12631closes: vim/vim#12573
Already ported but wasn't marked: vim-patch:ad34abee2583
6efb198033
Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: lacygoill <lacygoill@lacygoill.me>
Co-authored-by: Michael Henry <drmikehenry@drmikehenry.com>
Co-authored-by: ObserverOfTime <chronobserver@disroot.org>
Co-authored-by: KnoP-01 <knosowski@graeffrobotics.de>
Co-authored-by: James McCoy <jamessan@jamessan.com>
Co-authored-by: Jacob Pfeifer <jacob@pfeifer.dev>
Co-authored-by: Borys Lykah <lykahb@fastmail.com>
If an iterator pipeline stage returns nil as its first return value, the
other return values are ignored and it is treated as if that stage
returned only nil (the semantics of returning nil are different between
different stages). This is consistent with how for loops work in Lua
more generally, where the for loop breaks when the first return value
from the function iterator is nil (see :h for-in for details).
Add filetype detection for eyaml files (vim/vim#12659)
https://github.com/voxpupuli/hiera-eyaml/ uses and produces the eyaml
format, which is simply yaml with some encrypted values.
It's convenient to edit the file without decrypting when not touching
encrypted values (or when you don't have access to the decryption key),
which is why vim should treat those files as yaml files.
b69b9d5e17
Co-authored-by: Max Gautier <mg@max.gautier.name>
* vim-patch:44ff25d5243b
PyPA manifest files are not recognized (vim/vim#12707)
Problem: PyPA manifest files are not recognized.
Solution: Add a pattern to match PyPA manifest files.
44ff25d524
Co-authored-by: ObserverOfTime <chronobserver@disroot.org>
Currently (as of nvim 0.9), the behavior of boolean params in
vim.api lua wrappers is inconsistent for optional parameters
(part of an `opts` dict) compared to positional parameters.
This was inadvertently changed in #24524 . While cleaning up this
inconsistency is something we might want eventually, it needs
to be discussed separately and the impact of existing code considered.
Problem: luals returns stricter diagnostics with bundled luarc.json
Solution: Improve some function and type annotations:
* use recognized uv.* types
* disable diagnostic for global `vim` in shared.lua
* docs: don't start comment lines with taglink (otherwise LuaLS will interpret it as a type)
* add type alias for lpeg pattern
* fix return annotation for `vim.secure.trust`
* rename local Range object in vim.version (shadows `Range` in vim.treesitter)
* fix some "missing fields" warnings
* add missing required fields for test functions in eval.lua
* rename lsp meta files for consistency
Problem: Tests may leave leftover files around
Solution: Clean up tests and remove files
There were a few failures in 'linux (huge, gcc, testgui, true, true)'
e.g. here: https://github.com/vim/vim/actions/runs/5497376153/jobs/10018060156
,----
| Error detected while processing command line..script /home/runner/work/vim/vim/src/testdir/runtest.vim[585]..function RunTheTest[54]..Test_lvimgrep_crash[16]..TestTimeout[12]..VimLeavePre Autocommands for "*"..function EarlyExit[7]..FinishTesting:
| line 70:
| E445: Other window contains changes
| E937: Attempt to delete a buffer that is in use: Xtest_stable_xxd.txt
| E937: Attempt to delete a buffer that is in use: Xtest_stable_xxd.txt
| E937: Attempt to delete a buffer that is in use: Xtest_stable_xxd.txtmalloc(): unsorted double linked list corrupted
`----
Which is puzzling, because the Xtest_stable_xxd file should have been
long gone after test_crypt.vim is run (and definitely no longer be
staying around in test_quickfix.vim).
So try to clean up properly after a test script is run, just in case any
X<file> is still around. During testing, a found a few leftover files,
which I also fixed in the relevant test-file.
Unfortunately, the test workflow 'linux (huge, gcc, testgui, true,
true)' now seems to fail with 'E1230: Encryption: sodium_mlock()' in
test_crypt.vim. Hopefully this is only temporary.
84bc00e9b5
Co-authored-by: Christian Brabandt <cb@256bit.org>
When an injection has not set include children, make sure not to add
the injection if no ranges are determined.
This could happen when there is an injection with a child that has the
same range as itself. e.g. consider this Makefile snippet
```make
foo:
$(VAR)
```
Line 2 has an injection for bash and a make variable reference. If
include-children isn't set (default), then there is no range on line 2
to inject since the variable reference needs to be excluded.
This caused the language tree to return an empty range, which the parser
now interprets to mean the full buffer. This caused makefiles to have
completely broken highlighting.
Problem: Blade files are not recognized.
Solution: Add a pattern for Blade files. (closesvim/vim#12650)
ad34abee25
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Cannot break undo by setting 'undolevels' to itself in
'inccommand' preview callback.
Solution: Don't set an invalid 'undolevels' value.
Co-authored-by: Michael Henry <drmikehenry@drmikehenry.com>
PR #23689 assumes `client.config.capabilities.workspace.didChangeWatchedFiles`
exists when checking `dynamicRegistration`, but thats's true only if it was
passed to `vim.lsp.start{_client}`.
This caused #23806 (still an issue in v0.9.1; needs manual backport), but #23681
fixed it by defaulting `config.capabilities` to `make_client_capabilities` if
not passed to `vim.lsp.start{_client}`.
However, the bug resurfaces on HEAD if you provide a non-nil `capabilities` to
`vim.lsp.start{_client}` with missing fields (e.g: not made via
`make_client_capabilities`).
From what I see, the spec says such missing fields should be interpreted as an
absence of the capability (including those indicated by missing sub-fields):
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#clientCapabilities
Also, suggest `vim.empty_dict()` for an empty dict in
`:h vim.lsp.start_client()` (`{[vim.type_idx]=vim.types.dictionary}`
no longer works anyway, probably since the cjson switch).
Problem: cache paths are derived by replacing each reserved/filesystem-
path-sensitive char with a `%` char in the original path. With this
method, two different files at two different paths (each containing `%`
chars) can erroneously resolve to the very same cache path in certain
edge-cases.
Solution: derive cache paths by url-encoding the original (path) instead
using `vim.uri_encode()` with `"rfc2396"`. Increment `Loader.VERSION` to
denote this change.
Problem: 'inccommand' doesn't restore 'undolevels' properly for a
buffer shown in multiple windows.
Solution: Don't save information of a buffer twice.
Currently it only skips if `Rows` changed, but it's possible for the height of
the usable area for windows to change (e.g: via `&ch`, `&stal` or `&ls`), which
can cause the value of `&cmdheight` to change when the sizes are restored.
This is a Vim bug, so I've submitted a PR there too. No telling when it'll be
merged though, given the current lack of activity there.
`ROWS_AVAIL` is convenient here, but also subtracts the `global_stl_height()`.
Not ideal, as we also care about the height of the last statusline for other
values of `&ls`. Meh.
Introduce `last_stl_height` for getting the height of the last statusline and
use it in `win_size_save/restore` and `last_status` (means
`last_status_rec`'s `statusline` argument will now be true if `&ls` is 3,
but that does not change the behaviour).
Also corrects the logic in `comp_col` to not assume there's a last statusline
if `&ls` is 1 and the last window is floating.
This aligns its behaviour better with `nvim_win_close`.
Note that `:hide` is actually incapable of closing the cmdwin, unlike `:close`
and `:quit`, so this is a bit of a difference in behaviour.
Disallow closing the previous window from `nvim_win_close`, as this will cause
issues.
Again, no telling how safe this is. It also requires exposing old_curwin. :/
Also note that it's possible for the `&cmdheight` to change if, for example,
there are 2 tabpages and `nvim_win_close` is used to close the last window in
the other tabpage while `&stal` is 1. This is addressed in a later commit.
Problem: As discussed on Matrix, there was some interest in having
`nvim_open_win` again be able to open floats in the cmdwin (e.g: displaying a
hover doc related to what's in the cmdwin). After #23228, this was disallowed.
Solution: Allow `nvim_open_win` in the cmdwin as long as `!enter` and
`buffer != curbuf` (the former can cause all sorts of issues, and the latter
can crash Nvim after closing cmdwin). Also allow `nvim_win_set_buf` in a similar
fashion.
Note that we're not *entirely* sure if this is 100% safe (cmdwin is a
global-state-using-main-loop-calling beast), but this seems to work OK..?
Also:
- Check the buffer argument of `nvim_open_win` earlier, and abort if it's
invalid (it used to still open a window in this case).
- Untranslate `e_cmdwin` errors in the API (other errors in the API are not
translated: although not detailed in the API contract yet, errors are
supposed to be stable).
Problem:
The cmdpreview saved undo nodes on cmdpreview_prepare() from ex_getln.c may
become invalid (free) if the preview function makes undo operations, causing
heap-use-after-free errors.
Solution:
Save the buffer undo list on cmdpreview_prepare)_ and start a new empty one. On
cmdpreview_restore_state(), undo all the entries in the new undo list and
restore the original one. With this approach, the preview function will be
allowed to undo only its own changes.
Fix#20036Fix#20248
Problem: No test for bad use of spaces in help files.
Solution: Add checks for use of spaces in help files. Ignore intentional
spaces. (Hirohito Higashi, closesvim/vim#11952)
d950984489
Cherry-pick changes from patch 9.0.1604.
Co-authored-by: h-east <h.east.727@gmail.com>
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Cannot drag a vertical separator to the right of a window
whose 'statuscolumn' is wider than itself.
Solution: Never treat a click on a vertical separator as a click on
'statuscolumn'.
Avoid consecutive RPC requests involving :startinsert or :stopinsert,
because consecutive RPC requests may be processed together, before the
:startinsert or :stopinsert takes effect.
Also change some feed_command() to command() to make tests faster.