Commit Graph

21952 Commits

Author SHA1 Message Date
Christian Clason
da358d4521 feat(api): support pattern array for exec_autocmds 2022-06-26 13:04:45 +02:00
Christian Clason
9f592780b5
Merge pull request #16271 from 3N4N/fix-15913
fix: make_filter_cmd for powershell as shell
2022-06-25 17:52:39 +02:00
Justin M. Keyes
f977f9445f refactor(tests): introduce testprg()
Also:
- Add a describe('shell :!') section to system_spec.
- Make the test for #16271 work on systems without powershell.
2022-06-25 08:27:17 -07:00
Enan Ajmain
0b9664f524 fix: make_filter_cmd for :! powershell #15913
Problem:
Nvim fails to create tempfile "…/nvim6UJx04/7" when 'shell' is set to
pwsh (PowerShell Core). This breaks filtered shell commands ":{range}!".
With shell set to cmd, it works.

Solution:
PowerShell doesn't use "<" for stdin redirection. Instead, use
"-RedirectStandardInput".

Closes #15913
2022-06-25 07:20:58 -07:00
Christian Clason
b7084fef4c
fix(build): strip trailing newline from variable (#19084)
Problem: #19029 added a new fallback that sets
`$MACOSX_DEPLOYMENT_TARGET` to the local macOS version via `sw_vers`.
However, the output included a newline, which broke the generated Ninja
build script.

Solution: use `OUTPUT_STRIP_TRAILING_WHITESPACE` for `execute_process`.
2022-06-25 13:45:20 +02:00
zeertzjq
a5175fe489
vim-patch:8.2.5022: 'completefunc'/'omnifunc' error does not end completion (#19083)
Problem:    'completefunc'/'omnifunc' error does not end completion.
Solution:   Check if there was an error or exception. (closes vim/vim#10486,
            closes vim/vim#4218)
9bcb9ca9c7
2022-06-25 18:38:35 +08:00
Christian Clason
5c2c88717a
Merge pull request #19029 from carlocab/macos-universal
ci: build universal release on macOS
2022-06-25 12:16:04 +02:00
Axis
ece2960f1b
build(gen_vimdoc): remove needless list creation and unused variable (#19079)
build(gen_vimdoc): remove needless list creation
2022-06-25 18:03:02 +08:00
bfredl
88a5941598
Merge pull request #19041 from lewis6991/globallocal
fix(api): nvim_set_option_value for global-local options
2022-06-25 11:09:55 +02:00
Hazel Weakly
35e89bf903
fix(filetype.lua): always return a string in getlines function (#19080)
This re-introduces the fix that the filetype.lua refactor inadvertently reverted.
The fix ensures that in the case when end_lnum is omitted, a string is always returned.
2022-06-24 19:53:44 +02:00
Carlo Cabrera
d0644fa9bf
ci(release): build a universal binary on macOS
After some tweaks to our dep builds, we can now build a universal binary
for macOS by using `CMAKE_OSX_ARCHITECTURES`. So, let's do that. This
requires a number of additional changes:

1. We need to build on macOS 11, since earlier versions do not support
   building universal (M1 + Intel) binaries.
2. We need to provision a universal `libintl`. The linker will look for
   an ARM64 version of this library when linking the `nvim` binary.

While we're here:
1. Link statically to `libintl`. This allows to to avoid having to do
   any install name rewriting or codesigning to package Neovim.
2. Bump the `MACOSX_DEPLOYMENT_TARGET` to `11`. We're already using a
   `libintl` built by Homebrew (through the pre-installed version of
   `gettext`), and that is built for macOS 11.

In order to ensure we link to `libintl.a` instead of `libintl.dylib`, we
have to make sure that CMake can't find the latter. This ideally should
be a matter of doing `brew unlink gettext`. However, CMake is too adept
at finding things that Homebrew has installed (even when not linked), so
we have to do a bit more than that. This appears in the additional step
ensuring static linkage to `libintl`.

We end up breaking some Homebrew-installed software in the process, and
some of these software is called during our build (e.g. curl, git,
wget). To avoid any adverse effects, let's just uninstall them.
2022-06-25 00:25:05 +08:00
Carlo Cabrera
b70f160414
build(deps): support universal builds on macOS
CMake can handle building universal binaries on macOS using the
`CMAKE_OSX_ARCHITECTURES` variable. Let's pass this variable to the
relevant dep builds. We use the `LIST_SEPARATOR` argument to prevent the
shell from interpreting the `;` that CMake uses as a list separator.

For dependencies that don't build using CMake, we only need to make sure
that the compiler is invoked with the correct `-arch` flags. The
compiler does the rest.

The only exception to this is the LuaJIT build, which we handle
separately as a special case.
2022-06-24 23:43:11 +08:00
Carlo Cabrera
adcaf24f42
build(luajit): support universal builds on macOS
To build universal binaries on macOS, one typically only needs to pass
multiple `-arch` flags to `clang`.

Unfortunately, this strategy causes LuaJIT builds to fail. To work
around this, we build LuaJIT for each requested architecture
individually first and then use `lipo` to package each architecture
slice into a universal binary.

To be able to do this on an Intel macOS host or an M1 macOS host without
a Rosetta installation, we need some special flags in order to tell
LuaJIT that it is cross-compiling for a different target. See [1] for
details.

[1] https://luajit.org/install.html#cross
2022-06-24 23:34:57 +08:00
bfredl
12c62ddea6
Merge pull request #19071 from bfredl/minimap
perf(map): some optimizations when setting mappings
2022-06-24 16:20:13 +02:00
Christian Clason
823d9e0af1
vim-patch:a57b553b4328 (#19076)
Update runtime files
a57b553b43
2022-06-24 14:45:07 +02:00
bfredl
777faa29b3 refactor(map): statically initialize maphash array 2022-06-24 14:40:27 +02:00
bfredl
f3ee62a743 refactor(map): simplify free_all_mem handling 2022-06-24 14:40:09 +02:00
bfredl
a8ecc1ae6d perf(map): avoid extraneous heap allocations when setting mappings
- don't immediately vim_strsave and then xfree a heap buffer.
- allow replace_termcodes to take in a buffer instead of allocating it
- grug! memory allocation bad!
2022-06-24 13:53:42 +02:00
bfredl
614fd3a883 perf(map): visit only one hash bucket instead of all, like an actual hash table 2022-06-24 12:56:24 +02:00
zeertzjq
3a4fa22bad
Merge pull request #19072 from zeertzjq/vim-8.2.4628
vim-patch:8.2.{4628,4895,4977,5146,5154}
2022-06-24 09:04:56 +08:00
zeertzjq
affeb5c6dd vim-patch:8.2.5146: memory leak when substitute expression nests
Problem:    Memory leak when substitute expression nests.
Solution:   Use an array of expression results.
44ddf19ec0

Cherry-pick a comment change from patch 8.2.5057.

N/A patches for version.c:

vim-patch:8.2.5154: still mentioning version8, some cosmetic issues

Problem:    Still mentioning version8, some cosmetic issues.
Solution:   Prefer mentioning version9, cosmetic improvements.
abd56da30b
2022-06-24 07:26:06 +08:00
zeertzjq
589f418fce vim-patch:8.2.4977: memory access error when substitute expression changes window
Problem:    Memory access error when substitute expression changes window.
Solution:   Disallow changing window in substitute expression.
e2bd8600b8

"textwinlock" was renamed back to "textlock" in patch 8.2.5029.
2022-06-24 07:26:06 +08:00
zeertzjq
0cf0be302b vim-patch:8.2.4895: buffer overflow with invalid command with composing chars
Problem:    Buffer overflow with invalid command with composing chars.
Solution:   Check that the whole character fits in the buffer.
d88934406c
2022-06-24 07:26:06 +08:00
zeertzjq
764dc7c383 vim-patch:8.2.4628: not enough testing for 2/3 letter substitute commands
Problem:    Not enough testing for 2/3 letter substitute commands.
Solution:   Add more tests. (Yegappan Lakshmanan, closes vim/vim#10019)
5e877baf87
2022-06-24 07:26:06 +08:00
Justin M. Keyes
a9cb0b8a5a
fix(tests): remove misleading $TEST_PATH segment #19050
Problem:
RunTests.cmake adds $TEST_PATH to $TMPDIR with the implication that it
gives more isolation. But this is misleading because $TEST_PATH is only
defined once. Full test runs use the same $TMPDIR for all tests.

This was likely added with the intention of invoking RunTests.cmake
once-per-testfile from a wrapper than does the isolation/orchestration.
But even so, Nvim's vim_maketempdir() / vim_mktempdir() _already_
creates a unique tempdir per session.

Solution:
Don't append $TEST_PATH to $TMPDIR. Avoids confusion and makes the path
shorter.
2022-06-23 16:15:55 -07:00
Christian Clason
c00a3f45d4
vim-patch:8cc5b559f700 (#19066)
Update runtime files
8cc5b559f7
2022-06-23 15:57:51 +02:00
zeertzjq
3c85fd817e
fix(api): check for inclusive buffer line index out of bounds correctly (#19056) 2022-06-23 21:38:00 +08:00
zeertzjq
7718b75846
refactor: move some mapping-related code to a separate file (#19061)
This marks the following Vim patches as ported:

vim-patch:8.1.1785: map functionality mixed with character input

Problem:    Map functionality mixed with character input.
Solution:   Move the map functionality to a separate file. (Yegappan
            Lakshmanan, closes vim/vim#4740)  Graduate the +localmap feature.
b66bab381c

vim-patch:8.2.3643: header for source file is outdated

Problem:    Header for source file is outdated.
Solution:   Make the header more accurate. (closes vim/vim#9186)
a3f83feb63

Also cherry-pick a change for <unique> mappings from patch 8.2.0807.
Rename map_clear_mode() to do_mapclear().
2022-06-23 21:17:11 +08:00
bfredl
05ca14a881
Merge pull request #19058 from bfredl/miniopt
perf(highlight): use binary search to lookup RGB color names
2022-06-23 13:42:57 +02:00
zeertzjq
84de4d8655
vim-patch:8.2.5152: search() gets stuck with "c" and skip evaluates to true (#19064)
Problem:    search() gets stuck with "c" and skip evaluates to true.
Solution:   Reset the SEARCH_START option. (closes vim/vim#10608)
180246cfd1
2022-06-23 19:34:43 +08:00
bfredl
a3ce03bef1
Merge pull request #19020 from echasnovski/screenchar-float
fix(float): make `screen*()` functions respect floating windows
2022-06-23 12:01:27 +02:00
bfredl
9690f8c57b perf(highlight): use binary search to lookup RGB color names 2022-06-23 11:48:12 +02:00
Evgeni Chasnovski
9f28eddfab
fix(float): make screen*() functions respect floating windows
Resolves #19013.
2022-06-23 10:34:02 +03:00
zeertzjq
e694e56422
vim-patch:8.2.2068: transparent syntax item uses start/end of containing region (#19055)
Problem:    Transparent syntax item uses start/end of containing region.
Solution:   Do not change the startpos and endpos of a transparent region to
            that of its containing region. (Adrian Ghizaru, closes vim/vim#7349,
            closes vim/vim#7391)
b46f57e87b
2022-06-23 13:01:31 +08:00
zeertzjq
1b75094e3e
Merge pull request #19054 from zeertzjq/vim-8.2.5150
vim-patch:8.2.{5150,5151}: reading beyond the end of the line
2022-06-23 07:37:54 +08:00
zeertzjq
a4d7394bc8 vim-patch:8.2.5151: reading beyond the end of the line with lisp indenting
Problem:    Reading beyond the end of the line with lisp indenting.
Solution:   Avoid going over the NUL at the end of the line.
8eba2bd291
2022-06-23 06:34:56 +08:00
zeertzjq
f088915495 vim-patch:8.2.5150: read past the end of the first line with ":0;'{"
Problem:    Read past the end of the first line with ":0;'{".
Solution:   When on line zero check the column is valid for line one.
f7c7c3fad6
2022-06-23 06:25:05 +08:00
zeertzjq
801faeaae2
fix(input): use correct grid when restoring cursor for <expr> mapping (#19047) 2022-06-23 06:04:03 +08:00
Gregory Anders
c94325288a
fix(api): check error after getting win/buf handle (#19052) 2022-06-22 13:19:03 -06:00
Justin M. Keyes
b20b28249b
fix(build): only pass -municode if MINGW #19049
Avoids this warning in the Windows build:

    2022-06-22T08:58:13.0542153Z LINK : warning LNK4044: unrecognized option '/municode'; ignored [D:\a\neovim\neovim\build\test\functional\fixtures\printenv-test.vcxproj]
2022-06-22 07:09:19 -07:00
Lewis Russell
d23465534a fix(api): nvim_set_option_value for global-local options
global-local window options need to be handled specially. When `win` is
given but `scope` is not, then we want to set the local version of the
option but not the global one, therefore we need to force
`scope='local'`.

Note this does not apply to window-local only options (e.g. 'number')

Example:

   nvim_set_option_value('scrolloff', 10, {})       -- global-local window option; set global value
   nvim_set_option_value('scrolloff', 20, {win=0})  -- global-local window option; set local value
   nvim_set_option_value('number', true, {})        -- local window option

is now equivalent to:

   nvim_set_option_value('scrolloff', 10, {})
   nvim_set_option_value('scrolloff', 20, {win=0, scope='local'})  -- changed from before
   nvim_set_option_value('number', true, {win=0})                  -- unchanged from before

Only the global-local option with a `win` provided gets forced to local
scope.
2022-06-22 11:08:30 +01:00
bfredl
dd591adf8a
Merge pull request #19039 from bfredl/multicolor
perf: get rid of unnecessary allocations in highlight groups
2022-06-22 10:49:36 +02:00
zeertzjq
f17d88c47a
vim-patch:8.2.5132: :mkview test doesn't test much (#19045)
Problem:    :mkview test doesn't test much.
Solution:   Save the view with the folds closed. (James McCoy, closes vim/vim#10596)
c829faa821
2022-06-22 11:08:00 +08:00
Lewis Russell
34ae896b82
refactor(option): DRY get/set option value #19038
The main motivation for this is for the buf and win cases which need to
set up and restore context, and it's what specifically makes the
semantics of options nuanced, and thus this should not be repeated more
than once.

- nvim_get/set_option_value now share argument validation.
2022-06-21 19:09:50 -07:00
bfredl
04592759fa
Merge pull request #19043 from dundargoc/cmake
build(cmake): use glob_wrapper instead of file(GLOB ...) in main CMakeLists
2022-06-22 00:06:35 +02:00
Dundar Goc
230cb00cc5 build(cmake): use glob_wrapper instead of file(GLOB in main CMakeLists
This will allow cmake to check if any directories needs re-globbing, in
other words, if any new file has been added since last time cmake was
run. This will (allegedly) make the configure stage slower but I have
not noticed any difference so I believe this is well worth it.
2022-06-21 23:29:05 +02:00
Jonas Strittmatter
e3b51d5842
refactor(runtime): refactor filetype.lua (#18813)
Move some filetype detection functions to detect.lua,
sort patterns by detected filetype.
2022-06-21 11:29:52 -06:00
bfredl
8cd94e3bc0 perf(ui): remove spurious allocations from mode_style_array() 2022-06-21 18:40:35 +02:00
bfredl
a9442c532e perf(highlight): allocate permanent names in an arena for fun and cache locality 2022-06-21 18:40:35 +02:00
bfredl
1dad288432 refactor: remove atrocious HL_TABLE()[idx] syntax before I poke my eyes out 2022-06-21 18:40:35 +02:00