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: 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>
(cherry picked from commit 7c5e7d831a)
Backports #24550.
Adjusts test to expect that didChangeWatchedFiles is *not* registered if
client `capabilities` is nil (as it's not enabled by default for v0.9).
Problem: 'inccommand' doesn't restore 'undolevels' properly for a
buffer shown in multiple windows.
Solution: Don't save information of a buffer twice.
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.
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
Previously, when using foldmethod=indent, inserting an unindented line
would inadvertently open closed folds below it.
As a performance improvement, folds were only updated once, across all
lines, after Insert mode was exited.
Now, the performance improvement is no longer being used when
foldmethod=indent, so folds are updated multiple times during Insert
mode, but only across the lines that are changing, which preserves the
folds (and their open/close states) instead of recreating them.
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'.
(cherry picked from commit c0007e6300)
Problem: Bashslashes added as regexp in runtime completion may be
treated as path separator with some 'isfname' value.
Solution: Make curly braces work for runtime completion and use it.
(cherry picked from commit 895cb173d2)
fix(api): nvim_cmd{cmd="win_getid"} parsed as :winsize
Problem:
`:lua vim.cmd.win_getid(30,10)` is interpreted as `:win[size] 30 10`.
User intention was to call `vim.fn.win_getid(30,10)`.
Solution:
Check that the `cmd` actually matches the resolved command.
(cherry picked from commit 629f8d1e46)
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
Redrawing of 'statusline' and 'winbar' are actually already inhibited by
RedawingDisabled in Ex mode.
In Vim there is a check for `msg_scrolled == 0` (which is false in Ex
mode) since Vim doesn't have msgsep. Add a `!exmode_active` check here
in Nvim instead.
(cherry picked from commit e056777a88)
fix(fs): make `normalize()` work with '/' path
Problem: Current implementation of "remove trailing /" doesn't
account for the case of literal '/' as path.
Solution: Remove trailing / only if it preceded by something else.
(cherry picked from commit 80ff66118a)
Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>