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.
This commit is contained in:
bfredl 2022-12-27 14:43:03 +01:00
parent 43e8ec92de
commit 9fdcbbb406
6 changed files with 24 additions and 49 deletions

View File

@ -498,34 +498,30 @@ if(MSGPACK_HAS_FLOAT32)
add_definitions(-DNVIM_MSGPACK_HAS_FLOAT32)
endif()
option(FEAT_TUI "Enable the Terminal UI" ON)
find_package(UNIBILIUM 2.0 REQUIRED)
include_directories(SYSTEM ${UNIBILIUM_INCLUDE_DIRS})
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>
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(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})

View File

@ -56,8 +56,6 @@
#endif
#cmakedefine HAVE_FORKPTY
#cmakedefine FEAT_TUI
#ifndef UNIT_TESTING
#cmakedefine LOG_LIST_ACTIONS
#endif

View File

@ -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*

View File

@ -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})

View File

@ -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)

View File

@ -69,11 +69,7 @@ static char *features[] = {
"-iconv",
#endif
#ifdef FEAT_TUI
"+tui",
#else
"-tui",
#endif
NULL
};