Problem: too many strlen() calls in option.c
Solution: refactor the code to reduce the number of strlen() calls
(John Marriott)
closes: #15604
Signed-off-by: John Marriott <basilisk@internode.on.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: not using correct python3 API with dynamic linking
Solution: Use stable IncRef / DecRef in Python 3 dynamic bindings
(Yee Cheng Chin)
Previously, we were using the Py_DECREF macros even when using dynamic
linking of Python 3. This caused issues because Python's headers contain
references to internal APIs like `_Py_Dealloc` and in v8.1.2201 and
v8.2.1225 we simply hacked around the issue by manually copying the
Python header implementation to Vim and linking in the private APIs.
This is fragile and prone to break. In fact, the Py_DECREF
implementation is different in newer versions of Python meaning that
this could potentially cause memory issues.
Instead, simply use the API versions (`Py_DECREF` and `Py_INCREF`) which
are functions exposed by the Python library. They could be slightly
slower since they require a function call instead of a macro, but are
much more reliable and we should only be calling these when the Python
Vim plugins are crossing the language boundary anyway which are always
going to be slow.
Note that this only affects dynamically linked Python builds that are
not using stable ABI.
Also see #15648closes: #15653
Signed-off-by: Yee Cheng Chin <ychin.git@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
By default spell checking is enabled for all text, but adding
`contains=@Spell` to syntax rules restricts spell checking to those
syntax rules. See `:help spell-syntax` for full details.
Variable names and headers are far more likely than comments to contain
spelling errors, so only enable spell checking in comments.
Introduced in https://github.com/xuhdev/syntax-dosini.vim/pull/8
cc @tobinjt
closes: #15655
Signed-off-by: John Tobin <johntobin@johntobin.ie>
Signed-off-by: Hong Xu <hong@topbug.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Originally, `:set completeopt+=fuzzy` did not affect how the candidate
list is collected in default keyword completion. A comment was added to
documentation as part of #14912 to clarify it. #15193 later changed the
fuzzy behavior to now change the candidate collection behavior as well
so the clarification in docs is now wrong. Remove them here.
closes: #15656
Signed-off-by: Yee Cheng Chin <ychin.git@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: filetype: swiftinterface files are not recognized
Solution: Detect '*.swiftinterface' files as swift filetype
(LosFarmosCTL)
closes: #15658
Signed-off-by: LosFarmosCTL <80157503+LosFarmosCTL@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Previously these would be cached in buffer-local variables and
would not change on :compiler pandoc
closes: #15642
Signed-off-by: Konfekt <Konfekt@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Groff MOM (Macros for Manuscripts) is a macro package for the GNU
troff (groff) typesetting system, a light-weight alternative
to LaTeX for professional-quality documents.
closes: #15646
Signed-off-by: Konfekt <Konfekt@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: if_python: link error with python 3.13 and stable ABI
(zdohnal)
Solution: Use the correct stable APIs Py_IncRef and Py_DecRef instead
(Yee Cheng Chin)
This fixes#15460 properly. There was an attempt to fix it in v9.1.0668,
but it did it by manually copy and pasting definitions from Python 3.13
headers, which is problematic as it makes Vim dependent on low-level
implementation details which are subject to change. That change also
pulls in dependencies to private APIs (`_Py_IncRef`) which is a very bad
idea as the next version of Python could very well remove that.
The core issue was simply that `Py_INCREF` and similar functions are not
part of the stable API. We are supposed to be using `Py_IncRef` instead
which performs null-check (similar to `Py_XINCREF`) and is available as
a linkable function. We simply need to call it instead of the macro.
We simply remap `Py_INCREF` (and friends) to the function version in
stable API similar to how we mapped other functions.
related #15460closes: #15648
Signed-off-by: Yee Cheng Chin <ychin.git@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: if_python: dynamic linking fails with python3 >= 3.13
when using non-stable ABI (zdohnal)
Solution: do not try to import the privat python symbol
_PyObject_NextNotImplemented
(Yee Cheng Chin)
Vim is importing a private Python symbol `_PyObject_NextNotImplemented`
because it used to be required as part of the `PyIter_Check()` macro in
an abstraction breaking way. Python eventually fixed the issue and in
3.13 it removed the private symbol export, which broke Vim. Simply
remove importing this private symbol in newer Python versions as it's no
longer needed for PyIter_Check to work.
fixes: #15457closes: #15649
Signed-off-by: Yee Cheng Chin <ychin.git@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: crash with large id in text_prop interface
prop_add()/prop_add_list() (cposture)
Solution: Error out if the id is > INT_MAX or <= INT_MIN
fixes: #15637closes: #15638
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: test_mksession does not consider XDG_CONFIG_HOME
Solution: allow to match $HOME/.vim/ and $HOME/.config/vim for &viewdir
(John M Devin)
closes: #15639
Signed-off-by: John M Devin <john.m.devin@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
GetLatestVimScripts builtin plugin required several fixes:
* Support for the new vimbal `.vmb` extension introduced in
[patch 9.0.1797](f97f6bbf56):
Vimball/Visual Basic filetype detection conflict
* Update the urls from the old `sourceforge.net` to `vim.org`.
The download url was hardcoded and a new variable is introduced.
* Fix `curl` command line option to set a filename (`-O` uses the remote
filename and `-o` specifies a filename).
* Replace windows' command to move files. `REN` can only rename files and
the script actually moves them. My educated guess was that originally
only renaming was necessary. When the script was modified to move
files no change was required on linux because `mv` does both.
* Fix Autoinstall support to check `ftplugins` and `pack-plugins` too
(`pack-plugins` did not exist when the plugin was created).
closes: #15640
Signed-off-by: GuyBrush <miguel.barro@live.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
while at it, also move the note about :wincmd
directly to :h :wincmd, it doesn't seem to belong to the buffer section.
closes: #15636
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Wrong breakindentopt=list:-1 with multibyte chars or TABs in
text matched by 'formatlistpat' (John M Devin)
Solution: Use the width of the match text (zeertzjq)
fixes: #15634closes: #15635
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Resetting cell widths can make 'listchars' or 'fillchars'
invalid.
Solution: Check for conflicts when resetting cell widths (zeertzjq).
closes: #15629
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: hard to guess the Vim Runtime Directory
Solution: Set the $MYVIMDIR environment variable to the users
personal runtime directory (e.g. ~/.vim on Linux)
closes: #15576
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Unnecessary nextcmd NULL checks in parse_command_modifiers().
Solution: Remove them (zeertzjq)
Every place parse_command_modifiers() is called, nextcmd is NULL, and
after it's set to non-NULL the function returns very soon.
Even if one day nextcmd may be non-NULL, the NULL checks may still be
wrong as the correct behavior may be overriding nextcmd.
closes: #15620
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Not correctly parsing color names (chdiza, after v9.1.0709)
Solution: Revert part of the patch that compares the color names and
fall-back to the macro STRICMP
fixes: #15617closes: #15619
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: GuiEnter_Turkish test may fail
Solution: the message will be translated if the Turkish message file is
installed. Use gettext() to get the expected message
(Ken Takata)
closes: #15615
Signed-off-by: Ken Takata <kentkt@csc.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Newline causes E749 in Ex mode (after 9.1.0573).
Solution: Don't execute empty command followed by a newline.
closes: #15614
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: missing dependency of Test_gettext_makefile
Solution: Check that xgettext binary is available, else skip the test
(James McCoy)
closes: #15612
Signed-off-by: James McCoy <jamessan@jamessan.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: test_xxd may file when using different xxd
Solution: Make Test_xxd_color_0 agnostic to xxd's path, similar to
Test_xxd_color_1 by filtering out shell command prompt in
screen dump file (James McCoy)
If an alternative xxd path is provided, e.g., the system installed xxd,
then the screen dump fails due to the difference in path.
From test_xxd.vim:
Found errors in Test_xxd_color2():
Run 1, 15:17:03 - 15:17:04:
command line..script /tmp/autopkgtest-lxc.1auv5tlk/downtmp/autopkgtest_tmp/vim/src/testdir/runtest.vim[607]..function RunTheTest[57]..Test_xxd_color2[36]..VerifyScreenDump line 67: See dump file difference: call term_dumpdiff("testdir/failed/Test_xxd_color_0.dump", "testdir/dumps/Test_xxd_color_0.dump"); difference in line 1: "|$+0&#ffffff0| |/|u|s|r|/|b|i|n|/|x@1|d| |-|R| |n|e|v|e|r| @1|<| |X@1|D|f|i|l|e|_|c|o|l|o|r|s| @33"
related: #15612
Signed-off-by: James McCoy <jamessan@jamessan.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: when a popup window covers the command line,
the command line is not completely cleared on popup_hide()
(yu3s)
Solution: Check if the popup window covers the command line and if it
does, set the clear_cmdline flag.
fixes: #15608closes: #15610
Signed-off-by: Christian Brabandt <cb@256bit.org>
- Match -addr and -keepscript attributes and generate -addr values.
- Match attribute errors where = is specified.
- Highlight attributes with Special like other Ex command options.
- Don't highlight user-specified completion function args.
- Match :delcommand -buffer attribute.
closes: #15586
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: GUIEnter not found in Turkish locale
(James McCoy, after v9.1.0256, the issue was there before,
but v9.1.0256 made it more apparent)
Solution: explicitly compare autocommand events by ASCII value and
ignoring locale, because according to the documentation,
events are case insensitive (:h autocommand-events)
fixes: #15574closes: #15603
Signed-off-by: Christian Brabandt <cb@256bit.org>
Recognize colon-delimited second part of Runas_Spec that specifies
permitted groups, e.g.:
alan ALL = (root, bin : operator, system) ALL
This implementation is sloppy because it accepts any amount of colons
delimiting further Runas_Lists, but for now that's better than bailing
out completely as soon as a colon is encountered (esp. given that the
default sudoers uses these colons, breaking highlighting OOTB).
Also, while at it, make Vim recognize all Tag_Spec items, not just
{,NO}PASSWD
closes: #15607
Signed-off-by: Ivan Shapovalov <intelfx@intelfx.name>
Signed-off-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Window is updated with potentially invalid skipcol in recursive
window update path. I.e. cursor outside of visible range in
large line that does not fit.
Solution: Make sure it is valid (Luuk van Baal).
closes: #15605
Signed-off-by: Luuk van Baal <luukvbaal@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This is used to set the commentstring option.
closes: #15601
Signed-off-by: Christian Brabandt <cb@256bit.org>
Signed-off-by: Marc Jakobi <marc.jakobi@tiko.energy>
Problem: [security]: invalid cursor position may cause a crash
(after v9.1.0038)
Solution: Set cursor to the last character in a line, if it would
otherwise point to beyond the line; no tests added, as it
is unclear how to reproduce this.
Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-4ghr-c62x-cqfh
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: test_gettext fails when using shadow dir
Solution: Link the ru_RU directory into the shadow testdir
(James McCoy)
Link the ru_RU directory into shadow testdir
When the ru_RU locale is present, but the build is using a shadowdir,
then test_gettext_cp1251.vim and test_gettext_utf8.vim fail:
From test_gettext_cp1251.vim:
Executed Test_gettext() in 0.000848 seconds
Executed 1 test in 0.007010 seconds
1 FAILED:
Found errors in Test_gettext():
command line..script /home/runner/work/vim/vim/src/shadow/testdir/runtest.vim[607]..function RunTheTest[57]..Test_gettext line 9: Expected '������: ' but got 'ERROR: '
From test_gettext_utf8.vim:
Executed Test_gettext() in 0.000908 seconds
Executed 1 test in 0.007339 seconds
1 FAILED:
Found errors in Test_gettext():
command line..script /home/runner/work/vim/vim/src/shadow/testdir/runtest.vim[607]..function RunTheTest[57]..Test_gettext line 9: Expected '������: ' but got 'ERROR: '
This is because it's unable to load the translations from the ru_RU test
directory, since it wasn't symlinked into the shadow directory.
closes: #15591
Signed-off-by: James McCoy <jamessan@jamessan.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
The test_gettext* files need specific locales available to exercise
their tests.
related: #15591
Signed-off-by: James McCoy <jamessan@jamessan.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Sorting of fuzzy filename completion is not stable
Solution: Compare indexes when scores are equal. Fix some typos.
(zeertzjq)
closes: #15593
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Match '(,'),'[,'],'{, and '} marks in Ex command ranges.
Thanks to Maxim Kim.
Fixes#15332.
Closes#15337.
Signed-off-by: Maxim Kim <habamax@gmail.com>
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: inserting with a count is inefficient
Solution: Disable calculation of the cursor position and topline, if a
count has been used (Ken Takata)
Optimize insertion when using :normal 10000ix.
This patch optimizes the insertion with a large count (e.g. `:normal
10000ix`).
It seems that calculation of the cursor position for a long line is slow
and it takes O(n^2). Disable the calculation if not needed.
Before:
```
$ time ./vim --clean -c 'normal 10000ix' -cq!
real 0m1.879s
user 0m1.328s
sys 0m0.139s
$ time ./vim --clean -c 'normal 20000ix' -cq!
real 0m5.574s
user 0m5.421s
sys 0m0.093s
$ time ./vim --clean -c 'normal 40000ix' -cq!
real 0m23.588s
user 0m23.187s
sys 0m0.140s
```
After:
```
$ time ./vim --clean -c 'normal 10000ix' -cq!
real 0m0.187s
user 0m0.046s
sys 0m0.093s
$ time ./vim --clean -c 'normal 20000ix' -cq!
real 0m0.217s
user 0m0.046s
sys 0m0.108s
$ time ./vim --clean -c 'normal 40000ix' -cq!
real 0m0.278s
user 0m0.093s
sys 0m0.140s
$ time ./vim --clean -c 'normal 80000ix' -cq!
real 0m0.494s
user 0m0.311s
sys 0m0.140s
$ time ./vim --clean -c 'normal 160000ix' -cq!
real 0m1.302s
user 0m1.140s
sys 0m0.094s
```
closes: #15588
Signed-off-by: K.Takata <kentkt@csc.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: possible crash with 2-byte encoding and glob2regpat()
(after v9.1.0700, v9.1.0702)
Solution: include both bytes for a multi-byte character for an
escaped character
closes: #15590
Signed-off-by: Christian Brabandt <cb@256bit.org>
Improving syntax highlighting by allowing numbers, - and a $ as suffix
in user constants and by allowing hwConstants in If-Then statements
closes: #15059
Signed-off-by: Tom Crecelius <holly@net-eclipse.net>
Signed-off-by: Ola Söder <rolfkopman@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: crash with NFA regex engine when searching for composing chars
(SuyueGuo)
Solution: When there is no composing character, break out of the loop
and check that out1 state is not null
fixes: #15583
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: possible crash with 2byte encoding and glob2regpat()
Solution: Skip over character, if it is multi-byte character
Signed-off-by: Christian Brabandt <cb@256bit.org>