Problem: ANSI escape colors are not displayed correctly in
non-termguicolors in vim (cli) on Windows. The red and blue
channels seem to be swapped.
Cause: When converting VTerm ANSI index colors to cterm colors in
terminal.c, the Windows case equivalent to NR-16 (:help
cterm-colors) is ignored.
Solution: Created and used a table to convert ANSI indexed colors to
cterm's NR-16 representation (Windows only). This table
corresponds to the inverse conversion of cterm_ansi_idx in
term.c. The values in both tables are exactly the same, but
the meanings are opposite, so they are separate tables
(Muraoka Taro).
closes: #18931
Signed-off-by: Muraoka Taro <koron.kaoriya@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: MS-Windows: Missing fullscreen support for GUI version
Solution: Add "s" flag to guioptions (Mao-Yining)
- Implement fullscreen mode controlled by the 'go-s' flag in 'guioptions'
- Update documentation with usage examples and platform-specific details
See :help 'go-s' and :help gui-w32-fullscreen for complete documentation.
closes: #18836
Signed-off-by: Mao-Yining <101858210+mao-yining@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: MS-Windows: If a directory with a single character name is
included in the PATH environment variable without a trailing
path separator, executable() will not be able to find the
executable file under it.
Solution: The second argument of the after_pathsep() function is now
passed the next pointer where a path separator may exist
(Muraoka Taro).
As a specific example, the default installation path for PowerShell v7
is "C:\Program Files\PowerShell\7", but if you set this as is in the
PATH environment variable, Vim will not be able to find the pwsh.exe
command. In this case, Vim will try to search for "C:\Program
Files\PowerShell\7pwsh.exe".
Cause: The after_pathsep() function determines whether the location
passed as its second argument immediately follows a path separator.
However, in the code where the problem occurred, the second argument was
passed a location that might contain a path separator. As a result, it
was mistakenly determined that a path separator was present in cases
where the final directory name was a single character and not followed
by a path separator, and the path to search was incorrect.
closes: #18979
Signed-off-by: Muraoka Taro <koron.kaoriya@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: Test_glob_symlinks may fail on Windows with UCRT
runtime
Solution: Comment out the code, do not use _wstat().
(author)
For Test_glob_symlinks() to succeed, vim_stat() (which is actually
mswin_stat_impl()) must fail on empty symlinks. When the dynamically
linked C runtime is linked, _wstat() succeeds even on empty symbolic
links. As a result, Test_glob_symlinks() fails.
For details, see here:
https://github.com/koron/vc-stat-behavior-verificationcloses: #18962
Signed-off-by: Muraoka Taro <koron.kaoriya@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Vim9: heap-use-after-free when when accessing protect class
member (Foxe Chen)
Solution: Set cl->class_type_list and return directly, add tests for
using protected class method and variable from another class
(Yegappan Lakshmanan).
closes: #18971
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: After :botright copen and closing the quikfix window, the
cursor ends up in the wrong window. The problem is fr_child
always points to the first (leftmost for FR_ROW, topmost for
FR_COL) child frame. When do :vsplit, the new window is
created on the left, and frame_insert() updates the parent's
fr_child to point to this new left window.
Solution: Create a snapshot before open the quickfix window and restore
it when close it (glepnir).
closes: #18961
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Vim9: class and object member names are stored as char_u *
pointer requiring repeated strlen() calls and making it harder
to use length-aware string operations consistently.
Solution: Store ocm_name as a string_T instead of char_u *
(John Marriott).
In addition in vim9class.c:
1: change some calls from ga_concat() to ga_concat_len() where the
length is known.
2: in ex_class() remove unneeded variable name.
3. in intf_method_present() remove unneeded variable cl_name.
4: in update_member_method_lookup_table() move some assignments from
inner loops into outer loops.
5: in member_lookup() remove unneeded else.
6: in is_duplicate_variable() and is_duplicate_enum() rearrange the
string comparisons to first check the lengths match.
closes: #18973
Signed-off-by: John Marriott <basilisk@internode.on.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: clipboard provider does not respect 'clipboard' option
(Satoru Kitaguchi, after v9.1.1972)
Solution: make clipboard provider register respect "unnamed/unnamedplus"
from the 'clipboard' option value
fixes: #18930closes: #18952
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Not enough tests for :setlocal omnifunc (after 9.1.1991).
Solution: Move the last :new after :setlocal. Also test with 'complete'
(zeertzjq).
closes: #18958
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Missing out-of-memory check in vim9class.c in calls to
vim_strnsave().
Solution: Refactor is_duplicate_variable() and is_duplicate_enum() and
make use of string_T struct instead (John Marriott).
closes: #18947
Signed-off-by: John Marriott <basilisk@internode.on.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: test_cmdline.vim leaves swapfiles behind
Solution: Close open buffers using :bw! instead of :close!
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Data races between test buffers are currently addressed by
relying on arbitrary execution delays or blissfully dismissed.
Solution: Prefer more deterministic synchronisation between test buffers
for test cases that generate screendump files with expected
results (Aliaksei Budavei)
closes: #18920
Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: More deterministic synchronisation can be established between
processes running test cases and collecting visual effects to
a screendump file for future verification by anticipating
the availability of known parts of such a file and asserting
the location of the cursor.
Solution: Provide a convenience test function that waits a specified
time for cursor positioning (Aliaksei Budavei)
related: #18920
Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Vim9: heap buffer overflow with COMPAREANY instruction
Solution: Verify the type and error out in case of different types
(Foxe Chen)
closes: #18945
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: Test_term_gettty() fails when using conpty on Windows,
CI uses winpty, so this test passes.
Solution: Skip the test Test_term_gettty(). Since conpty communicates
via anonymous pipes, there is no name that can be obtained
with term_gettty() (Muraoka Taro)
closes: #18954
Signed-off-by: Muraoka Taro <koron.kaoriya@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Vim intro screen shows register message (after v9.1.1893)
Solution: Remove the register message, registering is no longer useful
and possible.
fixes: #18933closes: #18934
Signed-off-by:
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: osc52 package can be further improved (after v9.1.1984).
Solution: Improve plugin, update test and check for clipboard_provider
feature (Foxe Chen).
closes: #18935
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: clipboard provider does not work when redirecting messages
(BenYip, after v9.1.1972)
Solution: Adjust ifdefs in ex_redir()
fixes: #18937closes: #18939
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: test_sound.vim fails when run locally on Windows
Solution: Skip Test_play_silent in Windows non-GUI environments.
Cause: There are two causes:
1) The global variable g:id is undefined, causing an undefined
reference. Due to the execution order of test cases, g:id is defined in
Test_play_event. However, on Windows, this test is skipped, so g:id is
not defined. It is referenced in Test_play_silent's WaitForAssert()
without being defined, resulting in an undefined error.
Solution: Define g:id at the beginning of Test_play_silent.
2) In the non-GUI Windows version of vim, there is no message loop,
so the callback when play file sound ends does not occur, and
Test_play_silent's WaitForAssert times out and fails. In CI,
sound_playfile() returns 0, so Test_play_silent is skipped. The
reason for this is unknown, but it may be because CI is running on
Windows Server or something like that.
Solution: Skip Test_play_silent in Windows non-GUI environments.
Signed-off-by: Muraoka Taro <koron.kaoriya@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
closes: #18941
Problem: terminal OSC52 support to access the clipboard can be improved
Solution: Include and package the optional osc52 package, note: this
requires a Vim with clipboard provider feature (Foxe Chen).
related: #14995closes: #18575
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Vim9: class_name definition can be improved
Solution: Use string_T to store class_name, avoid using STRLEN() calls,
simplify code, remove unused definition of struct
oc_newmember_S (John Marriott)
Use struct string_T to store the field class_name in struct class_T,
which means we can just use the .length field in struct string_T
instead of measuring it.
In addition:
1. In eval.c use string_T to store class_name and s in function
class_tv2string().
2. In vim9type.c change some calls from ga_concat() to ga_concat_len()
where the length is known.
3. In vim9class.c remove unused struct definition oc_newmember_S.
Change some calls from ga_concat() to ga_concat_len() where the
length is known.
4. In scriptfile.c use string_T to store type_name, class_name and
es_name in function estack_sfile().
5. In function estack_sfile() simplify construction of the grow array ga
and change some calls from ga_concat() to ga_concat_len() when the
length is known.
closes: #18925
Signed-off-by: John Marriott <basilisk@internode.on.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: test suite may stop on error in gen_opt_test.vim
Solution: Use a different output file for log files (Muraoka Taro)
When running newtests, it may unexpectedly stop just before
test_options_all.
Cause: When generating the opt_test.vim file for test_options_all, the
failure is detected by the existence of test.log. Therefore, if a test
performed before test_options_all fails and test.log is created, it is
mistakenly thought that the generation of opt_tet.vim has failed, and
the test suite stops there.
So let's change the filename created when utils/gen_opt_test.vim fails
from test.log to gen_opt_test.log, so that it can be detected
independently from other test failures.
closes: #18928
Signed-off-by: MURAOKA Taro <koron.kaoriya@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: :helpclose incorrectly accepts a range and a count.
Solution: Remove EX_COUNT and EX_RANGE from the command definition.
(Doug Kearns)
closes: #18917
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: When using listeners, there is no way to run callbacks at
specific points in the redraw cycle.
Solution: Add redraw_listener_add() and redraw_listener_remove() and
allow specifying callbacks for redraw start and end
(Foxe Chen).
closes: #18902
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: blob2str() may call strcpy with a NULL pointer
Solution: Check for NULL before calling STRNCPY()
closes: #18907
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: some minor problems with clipboard provider code
(after v9.1.1972)
Solution: Fix minor issues (Foxe Chen)
- allow empty register type for paste function to mean automatic
- fix internal inc_clip_provider() and dec_clip_provider() functions not
setting the pause count correctly
- don't call paste function when yanking
closes: #18909
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: No way to access the clipboard without X11/Wayland.
Solution: Add the clipboard provider feature (Foxe Chen).
closes: #18781
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Crash when buffer gets deleted inside charconvert during save
Solution: Check for `b_saving` inside `can_unload_buffer()`, so we don’t try to
unload a buffer while it’s still being saved (glepnir).
closes: #18901
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Wrong cursor position after formatting with long 'formatprg'.
Solution: Don't show hit-enter prompt when there are stuffed characters.
Previously a stuffed character at the hit-enter prompt will dismiss the
prompt immediately and be put in the typeahead buffer, which leads to
incorrect behavior as the typeahead buffer is processed after the stuff
buffers. Using vungetc() when KeyStuffed is TRUE can fix this problem,
but since the hit-enter prompt isn't visible anyway (and is likely not
desired here), just skip the prompt instead, which also avoids a wait
when using "wait" instead of "hit-enter" in 'messagesopt'.
fixes: #18905closes: #18906
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: test_python3.vim leaves swapfiles behind
Solution: Close open buffers using :bw! instead of :close!
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: MS-Windows: dark mode in gui is not supported
Solution: Inplement the 'd' flag in 'guioptions'
(Mao-Yining).
related: #12282closes: #18877
Co-Authored-By: LemonBoy <thatlemon@gmail.com>
Signed-off-by: Mao-Yining <mao.yining@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: When exiting at the end of the more prompt (at the hit enter
prompt) by hitting q the recording mode will be started.
(Jakub Łuczyński)
Solution: Don't add the q key to the typeahead buffer
in the function wait_return (Bjoern Foersterling)
fixes: #2589closes: #18889
Signed-off-by: Bjoern Foersterling <bjoern.foersterling@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Wrong display when using setline() at hit-enter prompt
(after 8.2.3204).
Solution: Only skip scrolling for changed lines in top area if it's
scrolled down due to w_topline change. Also add more testing
for what 8.2.3204 fixed (zeertzjq).
closes: #18887
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: diff: missing diff size limit for xdiff
Solution: Impose file size limit for internal diff (xdiff)
(Yee Cheng Chin).
Git imposes a hard cap on file size for content that it passes to xdiff
(added to Git in dcd1742e56e, defined in xdiff-interface.h), due to
integer overflow concerns in xdiff. Vim doesn't specify such a limit
right now, which means it's possible for a user to diff a large file
(1GB+) and trigger these overflow issues.
Add the same size limit (1GB minus 1MB) to Vim and simply throws an
error when Vim encounters files larger than said limit. For now, reuse
the same error message regarding internal diff failures. There is no
need to add the same limit for external diff as it's up to each tool to
error check their input to decide what is appropriate or not.
closes: #18891
Signed-off-by: Yee Cheng Chin <ychin.git@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>