This is the command invoked repeatedly to make the changes:
:%s/^\(.*\)|\%(\*\(\d\+\)\)\?$\n\1|\%(\*\(\d\+\)\)\?$/\=submatch(1)..'|*'..(max([str2nr(submatch(2)),1])+max([str2nr(submatch(3)),1]))/g
Problem: [security] use-after-free with wildmenu
Solution: properly clean up the wildmenu when exiting
Fix wildchar/wildmenu/pum memory corruption with special wildchar's
Currently, using `wildchar=<Esc>` or `wildchar=<C-\>` can lead to a
memory corruption if using wildmenu+pum, or wrong states if only using
wildmenu. This is due to the code only using one single place inside the
cmdline process loop to perform wild menu clean up (by checking
`end_wildmenu`) but there are other odd situations where the loop could
have exited and we need a post-loop clean up just to be sure. If the
clean up was not done you would have a stale popup menu referring to
invalid memory, or if not using popup menu, incorrect status line (if
`laststatus=0`).
For example, if you hit `<Esc>` two times when it's wildchar, there's a
hard-coded behavior to exit command-line as a failsafe for user, and if
you hit `<C-\><C-\><C-N>` it will also exit command-line, but the clean
up code would not have hit because of specialized `<C-\>` handling.
Fix Ctrl-E / Ctrl-Y to not cancel/accept wildmenu if they are also
used for 'wildchar'/'wildcharm'. Currently they don't behave properly,
and also have potentially memory unsafe behavior as the logic is
currently not accounting for this situation and try to do both.
(Previous patch that addressed this: vim/vim#11677)
Also, correctly document Escape key behavior (double-hit it to escape)
in wildchar docs as it's previously undocumented.
In addition, block known invalid chars to be set in `wildchar` option,
such as Ctrl-C and `<CR>`. This is just to make it clear to the user
they shouldn't be set, and is not required for this bug fix.
closes: vim/vim#133618f4fb007e4
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
Problem:
NVIM_APPNAME does not allow path separators in the name, so relative
paths can't be used:
NVIM_APPNAME="neovim-configs/first-config" nvim
NVIM_APPNAME="neovim-configs/second-config" nvim
Solution:
Let NVIM_APPNAME be a relative path. Absolute paths are not supported.
fix#23056fix#24966
Problem: Vim9: builtin function arguments not checked at compile time.
Solution: Add more type checks. (Yegappan Lakshmanan, closesvim/vim#8539)
5b73992d8f
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
we cannot remove 'paste'. It is very common in plugins and configs.
'pastetoggle' can and should be removed though, it's a total waste of everyone's time because it generates bug reports and doesn't work well, and is useless because bracketed-paste works better.
This commit implements the ability to control all of the XDG paths
Neovim should use. This is done by setting an environment variable named
NVIM_APPNAME. For example, setting $NVIM_APPNAME makes Neovim look for
its configuration directory in $XDG_CONFIG_HOME/$NVIM_APPNAME instead of
$XDG_CONFIG_HOME/nvim.
If NVIM_APPNAME is not set or is an empty string, "nvim" will be used as
default.
The usecase for this feature is to enable an easy way to switch from
configuration to configuration. One might argue that the various $XDG
environment variables can already be used for this usecase. However,
setting $XDG environment variables also affects tools spawned by Neovim.
For example, while setting $XDG_CONFIG_HOME will enable Neovim to use a
different configuration directory, it will also prevent Git from finding
its "default" configuration.
Closes https://github.com/neovim/neovim/issues/21691
Problem:
Failing Windows CI:
FAILED test/functional\options\defaults_spec.lua @ 361: XDG defaults with too long XDG variables are correctly set
test\helpers.lua:134: Pattern "Failed to start server: no such file or directory: /X/X/X" not found in log (last 10 lines): Xtest-defaults-log:
FAILED test/functional\options\defaults_spec.lua @ 435: XDG defaults with XDG variables that can be expanded are not expanded
test\helpers.lua:134: Pattern "Failed to start server: no such file or directory: %$XDG_RUNTIME_DIR%/" not found in log (last 10 lines): Xtest-defaults-log:
Solution:
The assert_log() statements are not relevant on Windows, because there
XDG_RUNTIME_DIR is not used for creating servers, it uses \\.pipe\….
Problem:
Tests that _intentionally_ fail certain conditions cause noise in
$NVIM_LOG_FILE:
$NVIM_LOG_FILE: /home/runner/work/neovim/neovim/build/.nvimlog
(last 100 lines)
WRN 2023-01-16T18:26:27.673 T599.7799.0 unsubscribe:519: RPC: ch 1: tried to unsubscribe unknown event 'doesnotexist'
WRN 2023-01-16T18:29:00.557 ?.11151 server_start:163: Failed to start server: no such file or directory: /X/X/X/...
WRN 2023-01-16T18:33:07.269 127.0.0.1:12345 server_start:163: Failed to start server: address already in use: 127.0.0.1
...
-- Output to stderr:
module 'vim.shared' not found:
no field package.preload['vim.shared']
no file './vim/shared.lua'
no file '/home/runner/nvim-deps/usr/share/lua/5.1/vim/shared.lua'
no file '/home/runner/nvim-deps/usr/share/lua/5.1/vim/shared/init.lua'
no file '/home/runner/nvim-deps/usr/lib/lua/5.1/vim/shared.lua'
no file '/home/runner/nvim-deps/usr/lib/lua/5.1/vim/shared/init.lua'
no file './vim/shared.so'
...
E970: Failed to initialize builtin lua modules
Solution:
- Log to a private $NVIM_LOG_FILE in tests that intentionally fail and
cause ERR log messages.
- Assert that the expected messages are actually logged.
Extend the capabilities of is_os to detect more platforms such as
freebsd and openbsd. Also remove `iswin()` helper function as it can be
replaced by `is_os("win")`.
Add 'mousescroll' option to control how many lines to scroll by when a
mouse wheel keycode is received. The mousescroll option controls both
horizontal and vertical scrolling. The option is a string in the format:
set mousescroll=direction:count,direction:count
Where direction is either "ver" or "hor", and count is a non negative
integer. If a direction is omitted, a default value is used. The default
values remain unchanged, that is 3 for vertical scrolling, and 6 for
horizontal scrolling. As such, the mousescroll default is "ver:3,hor:6".
Add mousescroll documentation
- Add option documentation in options.txt
- Add brief summary in quickref.txt
Update :help scroll-mouse-wheel
- Mention mousescroll option as a means of controlling scrolling.
- Remove obsolete suggestion to map scroll wheel keys to <C-U> to
scroll by a single line -- users should prefer the mousescroll option.
- Add some information about the consequences of remapping scroll wheel
keys (they lose their magic ability to affect inactive windows).
Update :help vim-differences
- Add brief mousescroll summary under Options
Add mousescroll tests
- Test option validation
- Test default mousescroll value and behavior
- Test fallback to default values
- Test mouse vertical and horizontal scrolling in normal mode
- Test mouse vertical and horizontal scrolling in insert mode
Problem:
- Since c57f6b28d7#8519, sockets are created in ~/.local/… but XDG
spec says: "XDG_RUNTIME_DIR: Must be on the local filesystem", which
implies that XDG_STATE_DIR is potentially non-local.
- Not easy to inspect Nvim-created temp files (for debugging etc).
Solution:
- Store sockets in stdpath('run') ($XDG_RUNTIME_DIR).
- Establish "/tmp/nvim.user/" as the tempdir root shared by all Nvims.
- Make ok() actually useful.
- Introduce assert_nolog().
closes#3517closes#17093
Problem: Modifiers not simplified when timed out or using feedkeys() with
'n" flag.
Solution: Adjust how mapped flag and timeout are used. (closesvim/vim#10305)
68a573ce2b
Problem: 'listchars' should be window-local.
Solution: Make 'listchars' global-local. (Yegappan Lakshmanan, Marco Hinz,
closesvim/vim#5206, closesvim/vim#7850)
eed9d46293
Nvim already has this feature, but it implements :set listchars the same
as :setglobal listchars, which is incorrect. Vim's implementation of
:set listchars is correct: using :set listchars clears local value.
Copy the behavior of 'undodir' and create the last specified directory
in the 'backupdir' option if it doesn't exist.
Use trailing slashes for 'backupdir' as well as 'viewdir' and 'undodir'
by default. Note that 'undodir' always behaves as though it has the
trailing slashes, regardless of whether or not they are present. They
are added to the default option value to minimize surprise.
The '.' value in 'backupdir' is kept because the default behavior for
backups is solely to have a backup if the save of the main file to disk
fails. As soon as that save is completed the backup file is removed, so
generally there is no need to put them in a central location.
Co-authored by: murphy66 <murphy66@gmail.com>
while there is some controversy, stdpath('cache') looks like a better fit for logs than stdpath('data'): you can remove logs without preventing nvim to work which fits the XDG_CACHE_HOME definition of `user specific non-essential data files`.
- Windows environment variables are semicolon-separated, but some logic
was assuming colon (:). This broke initialization and parsing of
XDG_CONFIG_DIRS, XDG_DATA_DIRS, 'runtimepath', stdpath(), etc.
- test/defaults_spec: enable tests on Windows
ref #12793
Problem: 'shortmess' flag "n" not used in two places.
Solution: Make use of the "n" flag consistent. (Nick Jensen, closesvim/vim#6245,
closesvim/vim#6244)
722e505d1a
These options were previously global. A global-local window option
behaves closer to a global option "per default" (i e with :set),
but still supports local behavior via :setl
Also this restores back-compat for nvim_set_option("fcs", ...)
which are currently broken on 0.4.x but worked in earlier versions