Problem:
Folds are opened when the visible range changes even if there are no
modifications to the buffer, e.g, when using zM for the first time. If
the parsed tree was invalid, on_win re-parses and gets empty tree
changes, which triggers fold updates.
Solution:
Don't update folds in on_changedtree if there are no changes.
The removes the previous restriction that nvim_buf_set_extmark()
could not be used to highlight arbitrary multi-line regions
The problem can be summarized as follows: let's assume an extmark with a
hl_group is placed covering the region (5,0) to (50,0) Now, consider
what happens if nvim needs to redraw a window covering the lines 20-30.
It needs to be able to ask the marktree what extmarks cover this region,
even if they don't begin or end here.
Therefore the marktree needs to be augmented with the information covers
a point, not just what marks begin or end there. To do this, we augment
each node with a field "intersect" which is a set the ids of the
marks which overlap this node, but only if it is not part of the set of
any parent. This ensures the number of nodes that need to be explicitly
marked grows only logarithmically with the total number of explicitly
nodes (and thus the number of of overlapping marks).
Thus we can quickly iterate all marks which overlaps any query position
by looking up what leaf node contains that position. Then we only need
to consider all "start" marks within that leaf node, and the "intersect"
set of that node and all its parents.
Now, and the major source of complexity is that the tree restructuring
operations (to ensure that each node has T-1 <= size <= 2*T-1) also need
to update these sets. If a full inner node is split in two, one of the
new parents might start to completely overlap some ranges and its ids
will need to be moved from its children's sets to its own set.
Similarly, if two undersized nodes gets joined into one, it might no
longer completely overlap some ranges, and now the children which do
needs to have the have the ids in its set instead. And then there are
the pivots! Yes the pivot operations when a child gets moved from one
parent to another.
`LanguageTree:parse` is recursive, and calls
`LanguageTree:for_each_child`, which is also recursive.
That means that, starting from the third level (child of child of root),
nodes will be parsed twice.
Which then means that if the tree is N layers deep, there will be ~2^N
parses even if the branching factor is 1.
Now, why was the tree deepening with each character inserted? And why
did this only regress in #24647? These are mysteries for another time.
Fixes: #25104
runtime(doc): documentation updates
This is a collection of various improvements to the help pages
closesvim/vim#12790596ad66d1d
Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Houl <anwoku@yahoo.de>
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Co-authored-by: Adri Verhoef <a3@a3.xs4all.nl>
Problem:
* The guessed botline might be smaller than the actual botline e.g. when
there are folds and the user is typing in insert mode. This may result
in incorrect treesitter highlights for injections.
* botline can be larger than the last line number of the buffer, which
results in errors when placing extmarks.
Solution:
* Take a more conservative approximation. I am not sure if it is
sufficient to guarantee correctness, but it seems to be good enough
for the case mentioned above.
* Clamp it to the last line number.
Co-authored-by: Lewis Russell <me@lewisr.dev>
Problem:
Some tests fail with $SHELL=fish #6172
Related: https://github.com/neovim/neovim/pull/6176
Solution:
Replace "echo -n" with "printf", because "echo" in sh may be provided
as a shell builtin, which does not accept an "-n" flag to avoid a
trailing newline (e.g. on macos). "printf" is more portable (defined by
POSIX) and it does not output a trailing newline by itself.
Fixes#6172
TODO:
Other test failures may be related to "session leader" issue: https://github.com/neovim/neovim/issues/2354
Checked by running `:terminal ./build/bin/tty-test` from Nvim with
`shell=/bin/fish` (inherited from `$SHELL`) and it indeed complains
about "process does not own the terminal". With `shell=sh` it doesn't complain. And
unsetting `$SHELL` seems to make `nvim` to fall back to `shell=sh`.
FAILED test/functional/terminal/tui_spec.lua @ 1017: TUI paste: terminal mode
test/functional/terminal/tui_spec.lua:1024: Row 1 did not match.
Expected:
|*tty ready |
|*{1: } |
|* |
| |
|{5:^^^^^^^ }|
|{3:-- TERMINAL --} |
|{3:-- TERMINAL --} |
Actual:
|*process does not own the terminal |
|* |
|*[Process exited 2]{1: } |
| |
|{5:^^^^^^^ }|
|{3:-- TERMINAL --} |
|{3:-- TERMINAL --} |
To print the expect() call that would assert the current screen state, use
screen:snapshot_util(). In case of non-deterministic failures, use
screen:redraw_debug() to show all intermediate screen states.
stack traceback:
test/functional/ui/screen.lua:622: in function '_wait'
test/functional/ui/screen.lua:352: in function 'expect'
test/functional/terminal/tui_spec.lua:1024: in function <test/functional/terminal/tui_spec.lua:1017>
FAILED test/functional/terminal/tui_spec.lua @ 1551: TUI forwards :term palette colors with termguicolors
test/functional/terminal/tui_spec.lua:1567: Row 1 did not match.
Expected:
|*{1:t}ty ready |
| |
|* |
| |
|{2:^^^^^^^ }|
| |
|{3:-- TERMINAL --} |
Actual:
|*{1:p}rocess does not own the terminal |
| |
|*[Process exited 2] |
| |
|{2:^^^^^^^ }|
| |
|{3:-- TERMINAL --} |
To print the expect() call that would assert the current screen state, use
screen:snapshot_util(). In case of non-deterministic failures, use
screen:redraw_debug() to show all intermediate screen states.
stack traceback:
test/functional/ui/screen.lua:622: in function '_wait'
test/functional/ui/screen.lua:352: in function 'expect'
test/functional/terminal/tui_spec.lua:1567: in function <test/functional/terminal/tui_spec.lua:1551>
Problem: No runtime support for Mojo
Solution: Add basic filetype and syntax plugins
closes: vim/vim#13062closes: vim/vim#130630ce2c594d0
Co-authored-by: Mahmoud Abduljawad <mahmoud@masaar.com>
runtime(scala): Fix Scala highlighting string literal as type param (vim/vim#13070)
Since https://docs.scala-lang.org/sips/42.type.html which is implemented
in Scala 2.13 and in Scala 3 it possible to use string literals as
singleton types. So code like
```
someFunc["abc"]
```
is valid. Currently this code is not hightlighted correctly and worse if
there is an unclosed `(` in the string it breaks the formating in the
rest of the file.
I also submitted this patch to the mentioned project for this runtime
file: https://github.com/derekwyatt/vim-scala/pull/173 But there are no
commits there over the last 2 years and no response in the week since I
created it. Also the last change to the Scala syntax file:
https://github.com/vim/vim/pull/9594 is yet to be backported to that
repo. Therefore I am opening this PR as well to get some feedback on how
to proceed to get this fixed.
0661033075
Co-authored-by: Emil Ejbyfeldt <eejbyfeldt@liveintent.com>
Memfile used a private implementation of an open hash table with intrusive collision chains, but there is
no reason to assume the standard khash_t based Map won't work just fine.
Yes, we are taking full ownership and maintenance over memline and memfile.
No one is going to maintain it for us.
Trust the plan.
Fixes#24881
--force-config passed to luarocks' configure script is only taken into
account in case "make install" is used afterwards.
But if "make bootstrap" is used then this flag has no effect. And it can
actually copy an existing config on the system to the new installation.
That existing config can have a different version of Lua set by default.
In which case luarocks will install packages for that version instead of
the one used in tests. And trying to run tests then will fail because of
missing packages.