Commit Graph

21986 Commits

Author SHA1 Message Date
Vedant
9ddb481d88
refactor(ci): cleanup release.yml #19132 2022-06-28 03:40:53 -07:00
Justin M. Keyes
094086a713
Merge #19060 memory leaks 2022-06-28 12:37:39 +02:00
0x74696d6d79
ee6b21e843
fix(vim.ui.input): accept nil or empty "opts" #19109
Fix #18143
2022-06-28 02:53:15 -07:00
dundargoc
014a88799a
refactor: replace char_u #18429
Work on https://github.com/neovim/neovim/issues/459
2022-06-28 02:31:54 -07:00
Famiu Haque
7e1cf6b764
fix(inccommand): parse the command to check if it is previewable
Free regprog if command isn't previewable

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2022-06-28 13:00:05 +08:00
Christian Clason
274609a109
vim-patch:069a7d561bbe (#19130)
Update runtime files
069a7d561b
2022-06-27 23:35:26 +02:00
Christian Clason
f2fa11708c
fix(filetype): check for non-nil match in detect.rules (#19129) 2022-06-27 20:43:37 +02:00
bfredl
0c363d1a70
Merge pull request #19122 from dundargoc/refactor/conversion
refactor: enable -Wconversion warning for message.c
2022-06-27 17:07:21 +02:00
Dundar Goc
2dd01e3e21 refactor: enable -Wconversion warning for message.c
Work on https://github.com/neovim/neovim/issues/567
2022-06-27 13:55:40 +02:00
Christian Clason
f3c8f3e5d4
vim-patch:partial:8a3b805c6c9c (#19104)
Update runtime files
8a3b805c6c

skip builtin.txt (needs 8.2.4838)
skip message.txt (whitespace changes)
2022-06-27 10:23:09 +02:00
bfredl
f10489d9c2
Merge pull request #19077 from dundargoc/refactor/conversion
refactor: enable -Wconversion warning for ex_cmds.c
2022-06-27 10:09:33 +02:00
Gregory Anders
6f3508f8ed
refactor(filetype): allow vim.filetype.match to accept buf and filename (#19114)
This is necessary in cases where filetype detection acts recursively.
For example, when matching files that end with .bak, the "root" of
the filename is matched again against the same buffer (e.g. a buffer
named "foo.c.bak" will be matched again with the filename "foo.c", using
the same underlying buffer).
2022-06-27 10:03:43 +02:00
Justin M. Keyes
eab8b998e9
build: move man/ to src/man/ #19119
Problem:
man/ contains source files for manpage generation, it doesn't need to
live at the project root.

Solution:
Move it to src/man/.
2022-06-27 01:02:02 -07:00
Gregory Anders
8c2b870544
fix(api): change default value of 'pattern' in nvim_exec_autocmds (#19115)
Omitting 'pattern' in nvim_exec_autocmds should be equivalent to
omitting the 'fname' argument in :doautoall, which is equivalent to
using an empty string as the pattern. Fixes regression introduced
in #19091.
2022-06-27 09:51:33 +02:00
zeertzjq
cf23695dd7
fix(api): nvim_parse_cmd check for ambiguous user command (#19116) 2022-06-27 14:10:13 +08:00
Justin M. Keyes
e2f9d0332b
test: use "python3" to avoid skipped test #19106
Problem:
The "calls executable in $PATH" is skipped on some CI jobs because
"python" is not found.

Solution:
Use "python3" instead.
2022-06-26 22:03:06 -07:00
Thomas Vigouroux
89f75dcd1f
fix(coverity/348300): free memory when overiding sing attribute
Nothing prevent the user from doing `:sign define abc culhl=Normal
culhl=Normal` and thus this leads to an obvious memory leak.
2022-06-27 06:55:41 +02:00
zeertzjq
a0a815ec57
Merge pull request #18716 from zeertzjq/vim-8.2.5007
vim-patch:8.2.{3484,5007,5123}: spell suggestion fixes
2022-06-27 06:45:00 +08:00
zeertzjq
6711d001c5 fix(spell): make setting 'encoding' clear word list 2022-06-27 05:33:54 +08:00
zeertzjq
f0d4007f62 vim-patch:8.2.5123: using invalid index when looking for spell suggestions
Problem:    Using invalid index when looking for spell suggestions.
Solution:   Do not decrement the index when it is zero.
156d391195
2022-06-27 05:33:54 +08:00
zeertzjq
80af2c6055 vim-patch:8.2.5007: spell suggestion may use uninitialized memory
Problem:    Spell suggestion may use uninitialized memory. (Zdenek Dohnal)
Solution:   Avoid going over the end of the word.
6d24b4ff69
2022-06-27 05:33:54 +08:00
zeertzjq
bafb53604a vim-patch:8.2.3484: crash when going through spell suggestions
Problem:    Crash when going through spell suggestions.
Solution:   Limit the text length for finding suggestions to the original
            length.  Do not update buffers when exiting. (closes vim/vim#8965)
e275ba4fc9
2022-06-27 05:33:54 +08:00
Christian Clason
516d6318b7
Merge pull request #19091 from clason/do-aucmd-pats
feat(api): support pattern array for exec_autocmds
2022-06-26 23:05:52 +02:00
Gregory Anders
f3ce06cfa1
refactor(filetype)!: allow vim.filetype.match to use different strategies (#18895)
This enables vim.filetype.match to match based on a buffer (most
accurate) or simply a filename or file contents, which are less accurate
but may still be useful for some scenarios.

When matching based on a buffer, the buffer's name and contents are both
used to do full filetype matching. When using a filename, if the file
exists the file is loaded into a buffer and full filetype detection is
performed. If the file does not exist then filetype matching is only
performed against the filename itself. Content-based matching does the
equivalent of scripts.vim, and matches solely based on file contents
without any information from the name of the file itself (e.g. for
shebangs).

BREAKING CHANGE: use `vim.filetype.match({buf = bufnr})` instead 
of `vim.filetype.match(name, bufnr)`
2022-06-26 18:41:20 +02:00
Christian Clason
5c8025967e refactor(api): use FOREACH_ITEM macro in autocmd 2022-06-26 17:57:45 +02:00
Carlo Cabrera
ae3e371303
docs(release): suggest "xattr" for macos release #19100 2022-06-26 08:46:37 -07:00
Christian Clason
da358d4521 feat(api): support pattern array for exec_autocmds 2022-06-26 13:04:45 +02:00
zeertzjq
3d45706478
build: guard free_locales with HAVE_WORKING_LIBINTL #19095
With 4c7462fdb3, when `libintl` is turned off via
`-DENABLE_LIBINTL=OFF`, Neovim does not compile in Debug mode with the following
error message:

```
...
[201/331] Building C object src/nvim/CMakeFiles/nvim.dir/eval.c.o
FAILED: src/nvim/CMakeFiles/nvim.dir/eval.c.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -DEXITFREE -DINCLUDE_GENERATED_DECLARATIONS -DMIN_LOG_LEVEL=1 -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -Dnvim_EXPORTS -I/Users/hat/Projects/neovim/build/config -I/Users/hat/Projects/neovim/src -I/Users/hat/Projects/neovim/build/src/nvim/auto -I/Users/hat/Projects/neovim/build/include -I/Users/hat/Projects/neovim/.deps/usr/include/luajit-2.1 -isystem /Users/hat/Projects/neovim/.deps/usr/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -g -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always  -Wno-conversion -MD -MT src/nvim/CMakeFiles/nvim.dir/eval.c.o -MF src/nvim/CMakeFiles/nvim.dir/eval.c.o.d -o src/nvim/CMakeFiles/nvim.dir/eval.c.o -c /Users/hat/Projects/neovim/src/nvim/eval.c
/Users/hat/Projects/neovim/src/nvim/eval.c:473:3: error: implicit declaration of function 'free_locales' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  free_locales();
  ^
/Users/hat/Projects/neovim/src/nvim/eval.c:473:3: note: did you mean 'free_titles'?
/Users/hat/Projects/neovim/build/include/buffer.h.generated.h:58:16: note: 'free_titles' declared here
DLLEXPORT void free_titles(void);
               ^
1 error generated.
[212/331] Building C object src/nvim/CMakeFiles/nvim.dir/eval/funcs.c.o
ninja: build stopped: subcommand failed.
make: *** [nvim] Error 1
```

The previous commit, b1b5802009, to 4c7462f does
not have this issue. As you can see in the following, the issue occurs only in
Debug mode with `libintl` turned off:

```bash
# No issue
git checkout b1b5802

# The following Debug build works
make distclean; make SDKROOT=$(xcrun --sdk macosx --show-sdk-path) CMAKE_EXTRA_FLAGS="-DENABLE_LIBINTL=OFF"
# The following Release build works
make distclean; make CMAKE_BUILD_TYPE=Release SDKROOT=$(xcrun --sdk macosx --show-sdk-path) CMAKE_EXTRA_FLAGS="-DENABLE_LIBINTL=OFF"

# Compile error when in Debug and libintl turned off
git checkout 4c7462f

# The following Debug build does not work
make distclean; make SDKROOT=$(xcrun --sdk macosx --show-sdk-path) CMAKE_EXTRA_FLAGS="-DENABLE_LIBINTL=OFF"

# The following Debug build works
make distclean; make SDKROOT=$(xcrun --sdk macosx --show-sdk-path)

# The following Release build works
make distclean; make CMAKE_BUILD_TYPE=Release SDKROOT=$(xcrun --sdk macosx --show-sdk-path) CMAKE_EXTRA_FLAGS="-DENABLE_LIBINTL=OFF"
```

I noticed this because I turn `libintl` off when compiling `libnvim` for VimR.

Fix #19093
2022-06-26 03:17:57 -07:00
zeertzjq
7dd73625dc
revert: "oldtests: use expand() to fix pathsep" (#19073)
This reverts commit e3687165a7.

No longer needed after #10679.
2022-06-26 05:31:27 +08:00
Christian Clason
42e8774317
vim-patch:e1dc76fbf333 (#19092)
Update runtime files
e1dc76fbf3
2022-06-25 21:56:51 +02:00
bfredl
69e7b664d8
Merge pull request #19090 from bfredl/luaprg
fix(build): don't disable byte precompilation on debug builds
2022-06-25 20:30:43 +02:00
bfredl
cb58b673e5 fix(build): don't disable byte precompilation on debug builds
This special casing is redundant since long, as you can disable
the binary cache regardless of build type with the --luamod-dev flag
2022-06-25 19:24:48 +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
Dundar Goc
2217ab42c5 refactor: enable -Wconversion warning for ex_cmds.c
Work on https://github.com/neovim/neovim/issues/567
2022-06-25 15:49:32 +02: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