Commit Graph

21367 Commits

Author SHA1 Message Date
b477afa3ea Merge pull request #19088 from neovim/fix-powershell
[Backport release-0.7] fix: make_filter_cmd for powershell as shell (#16271)
2022-06-25 19:59:31 +02:00
71e2c49b17 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 19:09:29 +02:00
175892fa37 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 17:54:41 +02:00
790f6089e9 Merge pull request #19085 from neovim/build-universal-macos
[Backport release-0.7] macOS universal release (#19029, #18914, #19084)
2022-06-25 15:13:19 +02:00
b0eedceab4 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 14:14:39 +02:00
059107f424 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 14:14:29 +02:00
dca69c90d4 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-25 14:13:35 +02:00
0d230d3f01 build: remove CMAKE_CROSSCOMPILING code #18914
This is rarely, if ever, used and certainly not tested. It's likely this
isn't functional anymore.
2022-06-25 14:13:21 +02:00
a59bade869 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-25 14:07:19 +02:00
f2b465232d fix(lsp): make sure to always reset active codelens refreshes (#18331)
This fixes issues where subsequent calls to vim.lsp.codelens.refresh()
would have no effect due to the buffer not getting cleared from the
active_refresh table.

Examples of how such scenarios would occur are:
  - A textDocument/codeLens result yielded an error.
  - The 'textDocument/codeLens' handler was overriden in such a way that
    it no longer called vim.lsp.codelens.on_codelens().

(cherry picked from commit 94eb72cc44)
2022-06-25 12:31:58 +02:00
b3d754ccd7 fix(lsp): fix multi client handling in code action (#18869)
Fixes https://github.com/neovim/neovim/issues/18860

(cherry picked from commit e4df1c9b9e)
2022-06-25 12:22:17 +02:00
e820c6d7c3 Merge pull request #19069 from neovim/backport-19056-to-release-0.7
[Backport release-0.7] fix(api): check for inclusive buffer line index out of bounds correctly
2022-06-23 16:58:40 +02:00
cf9c097f34 fix(api): check for inclusive buffer line index out of bounds correctly
(cherry picked from commit 01ee7152c5)
2022-06-23 13:40:46 +00:00
3942a3f5d0 Merge pull request #19065 from neovim/backport-19064-to-release-0.7
[Backport release-0.7] vim-patch:8.2.5152: search() gets stuck with "c" and skip evaluates to true
2022-06-23 20:19:12 +08:00
c0224b59da vim-patch:8.2.5152: search() gets stuck with "c" and skip evaluates to true
Problem:    search() gets stuck with "c" and skip evaluates to true.
Solution:   Reset the SEARCH_START option. (closes vim/vim#10608)
180246cfd1
(cherry picked from commit c527be5600)
2022-06-23 11:35:15 +00:00
a05da1c05a Merge pull request #19053 from neovim/backport-19047-to-release-0.7
[Backport release-0.7] fix(input): use correct grid when restoring cursor for <expr> mapping
2022-06-23 07:00:23 +08:00
17299b302c fix(input): use correct grid when restoring cursor for <expr> mapping
(cherry picked from commit 2d4c992dbe)
2022-06-22 22:04:40 +00:00
2fe25ad06c Merge pull request #19037 from neovim/backport-19033-to-release-0.7
[Backport release-0.7] Update docs concerning $NVIM_LISTEN_ADDRESS
2022-06-21 10:28:13 +02:00
6349ec9e7c docs(deprecated): alternatives for $NVIM_LISTEN_ADDRESS
(cherry picked from commit 905093f6ae)
2022-06-21 08:26:22 +00:00
7266150eff Merge pull request #19025 from neovim/extmark-conceal
[Backport release-0.7] fix(decorations): nvim_buf_set_extmark breaks conceal (#19010)
2022-06-19 20:46:06 +02:00
40e13c8d95 fix(decorations): nvim_buf_set_extmark breaks conceal #19010
Closes #19007

Co-authored-by: bfredl <bjorn.linse@gmail.com>
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2022-06-19 19:39:14 +02:00
38928b5cc2 Merge pull request #19023 from neovim/backport-18932-to-release-0.7
[Backport release-0.7] fix(tui): fix piping output make nvim unusable
2022-06-19 18:12:57 +02:00
18e0d64666 fix(tui): fix piping output make nvim unusable
fix(tui): fix piping output make nvim unusable

(cherry picked from commit 72ce1f308b)
2022-06-19 15:23:13 +00:00
d78447481c Merge pull request #19022 from neovim/ci-macos-release
[Backport release-0.7] ci(release): skip CoreServices system library on macOS (#19021)
2022-06-19 17:01:41 +02:00
e2915709b0 ci(release): skip CoreServices system library on macOS (#19021)
Problem:
The release script bundles a system library (CoreServices) that was
added in #18294, which leads to errors on M1 since the architecture is
different from the Github runner.

Solution:
Skip CoreServices when bundling the libraries (as was done for the
CoreFoundation library that #18294 replaced with CoreServices).
2022-06-19 16:22:12 +02:00
cd7ac0eb29 Merge pull request #19014 from neovim/backport-18982-to-release-0.7
[Backport release-0.7] fix: use ctermbg/fg instead of bg/fg when use_rgb is false
2022-06-18 18:51:48 +02:00
433f3067a0 fix: use ctermbg/fg instead of bg/fg when use_rgb is false
(cherry picked from commit d76ecae4ae)
2022-06-18 15:36:50 +00:00
30ae06c8fe Merge pull request #19009 from neovim/backport-18820-to-release-0.7
[Backport release-0.7] fix(hl): backport #18820, #18981, #18870
2022-06-18 15:03:56 +02:00
777d415da8 fix(highlight): let winhighlight use cursor 2022-06-18 14:14:24 +02:00
f70e0832b1 fix(hl): return cterm fg/bg even if they match Normal #18981
Fixes #18980

- 831fa45ad8 is related but this doesn't regress that
- The `cterm_normal_fg_color != ae.cterm_fg_color` comparison is originally
  carried from patch to patch starting all the way back in 29bc6dfabd where it
  was avoiding setting a HL attr. But `hlattrs2dict()` now is just
  informational.
2022-06-18 13:21:01 +02:00
ee210b0f74 fix(hl): DRY set_hl_group() sg_attr set
(cherry picked from commit 9747e984e1)
2022-06-18 11:18:39 +00:00
512a8197c8 test(hl): Add Normal group set_hl/get_hl_by_name check
(cherry picked from commit 02f70c1638)
2022-06-18 11:18:39 +00:00
79ca64a1ef fix(hl): set Normal hl group sg_attr value (fixes #18024)
(cherry picked from commit 03b4b07162)
2022-06-18 11:18:39 +00:00
2ebc76b226 Merge pull request #19001 from neovim/backport-18861-to-release-0.7
[Backport release-0.7] fix(startup): nvim with --clean should not load user rplugins
2022-06-17 18:09:11 +02:00
41709831ae fix(startup): nvim with --clean should not load user rplugins
runtime rplugins such like legacy script providers are not affected
by this change.

(cherry picked from commit aad20de5ab)
2022-06-17 15:17:41 +00:00
fdd5178581 [Backport release-0.7] introduce $NVIM, unset $NVIM_LISTEN_ADDRESS (#18986)
feat(server): introduce $NVIM

PROBLEM
------------------------------------------------------------------------
$NVIM_LISTEN_ADDRESS has conflicting purposes as both a parameter ("the
current process should listen on this address") and a descriptor ("the
current process is a child of this address").

This contradiction means the presence of NVIM_LISTEN_ADDRESS is
ambiguous, so child Nvim always tries to listen on its _parent's_
socket. This is the cause of lots of  "Failed to start server" spam in
our test/CI logs:

    WARN  2022-04-30… server_start:154: Failed to start server: address already in use: \\.\pipe\nvim-4480-0
    WARN  2022-04-30… server_start:154: Failed to start server: address already in use: \\.\pipe\nvim-2168-0

SOLUTION
------------------------------------------------------------------------

1. Set $NVIM to the parent v:servername, *only* in child processes.
   - Now the correct way to detect a "parent" Nvim is to check for $NVIM.
2. Do NOT set $NVIM_LISTEN_ADDRESS in child processes.
3. On startup if $NVIM_LISTEN_ADDRESS exists, unset it immediately after
   server init.
4. Open a channel to parent automatically, expose it as v:parent.

Fixes #3118
Fixes #6764
Fixes #9336
Ref https://github.com/neovim/neovim/pull/8247#issuecomment-380275696
Ref #8696

(cherry picked from commit b9d97f5951)

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2022-06-16 18:30:08 -07:00
ed9e6d19ab [Backport release-0.7] fix(treesitter): new iter if folded (#18990)
fix(treesitter): new iter if folded

(cherry picked from commit 8780076a78)

Co-authored-by: kevinhwang91 <kevin.hwang@live.com>
2022-06-16 19:08:48 +02:00
05ce04e994 Merge pull request #18984 from neovim/fix-highlight-yank
backport highlight.on_yank timer fixes #18824 and #18976
2022-06-16 15:10:22 +02:00
351b5969c1 vim-patch:8.2.5097: using uninitialized memory when using 'listchars' (#18985)
Problem:    Using uninitialized memory when using 'listchars'.
Solution:   Use the length returned by mb_char2bytes(). (closes vim/vim#10576)
74ac29cecd
2022-06-16 19:09:59 +08:00
fe42dea674 fix(lua): highlight.on_yank can close timer in twice #18976
check whether timer is closing in vim.defer_fn before closing
2022-06-16 12:27:59 +02:00
f15d6094fc fix(lua): stop pending highlight.on_yank timer, if any (#18824)
When yanking another range while previous yank is still highlighted, the
pending timer could clear the highlight almost immediately (especially
when using larger `timeout`, i.e. 2000)
2022-06-16 12:26:03 +02:00
5243cb8a4b Merge pull request #18975 from neovim/backport-18969-to-release-0.7
[Backport release-0.7] fix(ui): do not call showmode() when setting window height
2022-06-15 20:12:54 +08:00
bf4df2a629 fix(ui): do not call showmode() when setting window height
(cherry picked from commit 756e65ae62)
2022-06-15 11:42:36 +00:00
3cea4d6de9 Merge pull request #18942 from neovim/backport-18933-to-release-0.7
[Backport release-0.7] fix(buffer): disable buffer-updates before removing buffer from window
2022-06-13 07:44:20 +08:00
05f6883ee2 fix(buffer): disable buffer-updates before removing buffer from window
There can be other places that access window buffer info (e.g.
`tabpagebuflist()`), so checking `w_closing` in `win_findbuf()` doesn't
solve the crash in all cases, and may also cause Nvim's behavior to
diverge from Vim.

(cherry picked from commit fa30ef1c31)
2022-06-12 22:02:42 +00:00
1dba6cf8f0 Merge pull request #18918 from neovim/backport-18917-to-release-0.7
[Backport release-0.7] fix(input): fix macro recording with ALT and special key
2022-06-10 17:57:09 +08:00
0c9d666205 fix(input): fix macro recording with ALT and special key
(cherry picked from commit d6b309e20b)
2022-06-10 09:14:45 +00:00
fc4e4b38b2 Merge pull request #18905 from neovim/backport-18903-to-release-0.7
[Backport release-0.7] test(ts): skip test if C parser is not available
2022-06-08 21:11:27 -04:00
bd3bb128c0 test(ts): skip test if C parser is not available
(cherry picked from commit 6b0595d7cc)
2022-06-09 01:10:36 +00:00
d317cb2322 Merge pull request #18886 from neovim/backport-18885-to-release-0.7
[Backport release-0.7] fix(input): allow Ctrl-C to interrupt a recursive mapping even if mapped
2022-06-07 13:10:43 +08:00