mirror of
https://github.com/neovim/neovim.git
synced 2025-12-11 17:12:40 +00:00
feat: has('terminfo')
Problem:
No way to detect at runtime if the build includes unibilium (or whatever
terminfo layer we swap it with later).
Solution:
Support `has('terminfo')`.
This commit is contained in:
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@@ -55,7 +55,7 @@ jobs:
|
|||||||
run: make install
|
run: make install
|
||||||
|
|
||||||
use-existing-src:
|
use-existing-src:
|
||||||
name: Test USE_EXISTING_SRC_DIR=ON builds with no network access
|
name: Test offline build (USE_EXISTING_SRC_DIR=ON builds with no network access)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
|
|||||||
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@@ -176,7 +176,7 @@ jobs:
|
|||||||
- name: Install
|
- name: Install
|
||||||
run: |
|
run: |
|
||||||
cmake --install build
|
cmake --install build
|
||||||
"$INSTALL_PREFIX/bin/nvim" --version
|
"$INSTALL_PREFIX/bin/nvim" -V1 --version
|
||||||
if ! "$INSTALL_PREFIX/bin/nvim" -u NONE -e -c ':help' -c ':qall'; then
|
if ! "$INSTALL_PREFIX/bin/nvim" -u NONE -e -c ':help' -c ':qall'; then
|
||||||
echo "Running ':help' in the installed nvim failed."
|
echo "Running ':help' in the installed nvim failed."
|
||||||
echo "Maybe the helptags have not been generated properly."
|
echo "Maybe the helptags have not been generated properly."
|
||||||
|
|||||||
2
BUILD.md
2
BUILD.md
@@ -300,6 +300,8 @@ custom terminfo at runtime, use
|
|||||||
make CMAKE_EXTRA_FLAGS="-DENABLE_UNIBILIUM=0" DEPS_CMAKE_FLAGS="-DUSE_BUNDLED_UNIBILIUM=0"
|
make CMAKE_EXTRA_FLAGS="-DENABLE_UNIBILIUM=0" DEPS_CMAKE_FLAGS="-DUSE_BUNDLED_UNIBILIUM=0"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To confirm at runtime that unibilium was not included, check `has('terminfo') == 1`.
|
||||||
|
|
||||||
### How to build static binary (on Linux)
|
### How to build static binary (on Linux)
|
||||||
|
|
||||||
1. Use a linux distribution which uses musl C. We will use Alpine Linux but any distro with musl should work. (glibc does not support static linking)
|
1. Use a linux distribution which uses musl C. We will use Alpine Linux but any distro with musl should work. (glibc does not support static linking)
|
||||||
|
|||||||
@@ -2757,6 +2757,9 @@ static void f_has(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
|||||||
"tablineat",
|
"tablineat",
|
||||||
"tag_binary",
|
"tag_binary",
|
||||||
"termguicolors",
|
"termguicolors",
|
||||||
|
#ifdef HAVE_UNIBILIUM
|
||||||
|
"terminfo",
|
||||||
|
#endif
|
||||||
"termresponse",
|
"termresponse",
|
||||||
"textobjects",
|
"textobjects",
|
||||||
"timers",
|
"timers",
|
||||||
|
|||||||
@@ -64,6 +64,17 @@ describe('has()', function()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('"terminfo"', function()
|
||||||
|
-- Looks like "HAVE_UNIBILIUM ", "HAVE_UNIBILIUM=1", "HAVE_UNIBILIUM off", ….
|
||||||
|
-- Capture group returns the "1"/"off"/….
|
||||||
|
local build_flag =
|
||||||
|
vim.trim((n.exec_capture('verbose version'):match('HAVE_UNIBILIUM([^-]+)') or ''):lower())
|
||||||
|
-- XXX: the match() above fails in CI so currently we assume CI always builds with unibilium.
|
||||||
|
local is_enabled = t.is_ci()
|
||||||
|
or not (build_flag == '' or build_flag == 'false' or build_flag == '0' or build_flag == 'off')
|
||||||
|
eq(is_enabled and 1 or 0, fn.has('terminfo'))
|
||||||
|
end)
|
||||||
|
|
||||||
it('"wsl"', function()
|
it('"wsl"', function()
|
||||||
local is_wsl = vim.uv.os_uname()['release']:lower():match('microsoft') and true or false
|
local is_wsl = vim.uv.os_uname()['release']:lower():match('microsoft') and true or false
|
||||||
if is_wsl then
|
if is_wsl then
|
||||||
|
|||||||
Reference in New Issue
Block a user