neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 9fdcbbb4063daa125e420e0ffe9dae6801c264bc
parent 43e8ec92de9e0850e7d202cb7ff9051bc408447e
Author: bfredl <bjorn.linse@gmail.com>
Date:   Tue, 27 Dec 2022 14:43:03 +0100

feat(tui): graduate the +tui feature

This was previously disabled due to build issues on windows.
Any reasonable platform can now be expected to have the necessary
interfaces to build and run the TUI subsystem.

Runtime quality issues of using the TUI (on any new platform) are not
relevant here. Just run Nvim in an external UI instead of the TUI as always.

Diffstat:
MCMakeLists.txt | 46+++++++++++++++++++++-------------------------
Mcmake.config/config.h.in | 2--
Mruntime/doc/news.txt | 4++++
Msrc/nvim/CMakeLists.txt | 3---
Msrc/nvim/ui.c | 16----------------
Msrc/nvim/version.c | 4----
6 files changed, 25 insertions(+), 50 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -498,34 +498,30 @@ if(MSGPACK_HAS_FLOAT32) add_definitions(-DNVIM_MSGPACK_HAS_FLOAT32) endif() -option(FEAT_TUI "Enable the Terminal UI" ON) - -if(FEAT_TUI) - find_package(UNIBILIUM 2.0 REQUIRED) - include_directories(SYSTEM ${UNIBILIUM_INCLUDE_DIRS}) - - list(APPEND CMAKE_REQUIRED_INCLUDES "${UNIBILIUM_INCLUDE_DIRS}") - list(APPEND CMAKE_REQUIRED_LIBRARIES "${UNIBILIUM_LIBRARIES}") - check_c_source_compiles(" - #include <unibilium.h> - - int - main(void) - { - unibi_str_from_var(unibi_var_from_str(\"\")); - return unibi_num_from_var(unibi_var_from_num(0)); - } - " UNIBI_HAS_VAR_FROM) - list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${UNIBILIUM_INCLUDE_DIRS}") - list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "${UNIBILIUM_LIBRARIES}") - if(UNIBI_HAS_VAR_FROM) - add_definitions(-DNVIM_UNIBI_HAS_VAR_FROM) - endif() +find_package(UNIBILIUM 2.0 REQUIRED) +include_directories(SYSTEM ${UNIBILIUM_INCLUDE_DIRS}) + +list(APPEND CMAKE_REQUIRED_INCLUDES "${UNIBILIUM_INCLUDE_DIRS}") +list(APPEND CMAKE_REQUIRED_LIBRARIES "${UNIBILIUM_LIBRARIES}") +check_c_source_compiles(" +#include <unibilium.h> - find_package(LibTermkey 0.22 REQUIRED) - include_directories(SYSTEM ${LIBTERMKEY_INCLUDE_DIRS}) +int +main(void) +{ + unibi_str_from_var(unibi_var_from_str(\"\")); + return unibi_num_from_var(unibi_var_from_num(0)); +} +" UNIBI_HAS_VAR_FROM) +list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${UNIBILIUM_INCLUDE_DIRS}") +list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "${UNIBILIUM_LIBRARIES}") +if(UNIBI_HAS_VAR_FROM) + add_definitions(-DNVIM_UNIBI_HAS_VAR_FROM) endif() +find_package(LibTermkey 0.22 REQUIRED) +include_directories(SYSTEM ${LIBTERMKEY_INCLUDE_DIRS}) + find_package(LIBVTERM 0.3 REQUIRED) include_directories(SYSTEM ${LIBVTERM_INCLUDE_DIRS}) diff --git a/cmake.config/config.h.in b/cmake.config/config.h.in @@ -56,8 +56,6 @@ #endif #cmakedefine HAVE_FORKPTY -#cmakedefine FEAT_TUI - #ifndef UNIT_TESTING #cmakedefine LOG_LIST_ACTIONS #endif diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt @@ -118,6 +118,10 @@ The following changes to existing APIs or features add new behavior. thread was used). This is not supposed to be a visible change to the user, but might be the cause of subtle changes of behavior and bugs. + Previously, the TUI could be disabled as a build time feature (+tui/-tui), + resulting in a nvim binary which only could be run headless or embedded + in an external process. As of this version, TUI is always avalibale. + ============================================================================== REMOVED FEATURES *news-removed* diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt @@ -110,9 +110,6 @@ foreach(subdir viml viml/parser ) - if(${subdir} MATCHES "tui" AND NOT FEAT_TUI) - continue() - endif() file(MAKE_DIRECTORY ${GENERATED_DIR}/${subdir}) file(MAKE_DIRECTORY ${GENERATED_INCLUDES_DIR}/${subdir}) diff --git a/src/nvim/ui.c b/src/nvim/ui.c @@ -128,32 +128,16 @@ static UI *builtin_ui = NULL; void ui_free_all_mem(void) { kv_destroy(call_buf); -# ifdef FEAT_TUI if (builtin_ui) { tui_free_all_mem(builtin_ui); builtin_ui = NULL; } -# endif } #endif void ui_builtin_start(void) { -#ifdef FEAT_TUI builtin_ui = tui_start(); -#else - fprintf(stderr, "Nvim headless-mode started.\n"); - size_t len; - char **addrs = server_address_list(&len); - if (addrs != NULL) { - fprintf(stderr, "Listening on:\n"); - for (size_t i = 0; i < len; i++) { - fprintf(stderr, "\t%s\n", addrs[i]); - } - xfree(addrs); - } - fprintf(stderr, "Press CTRL+C to exit.\n"); -#endif } UI *ui_get_by_index(int idx) diff --git a/src/nvim/version.c b/src/nvim/version.c @@ -69,11 +69,7 @@ static char *features[] = { "-iconv", #endif -#ifdef FEAT_TUI "+tui", -#else - "-tui", -#endif NULL };