Skip to content

Commit

Permalink
refactor(build): graduate unibilium VAR_FROM feature from 2017
Browse files Browse the repository at this point in the history
  • Loading branch information
bfredl committed Mar 3, 2023
1 parent c9b6db4 commit 848dac0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 33 deletions.
18 changes: 0 additions & 18 deletions cmake/FindUnibilium.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,4 @@ add_library(unibilium INTERFACE)
target_include_directories(unibilium SYSTEM BEFORE INTERFACE ${UNIBILIUM_INCLUDE_DIR})
target_link_libraries(unibilium INTERFACE ${UNIBILIUM_LIBRARY})

list(APPEND CMAKE_REQUIRED_INCLUDES "${UNIBILIUM_INCLUDE_DIR}")
list(APPEND CMAKE_REQUIRED_LIBRARIES "${UNIBILIUM_LIBRARY}")
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_DIR}")
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "${UNIBILIUM_LIBRARY}")
if(UNIBI_HAS_VAR_FROM)
target_compile_definitions(unibilium INTERFACE NVIM_UNIBI_HAS_VAR_FROM)
endif()

mark_as_advanced(UNIBILIUM_INCLUDE_DIR UNIBILIUM_LIBRARY)
17 changes: 2 additions & 15 deletions src/nvim/tui/tui.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,27 +60,14 @@
#define LINUXSET0C "\x1b[?0c"
#define LINUXSET1C "\x1b[?1c"

#ifdef NVIM_UNIBI_HAS_VAR_FROM
# define UNIBI_SET_NUM_VAR(var, num) \
#define UNIBI_SET_NUM_VAR(var, num) \
do { \
(var) = unibi_var_from_num((num)); \
} while (0)
# define UNIBI_SET_STR_VAR(var, str) \
#define UNIBI_SET_STR_VAR(var, str) \
do { \
(var) = unibi_var_from_str((str)); \
} while (0)
#else
# define UNIBI_SET_NUM_VAR(var, num) \
do { \
(var).p = NULL; \
(var).i = (num); \
} while (0)
# define UNIBI_SET_STR_VAR(var, str) \
do { \
(var).i = INT_MIN; \
(var).p = str; \
} while (0)
#endif

typedef struct {
int top, bot, left, right;
Expand Down

0 comments on commit 848dac0

Please sign in to comment.