In commit cdf717283 ("patch 8.2.4424: ".gts" and ".gjs" files are not
recognized", 2022-02-19) support for the glimmer file types were added.
Problem: Syntax hilighting suppoprt was missing.
Solution: Added a glimmer syntax file that will leverage the base
syntaxs (javascript/typescript) and include handlebars syntax
for .gjs/.gts files.
closes: vim/vim#1956975decb4a8d
Co-authored-by: Devin Weaver <suki@tritarget.org>
The runtime had support to detect handlebars (*.hbs) files as filetype
handlebars but was lacking any indent or syntax highlighting for that
filetype.
The handlebars syntax file is also a prerequisite for the glimmer
syntax.
Permission was granted by the original author to retrofit these into the
Vim runtime. Original License (MIT) maintained in code comments.
related: vim/vim#1956999ea2b5b06
Co-authored-by: Devin Weaver <suki@tritarget.org>
using the GNU compiler we just get a bunch of const warnings we can fix.
clang, however, gets really upset that the standard library suddenly
starts using a lot of c11 features, despite us being in -std=gnu99 mode.
Basically, _GNU_SOURCE which we set is taken as a _carte blanche_ by the
glibc headers to do whatever they please, and thus we must inform clang
that everything is still OK.
Problem:
On FreeBSD, output written to TTY may be lost on exit.
Example test failure:
FAILED
test/functional/terminal/tui_spec.lua @
2521:
TUI no assert failure on deadly signal #21896
test/functional/terminal/tui_spec.lua:2523: Row 1 did not match.
Expected:
|*Nvim: Caught deadly signal 'SIGTERM' |
|* |
|*[Process exited 1]^ |
|* |
|* |
| |
|{5:-- TERMINAL --} |
Actual:
|* |
|*[Process exited 1]{100:^ }|
|*{100:~ }|
|*{100:~ }|
|*{3:[No Name] }|
| |
|{5:-- 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.
Snapshot:
screen:expect([[
|
[Process exited 1]{100:^ }|
{100:~ }|*2
{3:[No Name] }|
|
{5:-- TERMINAL --} |
]])
stack traceback:
test/functional/ui/screen.lua:909: in function '_wait'
test/functional/ui/screen.lua:537: in function 'expect'
test/functional/terminal/tui_spec.lua:2523: in function <test/functional/terminal/tui_spec.lua:2521>
Solution:
Call tcdrain() on stdout and stderr on exit.
This problem is only observed on FreeBSD, but it probably doesn't hurt
to do this on all platforms with termios.h. In fact using tcdrain() on
PTY slave is no-op on Linux according to Linux kernel source code.
Problem: byteidx_common() and f_utf16idx() are calling ptr2len() twice
per iteration, instead of reusing the already computed clen.
Solution: Reuse clen for pointer advancement in both functions
(Yasuhiro Matsumoto).
closes: vim/vim#19573499e93d09a
N/A patches:
vim-patch:9.2.0109: VIM_BACKTICK is always defined except for tiny builds
Co-authored-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Hyphenated language names are silently dropped when used as injections
(see #38132).
This combines the normalization of language aliases into `resolve_lang`,
and also adds the normalization of hyphens to underscores, which allows
for handling of injected language tags with hyphens in their names.
Fixes#38132.
Problem: memory leak in expand_findfunc() (after v9.1.0811)
Solution: Free list variable l on early return (Huihui Huang).
closes: vim/vim#19564648240fe9a
N/A patches:
vim-patch:9.2.0105: memory leak in heredoc_get() in src/evalvars.c
Co-authored-by: Huihui Huang <625173@qq.com>
Problem: Memory leak in qf_push_dir() (after v9.2.0091)
Problem: free dirname, if it is not a directory.
closes: vim/vim#19552e352bb632a
Co-authored-by: Christian Brabandt <cb@256bit.org>
- Use double underscores for the group targets as these targets usually
shouldn't be used directly.
- Use dash instead of underscore in the two targets that need to be used
directly. I'm not entirely sure about this, as both chars are used in
many targets, but a dash is easier to type than an underscore.
Problem: During initial "bootstrap" via lockfile synchronization, the
whole plugin specification is reconstructed from the lockfile data,
ignoring potential user changes added in the first `vim.pack.add()`.
This is enough in most situations since it is the only data needed
for actual installation.
However, this affects specification passed to `PackChanged[Pre]`
events. In particular, `data` field is missing which can be a problem
if there is a `PackChanged kind=install` hook that uses that field
(like with some kind of `build` method used during install).
And there might be different `version` set in `vim.pack.add()`.
Solution: Pass the `specs` input of the first `vim.pack.add()` down to
lockfile synchronization and use it to reconstruct plugin
specification for the to-be-installed plugin. If present among the
user's `specs`, it is used but with forced `src` from the lockfile (as
it is the one used during installation).
Note that this still has a caveat when using separate
`vim.pack.add()`, as only the specs from the first input (when the
lockfile synchronization happens) is taken into account.
Problem: 'listchars' "leadtab" not used in :list (after 9.2.0088).
Solution: Also check for "leadtab" when using :list. Fix memory leak on
E1572 if "multispace" or "leadmultispace" is set (zeertzjq).
closes: vim/vim#195575845741d69
Problem: nvim_win_get_config() does not return a window's "style".
Solution: always include it, and document `style=""`.
Always included so it can be used reciprocally with nvim_open_win() or
nvim_win_set_config(). (otherwise the config of a window with kWinStyleUnused
will not unset the kWinStyleMinimal style of another window if passed to
nvim_win_set_config, for example)
Problem: 5943a81 skips saving window options in `buflist_altfpos` for
style=minimal windows, which also prevents the window from restoring its own
options when switching buffers.
Solution: revert the change. In `get_winopts`, don't restore options from the
`WinInfo` of style=minimal windows when reusing values for a different window.
In `win_free`, clear `wi_optset` for minimal windows.
Previous implementation used a full sort but this is unnecessary. Pairs
do not need to be processed in id-order, all that we did was make
"start" and "end" marks find each other. This can be done with a hash
table instead. The "grow only" khash_t mentioned in the TODO is
the since long merged #249855970157e refactor with dense value array,
to not regress on memory locality.
Problem: The has() function is slow because it performs a linear scan
of the feature list for every call.
Solution: Move common runtime checks and the patch-version parser to the
beginning of the f_has() function (Yasuhiro Matsumoto).
closes: vim/vim#19550327e0e34c9
Co-authored-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Problem: "leadtab" behavior inconsistent on line with only TABs
(after 9.2.0088).
Solution: Don't consider those as leading TABs. Also add more tests for
existing behavior of "lead" and "leadmultispace" (zeertzjq).
closes: vim/vim#195494b30e40a1f
Problem: cannot display tabs for indentation
Solution: Add the "leadtab" value to the 'listchars' option to
distinguish between tabs used for indentation and tabs used
for alignment (HarshK97).
closes: vim/vim#190948526d32647
Co-authored-by: HarshK97 <harshkapse1234@gmail.com>
Problem: currently in the example a new diagnostic namespace is created
for showing it manually with a custom config. Because of a separate
namespace, when the original diagnostic source sets diagnostics again,
it will not affect the diagnostic shown in that new namespace and the
user would need to implement the logic for hiding it themselves,
separately as well.
Solution: instead of creating a new namespace, reuse the original
diagnostic's namespace, so once the source sets diagnostics again, it's
removed and hidden automatically without user having to do anything
extra for that.
Problem: If Nvim server fails to --listen and prints error before the
TUI enters alternate screen, the error isn't visible.
Solution: Forward server stderr using client side stderr handler instead
of having the server inherit client stderr file descriptor.
This does mean that `stderr_isatty` will be `false` in the server, but
that value doesn't matter in embedded mode.
Always pass `stdin_fd` to embedded server to avoid a hang when reading
from stdin when it's a TTY (not sure why one wants to do that, perhaps
by mistake), because if `stdin_fd` isn't passed, the server will try to
use stderr as stdin.
Example test failure on CI:
FAILED test/functional/terminal/tui_spec.lua @ 41: TUI exit status 1 and error message with server --listen error #34365
test/functional/terminal\tui_spec.lua:55: Failed to match any screen lines.
Expected (anywhere): "nvim%.exe: Failed to %-%-listen: address already in use:"
Actual:
|{114:nvim.exe -h"} |
| |
|[Process exited 1]^ |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|{5:-- TERMINAL --} |
Snapshot:
screen:expect([[
{114:nvim.exe -h"} |
|
[Process exited 1]^ |
|*13
{5:-- TERMINAL --} |
]])
stack traceback:
test\functional\ui\screen.lua:909: in function '_wait'
test\functional\ui\screen.lua:537: in function 'expect'
test/functional/terminal\tui_spec.lua:55: in function <test/functional/terminal\tui_spec.lua:41>
In this case, it appears that the client entered alternate screen in the
middle of the server's print_mainerr().
Problem:
The DSR wait warning causes any test that involves Nvim TUI to become
flaky on Windows. Example:
FAILED test/functional/terminal/cursor_spec.lua @ 367: :terminal cursor can be positioned arbitrarily
test/functional/terminal\cursor_spec.lua:377: Row 1 did not match.
Expected:
|*^ |
|*~ |
|*~ |
|*~ |
|*~ |
|* |
|{5:-- TERMINAL --} |
Actual:
|* |
|* |
|*{2: }|
|*{103:defaults.lua: Did not detect DSR response from ter}|
|*{103:minal. This results in a slower startup time. }|
|*{UNEXPECTED foreground = tonumber('0x000006'):Press ENTER or type command to continue^ }|
|{5:-- TERMINAL --} |
Solution:
Don't show the DSR wait warning when running tests.
Problem: There is a xkb syntax, but no filetype plugin.
Solution: Create a filetype plugin and set the comment and commentstring
options for the xkb filetype (xkb = X keyboard extension)
closes: vim/vim#1953714eddc7d46
Co-authored-by: GX <59413576+gx089@users.noreply.github.com>
Problem: When z= fails due to no word being found, 'spelllang' being
unset or a multiline visual selection, 'nospell' is not
restored.
Solution: Jump to where the user configured value of 'spell' is restored
instead of returning early (Luuk van Baal).
closes: vim/vim#19525eba078fc47
Attempt to match all variations of group name and comma separator across
continuation lines.
Fixes issues:
- vim/vim#18491 (Two ")"s are incorrectly colored 'vimOperError' in
syntax/mail.vim), reported by @lkintact
- vim/vim#19366 (highlight error for contains elements in a new line), reported
by Maxim Kim
fixes: vim/vim#18491fixes: vim/vim#19366b901fa9a6a
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Problem: Color completion items display as plain text without visual preview
Solution: Parse RGB/hex colors from documentation and render with colored symbol ■
Closing the quickfix window previously triggered a WinClosed autocmd
that deleted all difftool autocmds and pushed an empty quickfix list,
making the difftool non-functional. Users who close the quickfix window
to gain screen real estate for viewing diffs had no way to continue
navigating entries.
Remove the qf_win tracking and its associated WinClosed autocmd so that
closing the quickfix window no longer tears down the difftool state.
Closing either diff window still performs full cleanup as before.
The BufWinEnter handler no longer passes with_qf to diff_files, so
navigating entries while the quickfix window is closed reuses the
existing diff layout without forcing a layout rebuild.
Fixes#37388
Problem: Unable to configure message targets based on message kind.
Solution: Add cfg.msg.targets mapping message kinds to "cmd/msg/pager".
Check the configured target when writing the message.
cfg.msg = { target = 'cmd', targets = { progress = 'msg', list_cmd = 'pager' } }
will for example use the 'msg' target for progress messages,
immediately open the pager for 'list_cmd' and use the cmdline
for all other message kinds.
fix: allocate hidden console for detached server
Starting the server with UV_PROCESS_DETACHED results in DETACHED_PROCESS, leaving the child without a console. Without a console:
CONIN$ / CONOUT$ cannot resolve, causing channel_from_stdio to fail.
ConPTY cannot attach, breaking :terminal.
This patch allocates a hidden console via AllocConsole() when the server has none, restoring working stdio and enabling ConPTY.
Also updates os_set_cloexec to clear HANDLE_FLAG_INHERIT on the RPC pipe
handles, matching the Unix F_DUPFD_CLOEXEC behavior.
Problem: closing a minimal float saves its style-imposed options into
buffer's wininfo, which get picked up by normal windows on :bnext.
Solution: don't save window options to wininfo for style=minimal windows.
Problem:
When cross-compiling, `$<TARGET_FILE:nlua0>` resolves to the target
binary, which cannot run on the host machine during the build process.
Solution:
Allow passing a host native nlua0 binary via
`-DNLUA0_HOST_PRG=/path/to/nlua0` when cross-compiling, so code
generation can run correctly on the host.
Problem: memline: a crafted swap files with bogus pe_page_count/pe_bnum
values could cause a multi-GB allocation via mf_get(), and
invalid pe_old_lnum/pe_line_count values could cause a SEGV
when passed to readfile() (ehdgks0627, un3xploitable)
Solution: Add bounds checks on pe_page_count and pe_bnum against
mf_blocknr_max before descending into the block tree, and
validate pe_old_lnum >= 1 and pe_line_count > 0 before calling
readfile().
Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-r2gw-2x48-jj5p65c1a143c3
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: A stack-buffer-overflow occurs when rendering a statusline
with a multi-byte fill character on a very wide terminal.
The size check in build_stl_str_hl() uses the cell width
rather than the byte length, allowing the subsequent fill
loop to write beyond the 4096-byte MAXPATHL buffer
(ehdgks0627, un3xploitable).
Solution: Update the size check to account for the byte length of
the fill character (using MB_CHAR2LEN).
Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-gmqx-prf2-8mwf4e5b9e31cb
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: When parsing a malformed Emacs-style tags file, a 1-byte
heap-buffer-underflow read occurs if the 0x7f delimiter
appears at the very beginning of a line. This happens
because the code attempts to scan backward for a tag
name from the delimiter without checking if space exists.
(ehdgks0627, un3xploitable)
Solution: Add a check to ensure the delimiter (p_7f) is not at the
start of the buffer (lbuf) before attempting to isolate
the tag name.
GitHub Advisory:
https://github.com/vim/vim/security/advisories/GHSA-xcc8-r6c5-hvwv9b7dfa2948
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: Crash with overlong emacs tag file, because of an OOB buffer
read (ehdgks0627, un3xploitable)
Solution: Check for end of buffer and return early.
Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-h4mf-vg97-hj8jf6a7f469a9
Cherry-pick a change from patch 9.0.0767.
Add missing change from patch 9.2.0070.
Co-authored-by: Christian Brabandt <cb@256bit.org>