Problem: We use `void *` for option default values, which is confusing and can cause problems with type-correctness. It also doesn't accomodate for multitype options. On top of that, it also leads to default boolean option values not behaving correctly on big endian systems.
Solution: Use `OptVal` for option default values.
BREAKING CHANGE:
- `:set {option}<` removes the local value for all global-local options instead of just string global-local options.
- `:setlocal {option}<` copies the global value to the local value for number and boolean global-local options instead of removing the local value.
Problem: mapset() may remove unrelated mapping whose {rhs} matches the
restored mapping's {lhs}.
Solution: only match by {lhs} when unmapping for mapset() (zeertzjq).
closes: vim/vim#15935fdf135a052
Problem: tests: no error check when setting global 'briopt'
Solution: also parse and check global 'briopt' value (Milly)
closes: vim/vim#15911b38700ac81
Co-authored-by: Milly <milly.ca@gmail.com>
Problem: tests: no error check when setting global 'cc'
Solution: also parse and check global 'cc' value (Milly)
closes: vim/vim#15914a441a3eaab
Co-authored-by: Milly <milly.ca@gmail.com>
Problem: tests: no error check when setting global 'isk'
Solution: also parse and check global 'isk' value (Milly)
closes: vim/vim#159155e7a6a4a10
Co-authored-by: Milly <milly.ca@gmail.com>
Problem: tests: no error check when setting global 'fdm' to empty value
Solution: Also check global 'fdm' value for being empty (Milly).
closes: vim/vim#15916142cad1f88
Co-authored-by: Milly <milly.ca@gmail.com>
Problem: tests: minor issues in gen_opt_test.vim
Solution: fix restore value for 'undolevels', fix comment, fix
wrong cpo value, add equality test for global-local options on
switchback (Milly).
closes: vim/vim#15913231480f975
Cherry-pick gen_opt_test.vim change from patch 9.1.0807.
Co-authored-by: Milly <milly.ca@gmail.com>
Problem: testing of options can be further improved
Solution: split the generated option test into test_options_all.vim,
add more test cases, save and restore values, fix use-after-free
closes: vim/vim#158946eca04e9f1
Co-authored-by: Milly <milly.ca@gmail.com>
Problem: tests: tests may fail on Windows environment
Solution: use shellcmdflag=/D to skip executing autorun from
the registry (Milly)
closes: vim/vim#159004f5681dbdf
Cherry-pick Test_cursorhold_insert_with_timer_interrupt() change from
patch 8.2.1836.
Co-authored-by: Milly <milly.ca@gmail.com>
Problem: tests: Test_set_values() is not comprehensive enough
Solution: Add a lot more test cases (Milly)
closes: vim/vim#15892cc15bbcbc4
Co-authored-by: Milly <milly.ca@gmail.com>
Problem: Insufficient test coverage for validation of option values.
Solution: Port Vim's gen_opt_test.vim and make it work with Nvim.
vim-patch:9.1.0760: tests: no error reported, if gen_opt_test.vim fails
vim-patch:9.1.0791: tests: errors in gen_opt_test.vim are not shown
Problem: tests: ':resize + 5' has invalid space after '+'
Solution: Correct the test (Milly)
closes: vim/vim#15884c0cba184f5
Co-authored-by: Milly <milly.ca@gmail.com>
Problem: tests: quickfix update test does not test location list
(after: v9.1.0.785)
Solution: update Test_quickfix_buffer_contents to test with location
lists (Yegappan Lakshmanan)
closes: vim/vim#158796a1deaf5ad
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Problem: cannot preserve error position when setting quickfix lists
Solution: Add the 'u' action for setqflist()/setloclist() and try
to keep the closes target position (Jeremy Fleischman)
fixes: vim/vim#15839closes: vim/vim#1584127fbf6e5e8
Co-authored-by: Jeremy Fleischman <jeremyfleischman@gmail.com>
Problem: tests: using wrong neomuttlog file name
Solution: use correct file name
related: vim/vim#158580c59c30271
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: filetype: lf config files are not recognized
Solution: detect lfrc files as lf filetype, include a syntax
script for lf files (Andis Spriņķis).
References:
- https://github.com/gokcehan/lfcloses: vim/vim#158590f146b7925
Co-authored-by: Andis Spriņķis <spr.andis@protonmail.com>
Problem: Simplify() does not remove slashes from "///path".
Solution: Reduce > 2 slashes to one. (closesvim/vim#6263)
fdcbe3c3fe
Omit Test_readdirex() change: changed again in patch 9.0.0323.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: tests: not enough tests for setting options
Solution: Add more comprehensive tests to test_options (Milly).
closes: vim/vim#15856484facebe4
Restore behavior of &l:option for unset local boolean options that was
accidentally changed in #26429.
Co-authored-by: Milly <milly.ca@gmail.com>
Problem: filetype: Some upstream php files are not recognized
Solution: Detect more config files from the PHP source
distribution as filetype ini (nisbet-hubbard).
closes: vim/vim#15840367499c5c3
Co-authored-by: nisbet-hubbard <87453615+nisbet-hubbard@users.noreply.github.com>
Problem: test_strftime may fail because of missing TZ data
Solution: Use GMT offsets to validate timezone differences (James McCoy)
Some systems only provide timezones that follow the geographical region
naming (e.g. America/New_York) by default and require an additional
install for other names (like EST).
The GMT+<offset> format must always be honored, so use that to generate
distinct data for the test.
closes: vim/vim#15848ea997edc7a
Co-authored-by: James McCoy <jamessan@jamessan.com>
Problem: filetype: some Apache files are not recognized
Solution: Detect more config files from the Apache source
distribution as filetype apache (nisbet-hubbard)
closes: vim/vim#15810e58e9015cc
Co-authored-by: nisbet-hubbard <87453615+nisbet-hubbard@users.noreply.github.com>
Problem: Currently completion attribute hl_group is combined with
all items, which is redundant and confusing with kind_hlgroup
Solution: Renamed to abbr_hlgroup and combine it only with the abbr item
(glepnir).
closes: vim/vim#158180fe17f8ffb
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: current command completion is a bit limited
Solution: Add the shellcmdline completion type and getmdcomplpat()
function (Ruslan Russkikh).
closes: vim/vim#158230407d621bb
Co-authored-by: Ruslan Russkikh <dvrussk@yandex.ru>
Problem: A cmdlen == 0 condition is always true as ccline.cmdlen == 0
was already checked above (after v9.1.0766).
Solution: Remove the condition and the variable.
(zeertzjq)
closes: vim/vim#15830c9aa6e4f2a
Problem: No test for patches 6.2.418 and 7.3.489
Solution: Add a test. Fix some whitespace problems in test_mapping.vim.
Document the behavior (zeertzjq).
closes: vim/vim#158155df3cb2898
Problem: [security]: use-after-free when closing a buffer
Solution: When splitting the window and editing a new buffer,
check whether the newly to be edited buffer has been marked
for deletion and abort in this case
Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-rj48-v4mq-j4vg51b62387be
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: :cd completion fails on Windows with backslash in path
Solution: switch no_bslash argument to FALSE in file_pat_to_reg_pat()
Note: only fixes the problem on Windows. For Unix, we still need to
escape backslashes since those are taken as regex atoms (and could be
invalid regex atoms).
fixes: vim/vim#15643closes: vim/vim#158081a31c430bb
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: Cannot build against Ruby 33 dynamically
Solution: Ruby 33 removed transient heap, so do not use
rb_ary_transient anymore, NoMethodError format changed,
so update test for expected error message
(Isao Sato)
- ruby-3.3 removed transient heap for ruby/dyn
when +ruby/dyn with ruby-3.3 do command :ruby, E448 occur.
ruby-3.3 has no transient heap anymore, so disable rb_ary_transient etc.
$ LC_ALL=C VIMRUNTIME=runtime ./src/vim -u NONE -c 'ruby puts RUBY_VERSION'
"=> Error detected while processing command line:
"=> E448: Could not load library function rb_ary_detransient
"=> E266: Sorry, this command is disabled, the Ruby library could not be
loaded.
- ruby-3.3 changed NoMethodError format:
$ rvm 3.2.2, 3.3.0-rc1 do ruby -e 'begin; nil.name; rescue => e; puts "%s : %s"%[RUBY_VERSION, e.message]; end '
=> 3.2.2 : undefined method `name' for nil:NilClass
=> 3.3.0 : undefined method `name' for nil
so loose pattern in Test_ruby_Vim_buffer_get()
closes: vim/vim#13741443657b32b
Co-authored-by: Isao Sato <svardew@gmail.com>
Problem: screenpos() may return invalid position
after switching buffers (Greg Hurrell)
Solution: reset w_leftcol if wrapping has been set
after copying wrap option
fixes: vim/vim#15792closes: vim/vim#15803b065a10e24
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: quickfix list does not handle hardlinks well
Solution: store original file name with quickfix entry
(Austin Chang)
Quickfix list shows entries with duplicate name if the file is opened
with the path of hard links.
The major cause is that qflist assumed that the filename passed into
`qf_add_entry` matches the filename opened with the buffer.
This patch handles this case by introduce a `qf_fname` into `qfline_S`
structure. It stores the filename from `qf_add_entry` for each quickfix
line.
closes: vim/vim#156872982299699
Co-authored-by: Austin Chang <austin880625@gmail.com>
Problem: fixed order of items in insert-mode completion menu
Solution: Introduce the 'completeitemalign' option with default
value "abbr,kind,menu" (glepnir).
Adding an new option `completeitemalign` abbr is `cia` to custom
the complete-item order in popupmenu.
closes: vim/vim#14006closes: vim/vim#157606a89c94a9e
Problem: Wrong display when typing in diff mode with 'smoothscroll'.
Solution: Use adjust_plines_for_skipcol() (zeertzjq).
closes: vim/vim#1577647f8584a80
Problem: filetype: bun and deno history files not recognized
Solution: detect '.bun_repl_history' and 'deno_history.txt' as
javascript filetype (Wu, Zhenyu)
closes: vim/vim#157618a2aea8a62
Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
Problem: Test_halfpage_longline() fails on large terminals
(lazypingu)
Solution: Use a window with known width (zeertzjq).
fixes: vim/vim#15755closes: vim/vim#15756fa117387ee
Problem: diff mode does not handle overlapping diffs correctly
Solution: correct the logic to handle overlapping blocks
(Yukihiro Nakadaira)
Vim merges overlapped diff blocks and it doesn't work expectedly
in some situation.
closes: vim/vim#1573506fe70c183
Co-authored-by: Yukihiro Nakadaira <yukihiro.nakadaira@gmail.com>
Problem: getcmdprompt() implementation can be improved
Solution: Improve and simplify it (h-east)
closes: vim/vim#1574325876a6cdd
Co-authored-by: h-east <h.east.727@gmail.com>
Problem: No way to get prompt for input()/confirm()
Solution: add getcmdprompt() function (Shougo Matsushita)
(Shougo Matsushita)
closes: vim/vim#156676908428560
Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Problem: incorrect internal diff with an empty file
Solution: Set pointer to NULL, instead of using an empty line file
(Yukihiro Nakadaira)
When using internal diff, empty file is read as one empty line file.
So result differs from external diff.
closes: vim/vim#15719f1694b439b
Co-authored-by: Yukihiro Nakadaira <yukihiro.nakadaira@gmail.com>
Problem: filetype: salt files are not recognized
Solution: Detect '*.sls' files as filetype salt,
include a syntax script (Gregory Anders)
closes: vim/vim#1568989b9bb4ac8
Co-authored-by: Gregory Anders <greg@gpanders.com>
Problem: inconsistent case sensitive extension matching
Solution: unify case sensitive extension matching (Evgeni Chasnovski).
There are different approaches of how extensions are matched with
respect to case sensitivity. In particular, '\c' flag is used in pattern
whereas in most places case sensitive matching is guarded behind
`has("fname_case")` condition.
Replace all instances of '\c' with an explicit case sensitive pattern
variants guarded by `has("fname_case")`. Strictly speaking, this is a
breaking change because only two (most common and prevailingly tested)
variants are now matched: upper first letter and upper all letters.
closes: vim/vim#1567259b089c9df
Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
Problem: heap-use-after-free in garbage collection with location list
user data.
Solution: Mark user data as in use when no other window is referencing
the location list (zeertzjq)
fixes: neovim/neovim#30371closes: vim/vim#15683be4bd189d2
Problem: Crash with cursor-screenline and narrow window
(elig0n)
Solution: Don't set right_col when width2 is 0 (zeertzjq).
fixes: vim/vim#15677closes: vim/vim#1567859149f0269
Problem: Wrong cursor-screenline when resizing window
Solution: Invalidate saved left_col and right_col when width1 or width2
change.
closes: vim/vim#1567986dc4f8b43
Problem: filetype: swiftinterface files are not recognized
Solution: Detect '*.swiftinterface' files as swift filetype
(LosFarmosCTL)
closes: vim/vim#1565803cac4b70d
Co-authored-by: LosFarmosCTL <80157503+LosFarmosCTL@users.noreply.github.com>
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: vim/vim#15634closes: vim/vim#1563561a6ac4d00
Problem: Resetting cell widths can make 'listchars' or 'fillchars'
invalid.
Solution: Check for conflicts when resetting cell widths (zeertzjq).
closes: vim/vim#1562966f65a46c5
Problem: Newline causes E749 in Ex mode (after 9.1.0573).
Solution: Don't execute empty command followed by a newline.
closes: vim/vim#156142432b4a753
Cherry-pick code change from patch 8.2.3405.
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).
3d5065fc75
Problem: completion is inserted on Enter with "noselect"
(Carman Fu)
Solution: check noselect before update compl_shown_match
(glepnir)
fixes: vim/vim#15526closes: vim/vim#15530753794bae8
Use the grapheme break algorithm from utf8proc to support grapheme
clusters from recent unicode versions.
Handle variant selector VS16 turning some codepoints into double-width
emoji. This means we need to use ptr2cells rather than char2cells when
possible.
Problem: "dvgo" is not always an inclusive motion
(Iain King-Speir)
Solution: initialize the inclusive flag to false
fixes: vim/vim#15580closes: vim/vim#15582f8702aeb8f
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: The matchparen plugin is slow on a long line.
Solution: Don't use a regexp to get char at and before cursor.
(zeertzjq)
Example:
```vim
call setline(1, repeat(' foobar', 100000))
runtime plugin/matchparen.vim
normal! $hhhhhhhh
```
closes: vim/vim#1556881e7513c86
Problem: Wrong patlen value in ex_substitute() (after 9.1.0426).
Solution: Compute patlen after finding end separator.
(zeertzjq)
Add a more explicit test. The test already passes as the only case
where a overlarge patlen value matters was fixed by patch 9.1.0689.
closes: vim/vim#15565d1c8d2de4b
Problem: cannot set special highlight kind in popupmenu
Solution: add kind_hlgroup item to complete function
(glepnir)
closes: vim/vim#1556138f99a1f0d
Co-authored-by: glepnir <glephunter@gmail.com>
Problem: mode() returns wrong value with <Cmd> mapping
Solution: Change decision priority of VIsual_active and move
visual mode a bit further down (kuuote)
closes: vim/vim#155330fd1cb1b1f
Co-authored-by: kuuote <znmxodq1@gmail.com>
Problem: zip-plugin has problems with special characters
(user202729)
Solution: escape '*?[\' on Unix and handle those chars
a bit differently on MS-Windows, add a test, check
before overwriting files
runtime(zip): small fixes for zip plugin
This does the following:
- verify the unzip plugin is executable when loading the autoload plugin
- handle extracting file names with '[*?\' in its name correctly by
escaping those characters for the unzip command (and handle those
characters a bit differently on MS-Windows, since the quoting is different)
- verify, that the extract plugin is not overwriting a file (could cause
a hang, because unzip asking for confirmation)
- add a test zip file which contains those special file names
fixes: vim/vim#15505closes: vim/vim#155197790ea0c68
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: :keeppatterns does not retain the substitute pattern
for a :s command
Solution: preserve the last substitute pattern when used with the
:keeppatterns command modifier (Gregory Anders)
closes: vim/vim#154973b59be4ed8
Co-authored-by: Gregory Anders <greg@gpanders.com>
Problem: [security]: use-after-free in alist_add()
(SuyueGuo)
Solution: Lock the current window, so that the reference to
the argument list remains valid.
This fixes CVE-2024-43374
0a6e57b09b
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: marker folds may get corrupted on undo (Yousef Mohammed)
Solution: when adjusting folds, make sure that line1 is the lower limit
and line2 is the upper line limit. In particular, line2 should
not be able to get smaller than line1.
fixes: vim/vim#15455closes: vim/vim#154668d02e5cf96
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: Some other options reset curswant unnecessarily when set.
(Andrew Haust)
Solution: Don't reset curswant when setting 'comments', 'commentstring'
or 'define' (zeertzjq)
fixes: vim/vim#15462closes: vim/vim#15467b026a293b1
Problem: Renaming a buffer on startup may cause using freed memory.
Solution: Check if the buffer is used in a window. (closesvim/vim#8955)
d3710cf01e
Cherry-pick Test_echo_true_in_cmd() from Vim.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: tests: zip test still resets 'shellslash' option
Solution: Remove resetting the 'shellslash' option, the zip
plugin should now be able to handle this options
closes: vim/vim#1543491efcd115e
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: the zip plugin is not tested.
Solution: include tests (Damien)
closes: vim/vim#15411d7af21e746
Co-authored-by: Damien <141588647+xrandomname@users.noreply.github.com>
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: vim/vim#15403
Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-46pw-v7qw-xc2fb29f4abcd4
Co-authored-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: vim/vim#154140aa65b48fb
Co-authored-by: Adam Monsen <haircut@gmail.com>
Problem: Calling a function from an "expr" option has too much overhead.
Solution: Add call_simple_func() and use it for 'foldexpr'
87b4e5c5db
Cherry-pick a call_func() change from patch 8.2.1343.
Add expr-option-function docs to options.txt.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Vim9: using a script-local function requires using "s:" when
setting 'completefunc'.
Solution: Do not require "s:" in Vim9 script. (closesvim/vim#9796)
1fca5f3e86
vim-patch:8.2.4417: using NULL pointer
Problem: Using NULL pointer.
Solution: Set offset after checking for NULL pointer.
e89bfd212b
Co-authored-by: Bram Moolenaar <Bram@vim.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: vim/vim#154070214680a8e
Co-authored-by: Mohamed Akram <mohd.akram@outlook.com>