Effective use of 'formatprg' requires both an understanding of the
specific capabilities of the formatting tool and Vim's formatting
commands. This is overly burdensome for some users.
Rather than address each complaint on a filetype by filetype basis,
remove 'formatprg' settings from all ftplugins.
It is expected that formatter plugins will be available in the near
future as a better solution. See vim/vim#17145 (Add "formatter" feature using
"compiler" as a template).
Note: 'formatprg' will be removed from older ftplugins after the release
of Vim 9.2. The setting was added to the go and gleam ftplugins during
the current development cycle and have not been included in a Vim
release.
See: vim/vim#18650 (rust.vim: stop setting formatprg to rustfmt)
closes: vim/vim#19108dcc4175284
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
The username/group/netgroup patterns used \l\+ which only matched
lowercase letters. Linux usernames commonly contain hyphens, digits,
and underscores (e.g. www-data, deploy01, test_user).
Update the pattern to \l[-a-z0-9_]* to allow matching the additional
characters "-_" and numbers.
fixes: vim/vim#18963closes: vim/vim#19396a39d7c2617
Co-authored-by: Bozhidar Batsov <bozhidar@batsov.dev>
Problem:
When a window is redrawn, `draw_vsep_win`/`draw_hsep_win` paint plain
separator characters (`│`/`─`) along the window's entire edges,
including cells that are connector corners belonging to other windows.
Then `draw_sep_connectors_win` only fixes the corners of that same
window, not connectors in the middle of its edges that belong to
adjacent windows.
If the window that "owns" the connector corner isn't part of the redraw,
the connector is never repainted.
Solution:
Move connector drawing out of the per-window `win_update` and into a
separate pass in `update_screen` that runs after all windows have been
updated.
Problem: Terminal doesn't detect if the PTY process is suspended or
offer a convenient way for the user to resume the process.
Solution: Detect suspended PTY process on SIGCHLD and show virtual text
"[Process suspended]" at the bottom-left. Resume the process
when the user presses a key.
Problem: wait() checks condition twice on each interval.
Solution: Don't schedule the due callback. Also fix memory leak when
Nvim exits while waiting.
No test that the condition isn't checked twice, as testing for that can
be flaky when there are libuv events from other sources.
Problem:
restart hangs when nvim was started with stdin input, "-" marker stays
in v:argv, causing the restarted instance to block reading from stdin.
Solution:
filter out the "-" argument when rebuilding v:argv during restart.
Stdin content is ephemeral and shouldn't be re-read after restart.
Problem: When a float window with style='minimal' is converted to a
split window and then changes buffer, the minimal style options get
overridden. This happens because merge_win_config() clears the style
field, so get_winopts() doesn't know to re-apply minimal style after
restoring options from the buffer's wininfo.
Solution: Save and restore the style field when clearing the config
during float-to-split conversion.
Problem: Terminal scrollback may be wrong when increasing height after
outputting lines with full scrollback.
Solution: Ensure enough number of scrollback lines have been deleted.
- Amend syntax highlighting to allow for ksh93 discipline function names
(e.g. 'foo.get()') and mksh's odd function naming idiosyncrasies
(shNamespaceOne was introduced to enforce stricter naming rules for
ksh93 namespaces).
- Remove 'bind' from ksh93 syntax (such a builtin has never been
implemented in ksh93).
- 'xgrep' is only available in ksh93v- as an alternative way to
invoke the builtin 'grep -X', so reflect that in the syntax
highlighting.
- Forbid bash-style 'function name() {' syntax when highlighting
ksh88 and ksh93 scripts.
- Fix bug causing ' ()' to be incorrectly validated in mksh scripts.
- Add the many ksh93/ksh2020 .sh.* variables to the list of special
variables.
- Amend iskeyword to allow '.' so that '.sh.tilde.get' and such are
valid function names/variable names. (For mksh functions starting
with odd characters like '%' and '@' this would probably have too
many bad side effects, so I've omitted such a change for that shell.)
- Add new syntax tests and regenerate syntax dump files
closes: vim/vim#1938356033b9df3
Co-authored-by: Johnothan King <johnothanking@protonmail.com>
We add new key exchange algorithms and new enums for PubkeyAuthOptions.
We also add new keywords from sshd_config.5 not present here and remove
keywords present here that are not present in the official
documentation, with the exception of those patched in by Debian and
Fedora, as well as ChallengeResponseAuthentication which is deprecated
but still functional.
closes: vim/vim#1934704c3c6871e
Co-authored-by: Fionn Fitzmaurice <fionn@github.com>
Problem:
bw_rest was used as an extra buffer to save incomplete byte sequences
between calls to buf_write_bytes. Besides being unnecessarily
complicated, this introduced a number of issues:
1) The bytes stored in bw_rest could still be there at the end of
writing the file, never having been written, thus losing some of the
file content on write.
2) bw_rest was not cleared out after the "checking_conversion" phase,
leaving them to affect the written file content during the writing
phase, corrupting the file.
3) bw_rest could contain extra bytes that need to be written to the
output buffer during a buf_write_convert call, potentially before any
bytes are consumed. But some conversions are in-place, without a
separate output buffer. Writing bytes from bw_rest to the "output"
buffer actually overwrote bytes from the input buffer before they were
read, corrupting the data to be written.
4) The extra bytes in bw_rest that need to be written to the conversion
output buffer were not originally accounted for in the size calculation
for the output buffer, causing a buffer overflow (previously fixed in
Vim patch 9.1.2028).
Solution:
Rather than maintaining a separate buffer, the unconverted bytes at the
end of the buffer can just be shifted to the beginning of the buffer,
and the buffer size updated. This requires a bit of refactoring, and
buf_write_convert and buf_write_convert_with_iconv need to report the
number of bytes they consumed so that buf_write_bytes can handle the
remaining bytes.
Following conversion, bw_buf can be checked for any remaining bytes.
Leftover bytes in this case result in a conversion error, which is
better than silently dropping them.
A short section of dead code was removed from buf_write_convert, for
converting a non-UTF-8 buffer to UTF-8. Neovim buffers are always UTF-8.
A few additional tests for iconv conversions have been added. Vim's
iconv tests are disabled in Neovim because they use unsupported values
for 'encoding'.
Problem:
Iter:peek() only works if the iterator is a |list-iterator| (internally, an `ArrayIter`).
However, it is possible to implement :peek() support for any iterator.
Solution:
- add `_peeked` buffer for lookahead without actually consuming values
- `peek()` now works for function, pairs(), and array iterators
- `skip(predicate)` stops at the first non matching element without consuming it
- keep existing optimized behavior for `ArrayIter` to maintain backward compatibility
- use `pack`/`unpack` to support iterators that return multiple values
fix(treesitter): more distinctive highlight for EditQuery captures
Problem: EditQuery shows captures in the source buffer using the Title
highlight group, which could be too similar to Normal.
Solution: Use a virtual text diagnostic highlight group: they are
displayed in a similar manner to the query captures so we can assume
that the color scheme should have appropriate styling applied to make
them visible.
Problem: Changing terminal height immediately after outputting lines
may lead to wrong scrollback.
Solution: Insert pending scrollback lines before the old window height.
TermCursor already has cterm=reverse. Additionally, now that terminal
buffers have a real cursor, the cterm=reverse in TermCursor no longer
shows up in the screen state.
Problem:
`vim.json.decode()` could not parse JSONC (JSON with Comments)
extension, which is commonly used in configuration files.
Solution:
Introduce an `skip_comments` option, which is disabled by default. When
enabled, allows JavaScript-style comments within JSON data.
Problem:
Presumably Neovim contributors use Neovim to write the contributed code.
Chances are that they have some local Neovim-source-specific config, for
example setting the $TEST_FILE and 'makeprg' for files in test/.
Solution:
Ignore it.
Problem: Crash on failed sockconnect() if a new connection is accepted
while polling for uv events.
Solution: Don't use channel_destroy_early().
Also test "tcp" mode failure properly.
Problem:
Escaping logic for {subject} in ex cmd `:help {subject}` is done in a
messy 200+ lines C function which is hard to maintain and improve.
Solution:
Rewrite in Lua. Use `string.gsub()` instead of looping over characters
to improve clarity and add many more tests to be able to confidently
improve current code later on.
Problem: cterm field in Dict(highlight) is declared as Union(Integer, String)
but it actually expects a Dict(highlight_cterm).
Solution: change cterm type to DictAs(highlight__cterm) and simplify the
handling in dict2hlattrs since type validation and empty array compat are
already handled by api_dict_to_keydict.
Problem: Tests for deprecated highlight API were mixed with current API tests.
Solution: Move them to deprecated_spec.lua and update highlight_spec.lua to use nvim_get_hl.
In particular, also mention the difference between the regex atom \k and
what Vim considers for a word character.
closes: vim/vim#186889e456e52df
Co-authored-by: Christian Brabandt <cb@256bit.org>