Problem: syntax highlighting lost in popup with opacity lower than 100
(after v9.2.0017)
Solution: Before blending, combine the popup's window color attribute
with the character's own attribute using hl_combine_attr()
(Yasuhiro Matsumoto).
related: #19272
closes: #19478
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: filetype: sh filetype used for env files
Solution: Detect *.env and .env.* files as env filetype,
detect .envrc and .envrc.* as sh filetype,
include a simple env syntax script (DuckAfire)
Previously, .env files were handled by the shell syntax. While
functional, this limited the ability to support specific .env
implementations, such as CodeIgniter4 which allows dots in keys
(e.g., "foo.bar=0").
The new dedicated 'env' filetype and syntax script improves legibility
and prevents highlighting from breaking when encountering spaces.
Currently, the syntax does not support indentation; fields, variables,
and comments must start at the beginning of the line.
closes: #19260
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: DuckAfire <155199080+duckafire@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
The declaration 'SSLVHostSNIPolicy' has bee introduced in version 2.4.66.
closes: #19452
Signed-off-by: Michael Osipov <michael.osipov@innomotics.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: completion: hang with line completion and fuzzy (Jesse Pavel)
Solution: Only check the line number when wrapping around the file
(Hirohito Higashi).
fixes: #19434closes: #19443
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Inefficient use of ga_concat()
Solution: Use ga_concat_len() when the length is already known to avoid
use of strlen() (John Marriott).
closes: #19422
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: John Marriott <basilisk@internode.on.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: When 'autocomplete' fires before compl_leader is initialized,
the prefix filter is bypassed. This allows non-prefix matches
(e.g. from fuzzy omnifuncs) to be shown in the popup menu and
incorrectly preinserted.
Solution: In get_leader_for_startcol(), if compl_leader.string is NULL,
fall back to using compl_orig_text as a filter for matches
starting at or after the completion column (Hirohito Higashi).
When 'autocomplete' first fires, compl_leader is NULL because
ins_compl_start() has not set it yet. This caused the prefix filter in
ins_compl_build_pum(), find_next_completion_match() and
find_common_prefix() to be bypassed, allowing non-prefix fuzzy omnifunc
matches to appear in the PUM and be preinserted.
Extend get_leader_for_startcol() to fall back to compl_orig_text when
compl_leader.string is NULL: if the match's cpt source startcol is less
than compl_col the match includes pre-compl_col text, so return
&compl_leader (NULL string) to signal "pass through"; otherwise return
&compl_orig_text so callers filter by the original text. The compl_col
<= 0 guard is kept only for the prepend-text path to avoid it
interfering with the NULL-leader fallback when compl_col is zero.
With this change all callers of get_leader_for_startcol() automatically
receive the correct filter string without additional helpers.
Also update Test_autocomplete_trigger Test 9 to reflect the new
behavior: 'faberge' is no longer shown when completing 'foo' because
it does not start with the current prefix.
Add Test_autocomplete_preinsert_null_leader() to verify that only
prefix-matching candidates appear in the PUM and are preinserted.
fixes: #19328closes: #19447
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: STRLEN() used for a string literal
Solution: Use STRLEN_LITERAL instead (Yasuhiro Matsumoto).
closes: #19450
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
The Progress syntax file gained `set expandtab` in 4c3f536f4 (updated
for version 7.0d01, 2006-04-11). The Progress language itself doesn't
distinguish between tabs and spaces for indentation, so this seems like
something that should be left to user preference; but the setting is
accompanied by the comment "The Progress editor doesn't cope with tabs
very well", so there may be reason to keep it.
However, using `set` means that any new buffers created after editing a
Progress file will also have `expandtab` turned on, which is likely
contrary to a user's expectations. We should use `setlocal` instead to
avoid this.
closes: #19458
Signed-off-by: Daniel Smith <daniel@rdnlsmith.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: matchadd() conceal may use unrelated syntax cchar.
Solution: Only use syntax cchar when syntax_flags has HL_CONCEAL
(zeertzjq).
closes: #19459
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: The ss_pending_cmds variable is visible globally
Solution: Make it static (Foxe Chen).
closes: #19461
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: less.sh can't read from stdin; it will try to read from a file named "-" instead (after 515da6ecdb).
Solution: Do not prepend "-" with "--" in the arguments list for vim.
The following were checked manually and worked as expected:
echo Test | less.sh
echo Test | less.sh -
less.sh some_file
less.sh --cmd some_file # vim will try to load "--cmd" and "some_file".
less.sh # script outputs "No input."
# All of the above repeated with the output piped to 'cat'.
closes: #19462
Signed-off-by: Shane Harper <shane@shaneharper.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Reading files with lines approaching MAXCOL length crashes
with segfault due to colnr_T overflow.
Solution: The split check 'linerest >= MAXCOL' fired too late because
linerest could grow by up to 'size' bytes before the next
check. Change threshold to 'linerest >= MAXCOL - size' to
ensure the line passed to ml_append() stays within colnr_T
range.
Note: supported by AI claude
fixes: #17935
closes: #18953
closes: #19332
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: ml_append_int() crashes when appending lines near MAXCOL
length due to signed integer overflow in space_needed
calculation.
Solution: Change 'space_needed' from int to long to handle the
'len + INDEX_SIZE' computation without overflow. Update
db_free comparison casts from (int) to (long) to match.
Note: supported by AI claude
related: #17935
related: #18953
related: #19332
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: In order to prevent a use-after-free, bt_quickfix() added a
call to buf_valid(), which slows it down, because Vim has to
loop through many buffers all the time (v9.0.1859)
Solution: Patch v9.0.2010 fixed a similar problem, so that the call to
buf_valid() is no longer required (zeertzjq)
fixes: #19169closes: #19183
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: When ch_open() tries to connect to a hostname that resolves to
multiple addresses (e.g., both IPv6 and IPv4), it uses a
single waittime for all connection attempts. If the first IPv6
connection attempt times out, it consumes almost all of the
waittime, leaving insufficient time (often just 1ms) for the
IPv4 attempt to succeed. (reporter)
Solution: Implement a simplified version of Happy Eyeballs (RFC 8305) to
improve connection fallback behavior when IPv6 is unavailable
or slow (thinca).
Distribute the waittime across multiple addresses:
- First address: use up to 250ms (RFC 8305 Connection Attempt Delay) or
half of the total waittime, whichever is smaller
- Middle addresses: divide remaining time equally
- Last address: use all remaining time
This ensures that IPv4 fallback has sufficient time to succeed even when
IPv6 connection attempts fail or timeout.
closes: #19233
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: thinca <thinca@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Hard to configure Vim according to full XDG spec
Solution: Include the $VIMRUNTIME/xdg.vim script as an example.
(Andrey Butirsky).
closes: #19421
Co-authored-by: Christian Brabandt <cb@256bit.org>
Signed-off-by: Andrey Butirsky <butirsky@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
The input files with syntax test cases are never compiled or
interpreted on behalf of test runners, just read, and their
parts are rendered in accordance with syntax definitions for
associated languages, to be compared with previously vetted
renderings. Whether their arbitrary contents will be valid
programs, benign programs, etc., is left for test authors to
decide and verify in their own environments. As executable
and non-executable files equally qualify for testing and yet
executability is never exercised, and since maintaining
executable files turns out to be a short-lived exception
than common practice, let us persist in keeping syntax files
non-executable and enforce it with a CI check.
closes: #19433
Co-authored-by: Christian Brabandt <cb@256bit.org>
Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: High cpu usage with Wayland compositor
(lilydjwg, after v9.2.0010).
Solution: Partly revert patch v9.2.0010 for now
(Christoffer Aasted)
fixes: #19448closes: #19451
Signed-off-by: Christoffer Aasted <dezzadk@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: popup: Popup windows do not support a transparency setting.
Solution: Add the "opacity" option to popup windows to support
transparency when using the GUI or 'termguicolors'
(Yasuhiro Matsumoto).
closes: #19272
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: When a popup window's border overwrites part of a wide
character from another popup, the remaining half loses its
original attribute (background color) because it is reset to 0.
Solution: Modify screen_line(), screen_puts_len(), and screen_fill() to
preserve the existing ScreenAttrs value when clearing wide
character boundaries. Also ensure background data is refreshed
for transparent popup cells (Yasuhiro Matsumoto).
closes: #19299
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Vim gets confused by OSC handling, causing Vim to start in
search mode (Shane Harper, after v9.1.1703)
Solution: In handle_mapping(), check if we are handling OSC sequences
and if yes go straight to check_termcode() (Foxe Chen)
fixes: #19426closes: #19435
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Stop mentioning "home directory" in the rtp search locations 1. and 5.,
which is incorrect in case of XDG scheme. $MYVIMDIR is correct, so use
this instead.
closes: #19438
Signed-off-by: Andrey Butirsky <butirsky@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Unsafe string functions may lead to buffer overflows
Solution: Use vim_strncpy() instead of strpcy(), replace sprintf() by
vim_snprintf() (Yasuhiro Matsumoto)
closes: #19412
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: parallel make invocation may break Wayland header generation
Solution: Use single make target to generate Wayland protocol files.
(Jan Palus)
$(WAYLAND_SRC) contains up to 4 files which, given right timing and
parallelization level, can spawn 4 independent `make` processes during
parallel build. Each process generates same set of files intermittently
leading to inconsistent results. Instead use one common target each
source file depends on.
fixes: #19419closes: #19420
Signed-off-by: Jan Palus <jpalus@fastmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Build fails when wayland is not defined
(fjaell, after v9.2.0010)
Solution: Add ifdef GDK_WINDOWING_WAYLAND
(Christoffer Aasted)
fixes: #19429closes: #19428
Signed-off-by: Christoffer Aasted <chr.aasted@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Using the Wayland backend in GTK, rendering remains slow due
to per-line redraws, unnecessary Cairo push/pop groups, and
scroll operations that allocate new surfaces repeatedly.
Solution: Improve rendering performance (Christoffer Aasted).
This commit does the following:
- Add gui.is_wayland to detect Wayland backend
- Avoid blocking the input loop
- Skip early redraws; let the compositor handle full-screen redraws
- Use CAIRO_OPERATOR_SOURCE to overwrite instead of blend
- Reuse scroll source region for destination scroll region
- Optimize fast scroll-up
- Remove cairo_push_group/pop_group and cairo_clip in scroll path
to reduce allocations (~50MB saved on 4K fractional scale)
Since Wayland redraws the entire screen between updates (unlike X11),
further performance gains are possible by batching drawing in other code
paths, e.g.:
- message.c: batch lines to avoid scroll
- term.c: batch terminal redraws
These could be refactored later to deferred redraw with Wayland.
closes: #19062
Signed-off-by: Christoffer Aasted <dezzadk@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: the tests test_cindent_* functions were numbered
inconsistently, causing them to be executed in wrong order.
Solution: Rename the test_cindent functions with zero-padded numbers.
Signed-off-by: Christian Brabandt <cb@256bit.org>
- ':!' is not stable, so use system() to get more consistent behaviour.
- Only warns when using 'pwsh'.
- Remove trailing spaces.
closes: #19370
Co-Authored-by: @lxhillwind
Signed-off-by: Mao-Yining <mao.yining@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: MS-Windows: font size calculation may be wrong when font does
not specify a valid ascent value. (Char, after v9.1.2129)
Solution: Calculate ascent as a ratio of ascent to total font height
with a fallback if metrics are zero.
Fallback to default value when font does not specify ascent value.
As proposed in https://github.com/vim/vim/pull/19318#issuecomment-3864669253
related: #19318
closes: #19367
Signed-off-by: Char <peacech@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Comment lines which start like a label are recognized as a
label and indented based on that.
Solution: Check if the position is in a comment after recognizing a label
in cin_islabel (Anttoni Erkkilä)
closes: #19397
Signed-off-by: Anttoni Erkkilä <anttoni.erkkila@protonmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>