Problem: MS-Windows: MSVC build time can be optimized
Solution: Stop using Powershell, show detected version, read _MSC_VER
and _MSC_FULL_VER in a single cl execution. (Ken Takata)
closes: #15421
Signed-off-by: Ken Takata <kentkt@csc.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: MS-Windows: MSVC Makefile CPU handling can be improved
Solution: Update Makefile and also remove some old code
(Ken Takata)
* The variable `ASSEMBLY_ARCHITECTURE` was originally used to generate
the manifest file. However, this was removed in v7.0.198. Remove
`ASSEMBLY_ARCHITECTURE` and use `CPU` instead.
* `/arch:AVX512` is available starting from Visual C++ 2017.
* ARM64 was not considered when validating CPUNR.
Skip the validation for ARM64 for now.
* Remove old code for VC6/7 and Win9x.
closes: #15422
Signed-off-by: Ken Takata <kentkt@csc.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: filetype: goaccess config file not recognized
Solution: detect 'goaccess.conf' as goaccess filetype, also
include a basic syntax and ftplugin (Adam Monsen)
Add syntax highlighting for GoAccess configuration file.
GoAccess is a real-time web log analyzer and interactive viewer that
runs in a terminal in *nix systems or through your browser.
GoAccess home page: https://goaccess.iocloses: #15414
Signed-off-by: Adam Monsen <haircut@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: completion does not respect completeslash with fuzzy
(egesip)
Solution: Change path separator on Windows, depending on 'completeslash'
option value (glepnir)
fixes: #15392closes: #15418
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: too many strlen() calls in syntax.c
Solution: refactor code to reduce the number or strlen() calls,
get rid of un-used SYN_NAMELEN macro
(John Marriott)
closes: #15368
Signed-off-by: John Marriott <basilisk@internode.on.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: ex: trailing dot is optional for :g and :insert/:append
Solution: don't break out early, when the next command is empty.
(Mohamed Akram)
The terminating period is optional for the last command in a global
command list.
closes: #15407
Signed-off-by: Mohamed Akram <mohd.akram@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Coverity warning in cstrncmp()
(after v9.1.0645)
Solution: Change the type of n2 to int.
(zeertzjq)
________________________________________________________________________________________________________
*** CID 1615684: Integer handling issues (INTEGER_OVERFLOW)
/src/regexp.c: 1757 in cstrncmp()
1751 n1 -= mb_ptr2len(s1);
1752 MB_PTR_ADV(p);
1753 n2++;
1754 }
1755 // count the number of bytes to advance the same number of chars for s2
1756 p = s2;
>>> CID 1615684: Integer handling issues (INTEGER_OVERFLOW)
>>> Expression "n2--", which is equal to 18446744073709551615, where "n2" is known to be equal to 0, underflows the type that receives it, an unsigned integer 64 bits wide.
1757 while (n2-- > 0 && *p != NUL)
1758 MB_PTR_ADV(p);
1759
1760 n2 = p - s2;
1761
1762 result = MB_STRNICMP2(s1, s2, *n, n2);
closes: #15409
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Wrong comment for "len" argument of call_simple_func().
Solution: Remove the "or -1 to use strlen()". Also change its type to
size_t to remove one cast. (zeertzjq)
closes: #15410
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: [security] double-free in dialog_changed()
(SuyueGuo)
Solution: Only clear pointer b_sfname pointer, if it is different
than the b_ffname pointer. Don't try to free b_fname,
set it to NULL instead.
fixes: #15403
Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-46pw-v7qw-xc2f
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: [security] use-after-free in tagstack_clear_entry
(Suyue Guo )
Solution: Instead of manually calling vim_free() on each of the tagstack
entries, let's use tagstack_clear_entry(), which will
also free the stack, but using the VIM_CLEAR macro,
which prevents a use-after-free by setting those pointers
to NULL
This addresses CVE-2024-41957
Github advisory:
https://github.com/vim/vim/security/advisories/GHSA-f9cr-gv85-hcr4
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Vim9: imported function may not be found
Solution: Try to find the function by name (Ernie Rael)
fixes: #15381closes: #15382
Signed-off-by: Ernie Rael <errael@raelity.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: regex: wrong match when searching multi-byte char
case-insensitive (diffsetter)
Solution: Apply proper case-folding for characters and search-string
This patch does the following 4 things:
1) When the regexp engine compares two utf-8 codepoints case
insensitive it may match an adjacent character, because it assumes
it can step over as many bytes as the pattern contains.
This however is not necessarily true because of case-folding, a
multi-byte UTF-8 character can be considered equal to some
single-byte value.
Let's consider the pattern 'ſ' and the string 's'. When comparing and
ignoring case, the single character 's' matches, and since it matches
Vim will try to step over the match (by the amount of bytes of the
pattern), assuming that since it matches, the length of both strings is
the same.
However in that case, it should only step over the single byte value
's' by 1 byte and try to start matching after it again. So for the
backtracking engine we need to ensure:
* we try to match the correct length for the pattern and the text
* in case of a match, we step over it correctly
There is one tricky thing for the backtracing engine. We also need to
calculate correctly the number of bytes to compare the 2 different
utf-8 strings s1 and s2. So we will count the number of characters in
s1 that the byte len specified. Then we count the number of bytes to
step over the same number of characters in string s2 and then we can
correctly compare the 2 utf-8 strings.
2) A similar thing can happen for the NFA engine, when skipping to the
next character to test for a match. We are skipping over the regstart
pointer, however we do not consider the case that because of
case-folding we may need to adjust the number of bytes to skip over.
So this needs to be adjusted in find_match_text() as well.
3) A related issue turned out, when prog->match_text is actually empty.
In that case we should try to find the next match and skip this
condition.
4) When comparing characters using collections, we must also apply case
folding to each character in the collection and not just to the
current character from the search string. This doesn't apply to the
NFA engine, because internally it converts collections to branches
[abc] -> a\|b\|c
fixes: #14294closes: #14756
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: terminal: cursor may end up on invalid position after reducing
the scrollback lines (user202729)
Solution: After reducing the scrollback size, check the cursor position,
making sure it does not end up on an invalid line
fixes: #15351
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Check that mapping rhs starts with lhs doesn't work if lhs is
not simplified.
Solution: Keep track of the mapblock containing the alternative lhs and
also compare with it (zeertzjq).
fixes: #15376closes: #15384
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: MS-Windows: OLE enabled in console version, may cause hang
(Linda_pp)
Solution: Disable OLE for console version (Ken Takata)
If VIMDLL was enabled, a message box for registering OLE might be shown
even if Vim was executed in a console. (See #15372)
Enabling OLE in a console is not so useful. Disable it.
fixes: #15372closes: #15385
Signed-off-by: Ken Takata <kentkt@csc.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Mingw: Makefile can be improved
Solution: Reduce nesting level, directly check if the '-Wl,--entry'
option is required (Ken Takata)
closes: #15386
Signed-off-by: Ken Takata <kentkt@csc.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: channel timeout may wrap around
Solution: Correct timeout calculation when GetTickCount() wraps around
(Ken Takata)
closes: #15390
Signed-off-by: Ken Takata <kentkt@csc.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: E1510 may happen when formatting a message
(after 9.1.0181).
Solution: Only give E1510 when using typval. (zeertzjq)
closes: #15391
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: MS-Windows: Style issues in MSVC Makefile
Solution: Fix style issues, simplify logic
(Ken Takata)
* Add space around the operators for consistency.
* Remove unnecessary ren command. Use the /Fe option to create
install.exe directly.
* Remove unnecessary mkdir auto command. src/auto should always exist.
closes: #15389
Signed-off-by: Ken Takata <kentkt@csc.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: filetype: SuperHTML template files not recognized
Solution: Update the filetype detection code to detect '*.shtml' either
as HTML (Server Side Includes) or SuperHTML (template files)
(EliSauder)
related: #15355
related: #15367
Signed-off-by: EliSauder <24995216+EliSauder@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Ctrl-P not working by default
(Jesse Pavel, after v9.1.0598)
Solution: Revert part of v9.1.0598 and set cur_match_pos
correctly according to compl_dir_forward()
fixes: #15370closes: #15379
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: wrong completion list displayed with non-existing dir + fuzzy
completion (kawarimidoll)
Solution: clear list of matches, if leader did not use fuzzy match
(glepnir)
fixes: #15357closes: #15365
Signed-off-by: glepnir <glephunter@gmail.com>
Problem: MS-Windows: build fails with VIMDLL and mzscheme
Solution: define scheme_register_tls_space() inside gvim.exe
and refer to it from the dll (Ken Takata).
`scheme_register_tls_space()` doesn't support a thread-local variable in
a DLL:
https://docs.racket-lang.org/inside/im_memoryalloc.html#%28cpp._scheme_register_tls_space%29closes: #15363
Signed-off-by: Ken Takata <kentkt@csc.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Rename of pum hl_group is incomplete in source.
Solution: Also rename the test function. Rename to user_hlattr in code
to avoid confusion with pum_extra. Add test with matched text
highlighting (zeertzjq).
closes: #15348
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: MinGW: coverage files are not cleaned up
Solution: Adjust clean rule to remove the coverage files
(Ken Takata)
closes: #15361
Signed-off-by: Ken Takata <kentkt@csc.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: MinGW: build-error when COVERAGE is enabled
(after v9.1.0621)
Solution: Fix regressions in v9.1.0621 and v9.1.0622
(Ken Takata)
* Fix build error when COVERAGE=yes.
* Fix if_lua with USE_GC_SECTIONS=yes.
related: #15361
Signed-off-by: Ken Takata <kentkt@csc.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Vim9: need more tests with null objects
(after v9.1.0620)
Solution: add one more test with null_object
(Ernie Rael)
closes: #15360
Signed-off-by: Ernie Rael <errael@raelity.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: test output all translated messages for all
translations
Solution: Redirect the output of check.vim to /dev/null, it's not that
useful.
closes: #15354
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: ex command modifiers are not found
(Ingo Karkat, after v9.1.0352)
Solution: partly revert patch v9.1.0352, ignore :{ and :}
when expanding ex commands
The issue is, that the :keepmarks command can be abbreviated to :kee or
:keep or :keepm but not to e.g. :ke (because that would be the :exe
command :k with register e).
This basically means, we need `:kee` sorted before `:keepalt` but at the
same time `:keepmarks` sorted after the `:keepalt` command in the
cmdmod_info_tab table. Due to this, the binary search may not work
correctly, so let's revert that part of patch v9.1.0352.
fixes: #15305closes: #15336
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Mingw: warnings when trying to delete non-existing files
Solution: Use "rm -f" instead of "rm" to suppress errors for
non-existing files (Ken Takata)
closes: #15350
Signed-off-by: Ken Takata <kentkt@csc.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: MS-Windows: mingw-build can be optimized
Solution: use --gc-sections to reduce the size of the executable
(Ken Takata)
Use the --gc-sections linker option and the -ffunction-sections compiler
option to reduce the size of the executable files. To make these work,
the -fno-asynchronous-unwind-tables compiler option is also needed.
This is enabled by default and can be disabled by `USE_GC_SECTIONS=no`.
Note: A similar feature has been already used in MSVC. (The /OPT linker
option.)
related: #15350
Signed-off-by: Ken Takata <kentkt@csc.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: MS-Windows: startup code can be improved
Solution: Re-work and optimize win32 startup code
(Ken Takata)
* Revise the code and reduce #ifdefs.
* For VIMDLL, stop using the default CRT startup code to reduce the file
size.
The file size becomes ~130 KB -> ~34 KB on MSVC.
* Update comments. Make them consistent between os_w32dll.c and
os_w32exe.c.
closes: #15352
Signed-off-by: Ken Takata <kentkt@csc.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: cannot mark deprecated attributes in completion menu
Solution: add hl_group to the Dictionary of supported completion fields
(glepnir)
closes: #15314
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Cursor moves beyond start of a folded range at the end of a buffer.
Solution: Move cursor to start of fold when going beyond end of buffer.
Check that cursor moved to detect FAIL in outer cursor function.
(Luuk van Baal)
closes: #15344
Signed-off-by: Luuk van Baal <luukvbaal@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: filetype: Make syntax highlighting off for MS Makefiles
Solution: Try to detect MS Makefiles and adjust syntax rules to it.
(Ken Takata)
Highlighting of variable expansion in Microsoft Makefile can be broken.
E.g.:
2979cfc262/src/Make_mvc.mak (L1331)
Don't use backslash as escape characters if `make_microsoft` is set.
Also fix that `make_no_comments` was not considered if `make_microsoft`
was set.
Also add description for `make_microsoft` and `make_no_comments` to the
documentation and include a very simple filetype test
closes: #15341
Signed-off-by: Christian Brabandt <cb@256bit.org>
Signed-off-by: Ken Takata <kentkt@csc.jp>
Problem: Unnecessary STRLEN() in make_percent_swname()
Solution: Pass the end of "dir" to make_percent_swname()
(zeertzjq)
closes: #15340
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: termdebug test may fail and leave temp file around
(Dominique Pellé)
Solution: only run balloon_show() if the function exists, validate
termdebug is running using the g: termdebug_is_running var,
use defer to delete temporary files
fixes: #15334
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: ambiguous mappings not correctly resolved with modifyOtherKeys
Solution: Check for termcode when an upper case mapping is received and
does not match (Oleg Goncharov)
Fix for mapping processing when capital leters are represented with terminal codes.
Problem: there are two mappings and
1) the first mapping is substring of the second,
2) the first non-matching letter is capital,
3) capital letters are represented with termcodes "ESC[27;2;<ascii code>~" in given system
then first mapping is applied instead of second.
Example:
:map B b
:map BBB blimp!
and then
BBB -> bbb
instead of
BBB -> blimp!
Solution: force termcodes check if capital letter does not match.
closes: #15251
Signed-off-by: Oleg Goncharov <goncharovoi@yandex.ru>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: filetype: OpenGL Shading Language files are not detected
Solution: detect various file extensions as GLSL filetype, include
indent and syntax script, do no longer recognize '*.comp'
as Mason filetype (Gregory Anders)
closes: #15317
Signed-off-by: Gregory Anders <greg@gpanders.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: outdated comments in Makefile
Solution: update outdated comments, update rule for vimtags
(Shane Harper)
related: commit b81109192f
Here are the changes and the reasons for them:
- Delete the comment preceding the assignment to VIMPROG. Since b81109192f
there's no need for VIMPROG to be set to something else when this is executed
from src/Makefile. (The comment was wrong anyway; VIMPROG was being set to
"$$BUILD_DIR/$(VIMTARGET)".)
```
# Set to $(VIMTARGET) when executed from src/Makefile.
VIMPROG = ../../src/vim
```
- Delete "`and installed`" in the following comment; The vimtags rule doesn't
require that Vim has been installed.
```
# Use Vim to generate the tags file. Can only be used when Vim has been
# compiled and installed. Supports multiple languages.
vimtags: $(DOCS)
```
- With commit b81109192f there is no longer a need to set VIMPROG here:
```
-@BUILD_DIR="`pwd`"; cd $(HELPSOURCE); if test -z "$(CROSS_COMPILING)"; then \
$(MAKE) VIMPROG="$$BUILD_DIR/$(VIMTARGET)" vimtags; fi
```
The new code below will use the same vim executable as the old code:
```
-@cd $(HELPSOURCE); if test -z "$(CROSS_COMPILING)"; then \
$(MAKE) vimtags; fi
```
- Delete the following comment which was related to setting VIMPROG as it no longer has any value:
```
# We can assume Vim was build, but it may not have been installed,
# thus use the executable in the current directory.
```
Note: this comment used to be (unnecessarily) echoed to the terminal (because
it was indented) when making installrtbase.
closes: #15320
Signed-off-by: Shane Harper <shane@shaneharper.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>