diff options
37 files changed, 751 insertions, 910 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 9eb701dd3f..878d5134ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,10 @@ endif() # Point CMake at any custom modules we may ship list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") -# We don't support building in-tree. +include(CheckCCompilerFlag) +include(CheckCSourceCompiles) +include(InstallHelpers) +include(LuaHelpers) # Find Lua interpreter include(PreventInTreeBuilds) include(Util) @@ -78,9 +81,6 @@ endif() list(INSERT CMAKE_PREFIX_PATH 0 ${DEPS_PREFIX}) set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${DEPS_PREFIX}/lib/pkgconfig") -# used for check_c_compiler_flag -include(CheckCCompilerFlag) - if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") # CMake tries to treat /sw and /opt/local as extension of the system path, but # that doesn't really work out very well. Once you have a dependency that @@ -98,7 +98,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") OUTPUT_STRIP_TRAILING_WHITESPACE) set(CMAKE_OSX_DEPLOYMENT_TARGET "${MACOS_VERSION}") endif() - message("Using deployment target ${CMAKE_OSX_DEPLOYMENT_TARGET}") + message(STATUS "Using deployment target ${CMAKE_OSX_DEPLOYMENT_TARGET}") # Work around some old, broken detection by CMake for knowing when to use the # isystem flag. Apple's compilers have supported this for quite some time @@ -115,8 +115,6 @@ if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Darwin") set(USE_FNAME_CASE TRUE) endif() -option(ENABLE_LIBINTL "enable libintl" ON) -option(ENABLE_LIBICONV "enable libiconv" ON) if (MINGW) # Disable LTO by default as it may not compile # See https://github.com/Alexpux/MINGW-packages/issues/3516 @@ -192,24 +190,9 @@ if(CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES DNDEBUG) string(REPLACE "-DNDEBUG" "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}") endif() -option(ENABLE_IWYU "Run include-what-you-use with the compiler." OFF) -if(ENABLE_IWYU) - find_program(IWYU_PRG NAMES include-what-you-use iwyu) - if(NOT IWYU_PRG) - message(FATAL_ERROR "ENABLE_IWYU is ON but include-what-you-use is not found!") - endif() - set(CMAKE_C_INCLUDE_WHAT_YOU_USE ${IWYU_PRG} - -Xiwyu --mapping_file=${PROJECT_SOURCE_DIR}/cmake.config/iwyu/mapping.imp - -Xiwyu --mapping_file=${PROJECT_SOURCE_DIR}/cmake.config/iwyu/gcc.libc.imp - -Xiwyu --mapping_file=${PROJECT_SOURCE_DIR}/cmake.config/iwyu/gcc.symbols.imp - -Xiwyu --no_default_mappings) - add_definitions(-DEXITFREE) -endif() - # gcc 4.0+ sets _FORTIFY_SOURCE=2 automatically. This currently # does not work with Neovim due to some uses of dynamically-sized structures. # https://github.com/neovim/neovim/issues/223 -include(CheckCSourceCompiles) # Include the build type's default flags in the check for _FORTIFY_SOURCE, # otherwise we may incorrectly identify the level as acceptable and find out @@ -221,300 +204,8 @@ if(${INIT_FLAGS_NAME}) set(CMAKE_REQUIRED_FLAGS "${${INIT_FLAGS_NAME}}") endif() -# Include <string.h> because some toolchains define _FORTIFY_SOURCE=2 in -# internal header files, which should in turn be #included by <string.h>. -check_c_source_compiles(" -#include <string.h> - -#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 1 -#error \"_FORTIFY_SOURCE > 1\" -#endif -int -main(void) -{ - return 0; -} -" HAS_ACCEPTABLE_FORTIFY) - -if(NOT HAS_ACCEPTABLE_FORTIFY) - message(STATUS "Unsupported _FORTIFY_SOURCE found, forcing _FORTIFY_SOURCE=1") - # Extract possible prefix to _FORTIFY_SOURCE (e.g. -Wp,-D_FORTIFY_SOURCE). - STRING(REGEX MATCH "[^\ ]+-D_FORTIFY_SOURCE" _FORTIFY_SOURCE_PREFIX "${CMAKE_C_FLAGS}") - STRING(REPLACE "-D_FORTIFY_SOURCE" "" _FORTIFY_SOURCE_PREFIX "${_FORTIFY_SOURCE_PREFIX}" ) - if(NOT _FORTIFY_SOURCE_PREFIX STREQUAL "") - message(STATUS "Detected _FORTIFY_SOURCE Prefix=${_FORTIFY_SOURCE_PREFIX}") - endif() - # -U in add_definitions doesn't end up in the correct spot, so we add it to - # the flags variable instead. - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_FORTIFY_SOURCE_PREFIX}-U_FORTIFY_SOURCE ${_FORTIFY_SOURCE_PREFIX}-D_FORTIFY_SOURCE=1") -endif() - -# Remove --sort-common from linker flags, as this seems to cause bugs (see #2641, #3374). -# TODO: Figure out the root cause. -if(CMAKE_EXE_LINKER_FLAGS MATCHES "--sort-common" OR - CMAKE_SHARED_LINKER_FLAGS MATCHES "--sort-common" OR - CMAKE_MODULE_LINKER_FLAGS MATCHES "--sort-common") - message(STATUS "Removing --sort-common from linker flags") - string(REGEX REPLACE ",--sort-common(=[^,]+)?" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") - string(REGEX REPLACE ",--sort-common(=[^,]+)?" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") - string(REGEX REPLACE ",--sort-common(=[^,]+)?" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}") - - # If no linker flags remain for a -Wl argument, remove it. - # '-Wl$' will match LDFLAGS="-Wl,--sort-common", - # '-Wl ' will match LDFLAGS="-Wl,--sort-common -Wl,..." - string(REGEX REPLACE "-Wl($| )" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") - string(REGEX REPLACE "-Wl($| )" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") - string(REGEX REPLACE "-Wl($| )" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}") -endif() - -check_c_source_compiles(" -#include <execinfo.h> -int main(void) -{ - void *trace[1]; - backtrace(trace, 1); - return 0; -} -" HAVE_EXECINFO_BACKTRACE) - -check_c_source_compiles(" -int main(void) -{ - int a = 42; - __builtin_add_overflow(a, a, &a); - __builtin_sub_overflow(a, a, &a); - return 0; -} -" HAVE_BUILTIN_ADD_OVERFLOW) - -option(ENABLE_COMPILER_SUGGESTIONS "Enable -Wsuggest compiler warnings" OFF) -if(MSVC) - # XXX: /W4 gives too many warnings. #3241 - add_compile_options(-W1 -wd4311) - add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE) - add_definitions(-DMSWIN) -else() - add_compile_options(-Wall -Wextra -pedantic -Wno-unused-parameter - -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion - -Wdouble-promotion - -Wmissing-noreturn - -Wmissing-format-attribute - -Wmissing-prototypes) - - check_c_compiler_flag(-Wimplicit-fallthrough HAVE_WIMPLICIT_FALLTHROUGH_FLAG) - if(HAVE_WIMPLICIT_FALLTHROUGH_FLAG) - add_compile_options(-Wimplicit-fallthrough) - endif() - - if(ENABLE_COMPILER_SUGGESTIONS) - # Clang doesn't have -Wsuggest-attribute so check for each one. - check_c_compiler_flag(-Wsuggest-attribute=pure HAVE_WSUGGEST_ATTRIBUTE_PURE) - if(HAVE_WSUGGEST_ATTRIBUTE_PURE) - add_compile_options(-Wsuggest-attribute=pure) - endif() - - check_c_compiler_flag(-Wsuggest-attribute=const HAVE_WSUGGEST_ATTRIBUTE_CONST) - if(HAVE_WSUGGEST_ATTRIBUTE_CONST) - add_compile_options(-Wsuggest-attribute=const) - endif() - - check_c_compiler_flag(-Wsuggest-attribute=malloc HAVE_WSUGGEST_ATTRIBUTE_MALLOC) - if(HAVE_WSUGGEST_ATTRIBUTE_MALLOC) - add_compile_options(-Wsuggest-attribute=malloc) - endif() - - check_c_compiler_flag(-Wsuggest-attribute=cold HAVE_WSUGGEST_ATTRIBUTE_COLD) - if(HAVE_WSUGGEST_ATTRIBUTE_COLD) - add_compile_options(-Wsuggest-attribute=cold) - endif() - endif() - - # On FreeBSD 64 math.h uses unguarded C11 extension, which taints clang - # 3.4.1 used there. - if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND CMAKE_C_COMPILER_ID MATCHES "Clang") - add_compile_options(-Wno-c11-extensions) - endif() -endif() - -if(MINGW) - # Use POSIX compatible stdio in Mingw - add_definitions(-D__USE_MINGW_ANSI_STDIO) - add_definitions(-DMSWIN) -endif() -if(WIN32) - # Windows Vista is the minimum supported version - add_definitions(-D_WIN32_WINNT=0x0600) -endif() - -# OpenBSD's GCC (4.2.1) doesn't have -Wvla -check_c_compiler_flag(-Wvla HAS_WVLA_FLAG) -if(HAS_WVLA_FLAG) - add_compile_options(-Wvla) -endif() - -if(UNIX) - # -fstack-protector breaks non Unix builds even in Mingw-w64 - check_c_compiler_flag(-fstack-protector-strong HAS_FSTACK_PROTECTOR_STRONG_FLAG) - check_c_compiler_flag(-fstack-protector HAS_FSTACK_PROTECTOR_FLAG) - - if(HAS_FSTACK_PROTECTOR_STRONG_FLAG) - add_compile_options(-fstack-protector-strong) - link_libraries(-fstack-protector-strong) - elseif(HAS_FSTACK_PROTECTOR_FLAG) - add_compile_options(-fstack-protector --param ssp-buffer-size=4) - link_libraries(-fstack-protector --param ssp-buffer-size=4) - endif() -endif() - -check_c_compiler_flag(-fno-common HAVE_FNO_COMMON) -if (HAVE_FNO_COMMON) - add_compile_options(-fno-common) -endif() - -check_c_compiler_flag(-fdiagnostics-color=auto HAS_DIAG_COLOR_FLAG) -if(HAS_DIAG_COLOR_FLAG) - if(CMAKE_GENERATOR MATCHES "Ninja") - add_compile_options(-fdiagnostics-color=always) - else() - add_compile_options(-fdiagnostics-color=auto) - endif() -endif() - -option(CI_BUILD "CI, extra flags will be set" OFF) - -if(CI_BUILD) - message(STATUS "CI build enabled") - if(MSVC) - add_compile_options(-WX) - else() - add_compile_options(-Werror) - if(DEFINED ENV{BUILD_UCHAR}) - # Get some test coverage for unsigned char - add_compile_options(-funsigned-char) - endif() - endif() -endif() - option(LOG_LIST_ACTIONS "Add list actions logging" OFF) -add_definitions(-DINCLUDE_GENERATED_DECLARATIONS) - -if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang") - if(CMAKE_SYSTEM_NAME STREQUAL "SunOS") - set(NO_UNDEFINED "-Wl,--no-undefined -lsocket") - elseif(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin") - set(NO_UNDEFINED "-Wl,--no-undefined") - endif() - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${NO_UNDEFINED}") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${NO_UNDEFINED}") - - # For O_CLOEXEC, O_DIRECTORY, and O_NOFOLLOW flags on older systems - # (pre POSIX.1-2008: glibc 2.11 and earlier). #4042 - # For ptsname(). #6743 - add_definitions(-D_GNU_SOURCE) -endif() - -include_directories("${PROJECT_BINARY_DIR}/cmake.config") -include_directories("${PROJECT_SOURCE_DIR}/src") - -find_package(LibUV 1.28.0 REQUIRED) -include_directories(SYSTEM ${LIBUV_INCLUDE_DIRS}) - -find_package(Msgpack 1.0.0 REQUIRED) -include_directories(SYSTEM ${MSGPACK_INCLUDE_DIRS}) - -find_package(LibLUV 1.43.0 REQUIRED) -include_directories(SYSTEM ${LIBLUV_INCLUDE_DIRS}) - -find_package(TreeSitter REQUIRED) -include_directories(SYSTEM ${TreeSitter_INCLUDE_DIRS}) - -list(APPEND CMAKE_REQUIRED_INCLUDES "${TreeSitter_INCLUDE_DIRS}") -list(APPEND CMAKE_REQUIRED_LIBRARIES "${TreeSitter_LIBRARIES}") -check_c_source_compiles(" -#include <tree_sitter/api.h> -int -main(void) -{ - TSQueryCursor *cursor = ts_query_cursor_new(); - ts_query_cursor_set_match_limit(cursor, 32); - return 0; -} -" TS_HAS_SET_MATCH_LIMIT) -if(TS_HAS_SET_MATCH_LIMIT) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNVIM_TS_HAS_SET_MATCH_LIMIT") -endif() -check_c_source_compiles(" -#include <stdlib.h> -#include <tree_sitter/api.h> -int -main(void) -{ - ts_set_allocator(malloc, calloc, realloc, free); - return 0; -} -" TS_HAS_SET_ALLOCATOR) -if(TS_HAS_SET_ALLOCATOR) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNVIM_TS_HAS_SET_ALLOCATOR") -endif() - -# The unit test lib requires LuaJIT; it will be skipped if LuaJIT is missing. -option(PREFER_LUA "Prefer Lua over LuaJIT in the nvim executable." OFF) - -if(PREFER_LUA) - find_package(Lua 5.1 EXACT REQUIRED) - set(LUA_PREFERRED_INCLUDE_DIRS ${LUA_INCLUDE_DIR}) - set(LUA_PREFERRED_LIBRARIES ${LUA_LIBRARIES}) - # Passive (not REQUIRED): if LUAJIT_FOUND is not set, nvim-test is skipped. - find_package(LuaJit) -else() - find_package(LuaJit REQUIRED) - set(LUA_PREFERRED_INCLUDE_DIRS ${LUAJIT_INCLUDE_DIRS}) - set(LUA_PREFERRED_LIBRARIES ${LUAJIT_LIBRARIES}) -endif() - -list(APPEND CMAKE_REQUIRED_INCLUDES "${MSGPACK_INCLUDE_DIRS}") -check_c_source_compiles(" -#include <msgpack.h> - -int -main(void) -{ - return MSGPACK_OBJECT_FLOAT32; -} -" MSGPACK_HAS_FLOAT32) -list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${MSGPACK_INCLUDE_DIRS}") -if(MSGPACK_HAS_FLOAT32) - add_definitions(-DNVIM_MSGPACK_HAS_FLOAT32) -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> - -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}) - option(CLANG_ASAN_UBSAN "Enable Clang address & undefined behavior sanitizer for nvim binary." OFF) option(CLANG_MSAN "Enable Clang memory sanitizer for nvim binary." OFF) option(CLANG_TSAN "Enable Clang thread sanitizer for nvim binary." OFF) @@ -529,22 +220,6 @@ if((CLANG_ASAN_UBSAN OR CLANG_MSAN OR CLANG_TSAN) AND NOT CMAKE_C_COMPILER_ID MA message(FATAL_ERROR "Sanitizers are only supported for Clang") endif() -if(ENABLE_LIBICONV) - find_package(Iconv REQUIRED) - include_directories(SYSTEM ${Iconv_INCLUDE_DIRS}) -endif() - -if(ENABLE_LIBINTL) - # LibIntl (not Intl) selects our FindLibIntl.cmake script. #8464 - find_package(LibIntl REQUIRED) - include_directories(SYSTEM ${LibIntl_INCLUDE_DIRS}) -endif() - -# Determine platform's threading library. Set CMAKE_THREAD_PREFER_PTHREAD -# explicitly to indicate a strong preference for pthread. -set(CMAKE_THREAD_PREFER_PTHREAD ON) -find_package(Threads REQUIRED) - # Place targets in bin/ or lib/ for all build configurations set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) @@ -556,8 +231,6 @@ foreach(CFGNAME ${CMAKE_CONFIGURATION_TYPES}) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFGNAME} ${CMAKE_BINARY_DIR}/lib) endforeach() -# Find Lua interpreter -include(LuaHelpers) set(LUA_DEPENDENCIES lpeg mpack bit) if(NOT LUA_PRG) foreach(CURRENT_LUA_PRG luajit lua5.1 lua5.2 lua) @@ -607,13 +280,6 @@ if(LUAC_PRG) message(STATUS "Using Lua compiler: ${LUAC_PRG}") endif() -# Setup busted. -find_program(BUSTED_PRG NAMES busted busted.bat) -find_program(BUSTED_LUA_PRG busted-lua) -if(NOT BUSTED_OUTPUT_TYPE) - set(BUSTED_OUTPUT_TYPE "nvim") -endif() - # # Lint # @@ -644,8 +310,6 @@ add_glob_target( add_custom_target(lintlua) add_dependencies(lintlua lintlua-luacheck lintlua-stylua) -include(InstallHelpers) - add_glob_target( TARGET lintsh COMMAND ${SHELLCHECK_PRG} @@ -685,6 +349,11 @@ install_helper( FILES ${CMAKE_SOURCE_DIR}/src/man/nvim.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) +option(ENABLE_LIBICONV "enable libiconv" ON) +if(ENABLE_LIBICONV) + find_package(Iconv REQUIRED) +endif() + # # Go down the tree. # @@ -702,17 +371,17 @@ if(WIN32) DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim-qt/runtime/plugin) endif() +# Setup busted. +find_program(BUSTED_PRG NAMES busted busted.bat) +find_program(BUSTED_LUA_PRG busted-lua) +if(NOT BUSTED_OUTPUT_TYPE) + set(BUSTED_OUTPUT_TYPE "nvim") +endif() + # Setup some test-related bits. We do this after going down the tree because we # need some of the targets. if(BUSTED_PRG) - get_property(TEST_INCLUDE_DIRS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - PROPERTY INCLUDE_DIRECTORIES) - - # When running tests from 'ninja' we need to use the - # console pool: to do so we need to use the USES_TERMINAL - # option, but this is only available in CMake 3.2 - set(TEST_TARGET_ARGS) - list(APPEND TEST_TARGET_ARGS "USES_TERMINAL") + get_target_property(TEST_INCLUDE_DIRS main_lib INTERFACE_INCLUDE_DIRECTORIES) set(UNITTEST_PREREQS nvim-test unittest-headers) set(FUNCTIONALTEST_PREREQS nvim printenv-test printargs-test shell-test pwsh-test streams-test tty-test ${GENERATED_HELP_TAGS}) @@ -732,7 +401,7 @@ if(BUSTED_PRG) -DCIRRUS_CI=$ENV{CIRRUS_CI} -P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake DEPENDS ${UNITTEST_PREREQS} - ${TEST_TARGET_ARGS}) + USES_TERMINAL) set_target_properties(unittest PROPERTIES FOLDER test) else() message(WARNING "disabling unit tests: no Luajit FFI in ${LUA_PRG}") @@ -763,7 +432,7 @@ if(BUSTED_PRG) -DCIRRUS_CI=$ENV{CIRRUS_CI} -P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake DEPENDS ${FUNCTIONALTEST_PREREQS} - ${TEST_TARGET_ARGS}) + USES_TERMINAL) set_target_properties(functionaltest PROPERTIES FOLDER test) add_custom_target(benchmark @@ -779,7 +448,7 @@ if(BUSTED_PRG) -DCIRRUS_CI=$ENV{CIRRUS_CI} -P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake DEPENDS ${BENCHMARK_PREREQS} - ${TEST_TARGET_ARGS}) + USES_TERMINAL) set_target_properties(benchmark PROPERTIES FOLDER test) endif() @@ -797,7 +466,7 @@ if(BUSTED_LUA_PRG) -DCIRRUS_CI=$ENV{CIRRUS_CI} -P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake DEPENDS ${FUNCTIONALTEST_PREREQS} - ${TEST_TARGET_ARGS}) + USES_TERMINAL) set_target_properties(functionaltest-lua PROPERTIES FOLDER test) endif() diff --git a/ci/snap/.snapcraft_payload b/ci/snap/.snapcraft_payload deleted file mode 100644 index 29f895fad6..0000000000 --- a/ci/snap/.snapcraft_payload +++ /dev/null @@ -1,194 +0,0 @@ -{ - "ref": "refs/heads/master", - "before": "66b136c43c12df3dcf8f19ff48f206ad2e4f43fc", - "after": "1bf69c32217cc455603ce8aa2b5415d9717f0fa2", - "repository": { - "id": 292861950, - "node_id": "MDEwOlJlcG9zaXRvcnkyOTI4NjE5NTA=", - "name": "neovim-snap", - "full_name": "hurricanehrndz/neovim-snap", - "private": false, - "owner": { - "name": "hurricanehrndz", - "email": "hurricanehrndz@users.noreply.github.com", - "login": "hurricanehrndz", - "id": 5804237, - "node_id": "MDQ6VXNlcjU4MDQyMzc=", - "avatar_url": "https://avatars0.githubusercontent.com/u/5804237?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/hurricanehrndz", - "html_url": "https://github.com/hurricanehrndz", - "followers_url": "https://api.github.com/users/hurricanehrndz/followers", - "following_url": "https://api.github.com/users/hurricanehrndz/following{/other_user}", - "gists_url": "https://api.github.com/users/hurricanehrndz/gists{/gist_id}", - "starred_url": "https://api.github.com/users/hurricanehrndz/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/hurricanehrndz/subscriptions", - "organizations_url": "https://api.github.com/users/hurricanehrndz/orgs", - "repos_url": "https://api.github.com/users/hurricanehrndz/repos", - "events_url": "https://api.github.com/users/hurricanehrndz/events{/privacy}", - "received_events_url": "https://api.github.com/users/hurricanehrndz/received_events", - "type": "User", - "site_admin": false - }, - "html_url": "https://github.com/hurricanehrndz/neovim-snap", - "description": "snap build for neovim", - "fork": false, - "url": "https://github.com/hurricanehrndz/neovim-snap", - "forks_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/forks", - "keys_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/keys{/key_id}", - "collaborators_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/collaborators{/collaborator}", - "teams_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/teams", - "hooks_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/hooks", - "issue_events_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/issues/events{/number}", - "events_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/events", - "assignees_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/assignees{/user}", - "branches_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/branches{/branch}", - "tags_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/tags", - "blobs_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/git/blobs{/sha}", - "git_tags_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/git/tags{/sha}", - "git_refs_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/git/refs{/sha}", - "trees_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/git/trees{/sha}", - "statuses_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/statuses/{sha}", - "languages_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/languages", - "stargazers_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/stargazers", - "contributors_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/contributors", - "subscribers_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/subscribers", - "subscription_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/subscription", - "commits_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/commits{/sha}", - "git_commits_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/git/commits{/sha}", - "comments_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/comments{/number}", - "issue_comment_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/issues/comments{/number}", - "contents_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/contents/{+path}", - "compare_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/compare/{base}...{head}", - "merges_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/merges", - "archive_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/{archive_format}{/ref}", - "downloads_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/downloads", - "issues_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/issues{/number}", - "pulls_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/pulls{/number}", - "milestones_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/milestones{/number}", - "notifications_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/notifications{?since,all,participating}", - "labels_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/labels{/name}", - "releases_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/releases{/id}", - "deployments_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/deployments", - "created_at": 1599227980, - "updated_at": "2020-09-04T14:02:38Z", - "pushed_at": 1599228352, - "git_url": "git://github.com/hurricanehrndz/neovim-snap.git", - "ssh_url": "git@github.com:hurricanehrndz/neovim-snap.git", - "clone_url": "https://github.com/hurricanehrndz/neovim-snap.git", - "svn_url": "https://github.com/hurricanehrndz/neovim-snap", - "homepage": null, - "size": 0, - "stargazers_count": 0, - "watchers_count": 0, - "language": null, - "has_issues": true, - "has_projects": true, - "has_downloads": true, - "has_wiki": true, - "has_pages": false, - "forks_count": 0, - "mirror_url": null, - "archived": false, - "disabled": false, - "open_issues_count": 0, - "license": { - "key": "mit", - "name": "MIT License", - "spdx_id": "MIT", - "url": "https://api.github.com/licenses/mit", - "node_id": "MDc6TGljZW5zZTEz" - }, - "forks": 0, - "open_issues": 0, - "watchers": 0, - "default_branch": "master", - "stargazers": 0, - "master_branch": "master" - }, - "pusher": { - "name": "hurricanehrndz", - "email": "hurricanehrndz@users.noreply.github.com" - }, - "sender": { - "login": "hurricanehrndz", - "id": 5804237, - "node_id": "MDQ6VXNlcjU4MDQyMzc=", - "avatar_url": "https://avatars0.githubusercontent.com/u/5804237?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/hurricanehrndz", - "html_url": "https://github.com/hurricanehrndz", - "followers_url": "https://api.github.com/users/hurricanehrndz/followers", - "following_url": "https://api.github.com/users/hurricanehrndz/following{/other_user}", - "gists_url": "https://api.github.com/users/hurricanehrndz/gists{/gist_id}", - "starred_url": "https://api.github.com/users/hurricanehrndz/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/hurricanehrndz/subscriptions", - "organizations_url": "https://api.github.com/users/hurricanehrndz/orgs", - "repos_url": "https://api.github.com/users/hurricanehrndz/repos", - "events_url": "https://api.github.com/users/hurricanehrndz/events{/privacy}", - "received_events_url": "https://api.github.com/users/hurricanehrndz/received_events", - "type": "User", - "site_admin": false - }, - "created": false, - "deleted": false, - "forced": false, - "base_ref": null, - "compare": "https://github.com/hurricanehrndz/neovim-snap/compare/66b136c43c12...1bf69c32217c", - "commits": [ - { - "id": "1bf69c32217cc455603ce8aa2b5415d9717f0fa2", - "tree_id": "62ea83a2349be8c930c45fdc199f71b08bf5927e", - "distinct": true, - "message": "Build of latest tag", - "timestamp": "2020-09-04T14:05:40Z", - "url": "https://github.com/hurricanehrndz/neovim-snap/commit/1bf69c32217cc455603ce8aa2b5415d9717f0fa2", - "author": { - "name": "Carlos Hernandez", - "email": "carlos@techbyte.ca", - "username": "hurricanehrndz" - }, - "committer": { - "name": "Carlos Hernandez", - "email": "carlos@techbyte.ca", - "username": "hurricanehrndz" - }, - "added": [ - - ], - "removed": [ - - ], - "modified": [ - "snap/snapcraft.yaml" - ] - } - ], - "head_commit": { - "id": "1bf69c32217cc455603ce8aa2b5415d9717f0fa2", - "tree_id": "62ea83a2349be8c930c45fdc199f71b08bf5927e", - "distinct": true, - "message": "Build of latest tag", - "timestamp": "2020-09-04T14:05:40Z", - "url": "https://github.com/hurricanehrndz/neovim-snap/commit/1bf69c32217cc455603ce8aa2b5415d9717f0fa2", - "author": { - "name": "Carlos Hernandez", - "email": "carlos@techbyte.ca", - "username": "hurricanehrndz" - }, - "committer": { - "name": "Carlos Hernandez", - "email": "carlos@techbyte.ca", - "username": "hurricanehrndz" - }, - "added": [ - - ], - "removed": [ - - ], - "modified": [ - "snap/snapcraft.yaml" - ] - } -} diff --git a/ci/snap/after_success.sh b/ci/snap/after_success.sh deleted file mode 100755 index e66721a5e2..0000000000 --- a/ci/snap/after_success.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - - -RESULT_SNAP=$(find ./ -name "*.snap") - -sudo snap install "$RESULT_SNAP" --dangerous --classic - -/snap/bin/nvim --version - -SHA256=$(sha256sum "$RESULT_SNAP") -echo "SHA256: ${SHA256} ." diff --git a/ci/snap/deploy.sh b/ci/snap/deploy.sh deleted file mode 100755 index 1794fc61d9..0000000000 --- a/ci/snap/deploy.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -SNAP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -WEBHOOK_PAYLOAD="$(cat "${SNAP_DIR}/.snapcraft_payload")" -PAYLOAD_SIG="${SECRET_SNAP_SIG}" - - -snap_release_needed() { - last_committed_tag="$(git tag -l --sort=refname|head -1)" - last_snap_release="$(snap info nvim | awk '$1 == "latest/edge:" { print $2 }' | perl -lpe 's/v\d.\d.\d-//g')" - git fetch -f --tags - git checkout "${last_committed_tag}" 2> /dev/null - last_git_release="$(git describe --first-parent 2> /dev/null | perl -lpe 's/v\d.\d.\d-//g')" - - if [[ -z "$(echo $last_snap_release | perl -ne "print if /${last_git_release}.*/")" ]]; then - return 0 - fi - return 1 -} - - -trigger_snapcraft_webhook() { - [[ -n "${PAYLOAD_SIG}" ]] || exit - echo "Triggering new snap release via webhook..." - curl -X POST \ - -H "Content-Type: application/json" \ - -H "X-Hub-Signature: sha1=${PAYLOAD_SIG}" \ - --data "${WEBHOOK_PAYLOAD}" \ - https://snapcraft.io/nvim/webhook/notify -} - - -if $(snap_release_needed); then - echo "New snap release required" - trigger_snapcraft_webhook -fi diff --git a/ci/snap/install.sh b/ci/snap/install.sh deleted file mode 100755 index 0ceb6f0422..0000000000 --- a/ci/snap/install.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -sudo apt update -sudo usermod -aG lxd $USER -sudo /snap/bin/lxd.migrate -yes -sudo /snap/bin/lxd waitready -sudo /snap/bin/lxd init --auto - diff --git a/ci/snap/script.sh b/ci/snap/script.sh deleted file mode 100755 index 21d3421044..0000000000 --- a/ci/snap/script.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -mkdir -p "$CI_BUILD_DIR/snaps-cache" -sg lxd -c snapcraft - diff --git a/ci/snap/travis_snapcraft.cfg b/ci/snap/travis_snapcraft.cfg Binary files differdeleted file mode 100644 index 3e6a60c30d..0000000000 --- a/ci/snap/travis_snapcraft.cfg +++ /dev/null diff --git a/cmake.config/CMakeLists.txt b/cmake.config/CMakeLists.txt index 183954b889..0ea2124401 100644 --- a/cmake.config/CMakeLists.txt +++ b/cmake.config/CMakeLists.txt @@ -5,6 +5,26 @@ include(CheckIncludeFiles) include(CheckCSourceRuns) include(CheckCSourceCompiles) +check_c_source_compiles(" +#include <execinfo.h> +int main(void) +{ + void *trace[1]; + backtrace(trace, 1); + return 0; +} +" HAVE_EXECINFO_BACKTRACE) + +check_c_source_compiles(" +int main(void) +{ + int a = 42; + __builtin_add_overflow(a, a, &a); + __builtin_sub_overflow(a, a, &a); + return 0; +} +" HAVE_BUILTIN_ADD_OVERFLOW) + check_type_size("int" SIZEOF_INT LANGUAGE C) check_type_size("long" SIZEOF_LONG LANGUAGE C) check_type_size("intmax_t" SIZEOF_INTMAX_T LANGUAGE C) diff --git a/cmake/FindIconv.cmake b/cmake/FindIconv.cmake index 1d0164dae9..63290fe889 100644 --- a/cmake/FindIconv.cmake +++ b/cmake/FindIconv.cmake @@ -1,3 +1,6 @@ +# TODO(dundargoc): FindIconv is shipped by default on cmake version 3.11+. This +# file can be removed once we decide to upgrade minimum cmake version. + # - Try to find iconv # Once done, this will define # diff --git a/cmake/GetCompileFlags.cmake b/cmake/GetCompileFlags.cmake index 3b027690f8..9b3c053871 100644 --- a/cmake/GetCompileFlags.cmake +++ b/cmake/GetCompileFlags.cmake @@ -1,79 +1,57 @@ function(get_compile_flags _compile_flags) - # Create template akin to CMAKE_C_COMPILE_OBJECT. - set(compile_flags "<CMAKE_C_COMPILER> <CFLAGS> <BUILD_TYPE_CFLAGS> <COMPILE_OPTIONS><COMPILE_DEFINITIONS> <INCLUDES>") + string(TOUPPER "${CMAKE_BUILD_TYPE}" build_type) + set(compile_flags ${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${build_type}}) - string(REPLACE - "<CMAKE_C_COMPILER>" - "${CMAKE_C_COMPILER}" - compile_flags - "${compile_flags}") + # Get flags set by target_compile_options(). + get_target_property(opt main_lib INTERFACE_COMPILE_OPTIONS) + if(opt) + list(APPEND compile_flags ${opt}) + endif() - # Get flags set by add_definitions(). - get_property(compile_definitions DIRECTORY PROPERTY COMPILE_DEFINITIONS) - get_target_property(compile_definitions_target nvim COMPILE_DEFINITIONS) - if(compile_definitions_target) - list(APPEND compile_definitions ${compile_definitions_target}) - list(REMOVE_DUPLICATES compile_definitions) + get_target_property(opt nvim COMPILE_OPTIONS) + if(opt) + list(APPEND compile_flags ${opt}) endif() - # NOTE: list(JOIN) requires CMake 3.12, string(CONCAT) requires CMake 3. - string(REPLACE ";" " -D" compile_definitions "${compile_definitions}") - if(compile_definitions) - set(compile_definitions " -D${compile_definitions}") + + # Get flags set by target_compile_definitions(). + get_target_property(defs main_lib INTERFACE_COMPILE_DEFINITIONS) + if(defs) + foreach(def ${defs}) + list(APPEND compile_flags "-D${def}") + endforeach() endif() - string(REPLACE - "<COMPILE_DEFINITIONS>" - "${compile_definitions}" - compile_flags - "${compile_flags}") - # Get flags set by add_compile_options(). - get_property(compile_options DIRECTORY PROPERTY COMPILE_OPTIONS) - get_target_property(compile_options_target nvim COMPILE_OPTIONS) - if(compile_options_target) - list(APPEND compile_options ${compile_options_target}) - list(REMOVE_DUPLICATES compile_options) + get_target_property(defs nvim COMPILE_DEFINITIONS) + if(defs) + foreach(def ${defs}) + list(APPEND compile_flags "-D${def}") + endforeach() endif() - # NOTE: list(JOIN) requires CMake 3.12. - string(REPLACE ";" " " compile_options "${compile_options}") - string(REPLACE - "<COMPILE_OPTIONS>" - "${compile_options}" - compile_flags - "${compile_flags}") - # Get general C flags. - string(REPLACE - "<CFLAGS>" - "${CMAKE_C_FLAGS}" - compile_flags - "${compile_flags}") + # Get include directories. + get_target_property(dirs main_lib INTERFACE_INCLUDE_DIRECTORIES) + if(dirs) + foreach(dir ${dirs}) + list(APPEND compile_flags "-I${dir}") + endforeach() + endif() - # Get C flags specific to build type. - string(TOUPPER "${CMAKE_BUILD_TYPE}" build_type) - string(REPLACE - "<BUILD_TYPE_CFLAGS>" - "${CMAKE_C_FLAGS_${build_type}}" - compile_flags - "${compile_flags}") + get_target_property(dirs main_lib INTERFACE_SYSTEM_INCLUDE_DIRECTORIES) + if(dirs) + foreach(dir ${dirs}) + list(APPEND compile_flags "-I${dir}") + endforeach() + endif() - # Get include directories. - get_property(include_directories_list DIRECTORY PROPERTY INCLUDE_DIRECTORIES) - list(REMOVE_DUPLICATES include_directories_list) - foreach(include_directory ${include_directories_list}) - set(include_directories "${include_directories} -I${include_directory}") - endforeach() - string(REPLACE - "<INCLUDES>" - "${include_directories}" - compile_flags - "${compile_flags}") + get_target_property(dirs nvim INCLUDE_DIRECTORIES) + if(dirs) + foreach(dir ${dirs}) + list(APPEND compile_flags "-I${dir}") + endforeach() + endif() - # Clean duplicate whitespace. - string(REPLACE - " " - " " - compile_flags - "${compile_flags}") + list(REMOVE_DUPLICATES compile_flags) + string(REPLACE ";" " " compile_flags "${compile_flags}") set(${_compile_flags} "${compile_flags}" PARENT_SCOPE) endfunction() diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index c827da4554..d74657dc8e 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -2995,6 +2995,7 @@ nvim_open_win({buffer}, {enter}, {*config}) *nvim_open_win()* • "win" Window given by the `win` field, or current window. • "cursor" Cursor position in current window. + • "mouse" Mouse position • win: |window-ID| for relative="win". • anchor: Decides which corner of the float to place at diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index cf82cbf204..aff0f9a793 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -1612,6 +1612,7 @@ make_floating_popup_options({width}, {height}, {opts}) • border (string or table) override `border` • focusable (string or table) override `focusable` • zindex (string or table) override `zindex`, defaults to 50 + • relative ("mouse"|"cursor") defaults to "cursor" Return: ~ (table) Options diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index e262b7b82a..ccd48a8959 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -698,8 +698,8 @@ To avoid mapping of the characters you type in insert or Command-line mode, type a CTRL-V first. The mapping in Insert mode is disabled if the 'paste' option is on. *map-error* -Note that when an error is encountered (that causes an error message or beep) -the rest of the mapping is not executed. This is Vi-compatible. +Note that when an error is encountered (that causes an error message or might +cause a beep) the rest of the mapping is not executed. This is Vi-compatible. Note that the second character (argument) of the commands @zZtTfF[]rm'`"v and CTRL-X is not mapped. This was done to be able to use all the named diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 88bad1b7df..7dceaa3318 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -50,6 +50,10 @@ NEW FEATURES *news-features* The following new APIs or features were added. +• |nvim_open_win()| now accepts a relative `mouse` option to open a floating win + relative to the mouse. Note that the mouse doesn't update frequently without + setting `vim.o.mousemoveevent = true` + • EditorConfig support is now builtin. This is enabled by default and happens automatically. To disable it, users should add >lua diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index aa2f528d1b..4498dda300 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -6071,6 +6071,8 @@ A jump table for the options with a short description can be found at |Q_op|. When there is error while evaluating the option then it will be made empty to avoid further errors. Otherwise screen updating would loop. + When the result contains unprintable characters the result is + unpredictable. Note that the only effect of 'ruler' when this option is set (and 'laststatus' is 2 or 3) is controlling the output of |CTRL-G|. diff --git a/runtime/doc/userfunc.txt b/runtime/doc/userfunc.txt index 4d000efc1e..9c428175bb 100644 --- a/runtime/doc/userfunc.txt +++ b/runtime/doc/userfunc.txt @@ -180,7 +180,16 @@ See |:verbose-cmd| for more information. the number 0 is returned. Note that there is no check for unreachable lines, thus there is no warning if commands follow ":return". - + Also, there is no check if the following + line contains a valid command. Forgetting the line + continuation backslash may go unnoticed: > + return 'some text' + .. ' some more text' +< Will happily return "some text" without an error. It + should have been: > + return 'some text' + \ .. ' some more text' +< If the ":return" is used after a |:try| but before the matching |:finally| (if present), the commands following the ":finally" up to the matching |:endtry| diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index c3ab39a1a3..7a1b79bba2 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -949,6 +949,7 @@ local extension = { ice = 'slice', score = 'slrnsc', sol = 'solidity', + smali = 'smali', tpl = 'smarty', ihlp = 'smcl', smcl = 'smcl', diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua index 80df83732e..b383ca1c35 100644 --- a/runtime/lua/vim/lsp/handlers.lua +++ b/runtime/lua/vim/lsp/handlers.lua @@ -335,7 +335,9 @@ function M.hover(_, result, ctx, config) return end if not (result and result.contents) then - vim.notify('No information available') + if config.silent ~= true then + vim.notify('No information available') + end return end local markdown_lines = util.convert_input_to_markdown_lines(result.contents) diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index 2c6ba823db..26f0e180f5 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -1015,6 +1015,7 @@ end --- - border (string or table) override `border` --- - focusable (string or table) override `focusable` --- - zindex (string or table) override `zindex`, defaults to 50 +--- - relative ("mouse"|"cursor") defaults to "cursor" ---@returns (table) Options function M.make_floating_popup_options(width, height, opts) validate({ @@ -1029,7 +1030,8 @@ function M.make_floating_popup_options(width, height, opts) local anchor = '' local row, col - local lines_above = vim.fn.winline() - 1 + local lines_above = opts.relative == 'mouse' and vim.fn.getmousepos().line - 1 + or vim.fn.winline() - 1 local lines_below = vim.fn.winheight(0) - lines_above if lines_above < lines_below then @@ -1042,7 +1044,9 @@ function M.make_floating_popup_options(width, height, opts) row = 0 end - if vim.fn.wincol() + width + (opts.offset_x or 0) <= api.nvim_get_option('columns') then + local wincol = opts.relative == 'mouse' and vim.fn.getmousepos().column or vim.fn.wincol() + + if wincol + width + (opts.offset_x or 0) <= api.nvim_get_option('columns') then anchor = anchor .. 'W' col = 0 else @@ -1062,7 +1066,7 @@ function M.make_floating_popup_options(width, height, opts) col = col + (opts.offset_x or 0), height = height, focusable = opts.focusable, - relative = 'cursor', + relative = opts.relative == 'mouse' and 'mouse' or 'cursor', row = row + (opts.offset_y or 0), style = 'minimal', width = width, diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index ac982e8be8..46191faf62 100755 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -1,25 +1,338 @@ -option(USE_GCOV "Enable gcov support" OFF) +add_library(main_lib INTERFACE) +add_executable(nvim main.c) + +add_library(libuv_lib INTERFACE) +find_package(LibUV 1.28.0 REQUIRED) +target_include_directories(libuv_lib SYSTEM INTERFACE ${LIBUV_INCLUDE_DIRS}) +target_link_libraries(libuv_lib INTERFACE ${LIBUV_LIBRARIES}) + +find_package(Msgpack 1.0.0 REQUIRED) +target_include_directories(main_lib SYSTEM INTERFACE ${MSGPACK_INCLUDE_DIRS}) +target_link_libraries(main_lib INTERFACE ${MSGPACK_LIBRARIES}) + +find_package(LibLUV 1.43.0 REQUIRED) +target_include_directories(main_lib SYSTEM INTERFACE ${LIBLUV_INCLUDE_DIRS}) +# Use "luv" as imported library, to work around CMake using "-lluv" for +# "luv.so". #10407 +add_library(luv UNKNOWN IMPORTED) +set_target_properties(luv PROPERTIES IMPORTED_LOCATION ${LIBLUV_LIBRARIES}) +target_link_libraries(main_lib INTERFACE luv) + +find_package(TreeSitter REQUIRED) +target_include_directories(main_lib SYSTEM INTERFACE ${TreeSitter_INCLUDE_DIRS}) +target_link_libraries(main_lib INTERFACE ${TreeSitter_LIBRARIES}) + +find_package(UNIBILIUM 2.0 REQUIRED) +target_include_directories(main_lib SYSTEM INTERFACE ${UNIBILIUM_INCLUDE_DIRS}) +target_link_libraries(main_lib INTERFACE ${UNIBILIUM_LIBRARIES}) + +find_package(LibTermkey 0.22 REQUIRED) +target_include_directories(main_lib SYSTEM INTERFACE ${LIBTERMKEY_INCLUDE_DIRS}) +target_link_libraries(main_lib INTERFACE ${LIBTERMKEY_LIBRARIES}) + +find_package(LIBVTERM 0.3 REQUIRED) +target_include_directories(main_lib SYSTEM INTERFACE ${LIBVTERM_INCLUDE_DIRS}) +target_link_libraries(main_lib INTERFACE ${LIBVTERM_LIBRARIES}) + +if(Iconv_FOUND) + target_include_directories(main_lib SYSTEM INTERFACE ${Iconv_INCLUDE_DIRS}) + if(Iconv_LIBRARIES) + target_link_libraries(main_lib INTERFACE ${Iconv_LIBRARIES}) + endif() +endif() + +option(ENABLE_LIBINTL "enable libintl" ON) +if(ENABLE_LIBINTL) + # LibIntl (not Intl) selects our FindLibIntl.cmake script. #8464 + find_package(LibIntl REQUIRED) + target_include_directories(main_lib SYSTEM INTERFACE ${LibIntl_INCLUDE_DIRS}) + if (LibIntl_FOUND) + target_link_libraries(main_lib INTERFACE ${LibIntl_LIBRARY}) + endif() +endif() + +# The unit test lib requires LuaJIT; it will be skipped if LuaJIT is missing. +option(PREFER_LUA "Prefer Lua over LuaJIT in the nvim executable." OFF) +if(PREFER_LUA) + find_package(Lua 5.1 EXACT REQUIRED) + target_include_directories(main_lib SYSTEM INTERFACE ${LUA_INCLUDE_DIR}) + target_link_libraries(main_lib INTERFACE ${LUA_LIBRARIES}) + # Passive (not REQUIRED): if LUAJIT_FOUND is not set, nvim-test is skipped. + find_package(LuaJit) +else() + find_package(LuaJit REQUIRED) + target_include_directories(main_lib SYSTEM INTERFACE ${LUAJIT_INCLUDE_DIRS}) + target_link_libraries(main_lib INTERFACE ${LUAJIT_LIBRARIES}) +endif() +# Determine platform's threading library. Set CMAKE_THREAD_PREFER_PTHREAD +# explicitly to indicate a strong preference for pthread. +set(CMAKE_THREAD_PREFER_PTHREAD ON) +find_package(Threads REQUIRED) +target_link_libraries(main_lib INTERFACE ${CMAKE_THREAD_LIBS_INIT}) + +option(ENABLE_IWYU "Run include-what-you-use with the compiler." OFF) +if(ENABLE_IWYU) + find_program(IWYU_PRG NAMES include-what-you-use iwyu) + if(NOT IWYU_PRG) + message(FATAL_ERROR "ENABLE_IWYU is ON but include-what-you-use is not found!") + endif() + set(CMAKE_C_INCLUDE_WHAT_YOU_USE ${IWYU_PRG} + -Xiwyu --mapping_file=${PROJECT_SOURCE_DIR}/cmake.config/iwyu/mapping.imp + -Xiwyu --mapping_file=${PROJECT_SOURCE_DIR}/cmake.config/iwyu/gcc.libc.imp + -Xiwyu --mapping_file=${PROJECT_SOURCE_DIR}/cmake.config/iwyu/gcc.symbols.imp + -Xiwyu --no_default_mappings) + target_compile_definitions(main_lib INTERFACE EXITFREE) +endif() + +if(MSVC) + # XXX: /W4 gives too many warnings. #3241 + target_compile_options(main_lib INTERFACE -W1 -wd4311) + target_compile_definitions(main_lib INTERFACE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_DEPRECATE) +else() + target_compile_options(main_lib INTERFACE -Wall -Wextra -pedantic -Wno-unused-parameter + -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion + -Wdouble-promotion + -Wmissing-noreturn + -Wmissing-format-attribute + -Wmissing-prototypes) +endif() + +# On FreeBSD 64 math.h uses unguarded C11 extension, which taints clang +# 3.4.1 used there. +if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND CMAKE_C_COMPILER_ID MATCHES "Clang") + target_compile_options(main_lib INTERFACE -Wno-c11-extensions) +endif() + +check_c_compiler_flag(-Wimplicit-fallthrough HAVE_WIMPLICIT_FALLTHROUGH_FLAG) +if(HAVE_WIMPLICIT_FALLTHROUGH_FLAG) + target_compile_options(main_lib INTERFACE -Wimplicit-fallthrough) +endif() + +option(ENABLE_COMPILER_SUGGESTIONS "Enable -Wsuggest compiler warnings" OFF) +if(ENABLE_COMPILER_SUGGESTIONS) + # Clang doesn't have -Wsuggest-attribute so check for each one. + check_c_compiler_flag(-Wsuggest-attribute=pure HAVE_WSUGGEST_ATTRIBUTE_PURE) + if(HAVE_WSUGGEST_ATTRIBUTE_PURE) + target_compile_options(main_lib INTERFACE -Wsuggest-attribute=pure) + endif() + + check_c_compiler_flag(-Wsuggest-attribute=const HAVE_WSUGGEST_ATTRIBUTE_CONST) + if(HAVE_WSUGGEST_ATTRIBUTE_CONST) + target_compile_options(main_lib INTERFACE -Wsuggest-attribute=const) + endif() + + check_c_compiler_flag(-Wsuggest-attribute=malloc HAVE_WSUGGEST_ATTRIBUTE_MALLOC) + if(HAVE_WSUGGEST_ATTRIBUTE_MALLOC) + target_compile_options(main_lib INTERFACE -Wsuggest-attribute=malloc) + endif() + + check_c_compiler_flag(-Wsuggest-attribute=cold HAVE_WSUGGEST_ATTRIBUTE_COLD) + if(HAVE_WSUGGEST_ATTRIBUTE_COLD) + target_compile_options(main_lib INTERFACE -Wsuggest-attribute=cold) + endif() +endif() + +if(MINGW) + # Use POSIX compatible stdio in Mingw + target_compile_definitions(main_lib INTERFACE __USE_MINGW_ANSI_STDIO) +endif() +if(WIN32) + # Windows Vista is the minimum supported version + target_compile_definitions(main_lib INTERFACE _WIN32_WINNT=0x0600 MSWIN) +endif() + +# OpenBSD's GCC (4.2.1) doesn't have -Wvla +check_c_compiler_flag(-Wvla HAS_WVLA_FLAG) +if(HAS_WVLA_FLAG) + target_compile_options(main_lib INTERFACE -Wvla) +endif() + +check_c_compiler_flag(-fno-common HAVE_FNO_COMMON) +if (HAVE_FNO_COMMON) + target_compile_options(main_lib INTERFACE -fno-common) +endif() + +check_c_compiler_flag(-fdiagnostics-color=auto HAS_DIAG_COLOR_FLAG) +if(HAS_DIAG_COLOR_FLAG) + if(CMAKE_GENERATOR MATCHES "Ninja") + target_compile_options(main_lib INTERFACE -fdiagnostics-color=always) + else() + target_compile_options(main_lib INTERFACE -fdiagnostics-color=auto) + endif() +endif() + +option(CI_BUILD "CI, extra flags will be set" OFF) +if(CI_BUILD) + message(STATUS "CI build enabled") + if(MSVC) + target_compile_options(main_lib INTERFACE -WX) + else() + target_compile_options(main_lib INTERFACE -Werror) + if(DEFINED ENV{BUILD_UCHAR}) + # Get some test coverage for unsigned char + target_compile_options(main_lib INTERFACE -funsigned-char) + endif() + endif() +endif() + +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) + target_compile_definitions(main_lib INTERFACE NVIM_UNIBI_HAS_VAR_FROM) +endif() + +list(APPEND CMAKE_REQUIRED_INCLUDES "${MSGPACK_INCLUDE_DIRS}") +check_c_source_compiles(" +#include <msgpack.h> + +int +main(void) +{ + return MSGPACK_OBJECT_FLOAT32; +} +" MSGPACK_HAS_FLOAT32) +list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${MSGPACK_INCLUDE_DIRS}") +if(MSGPACK_HAS_FLOAT32) + target_compile_definitions(main_lib INTERFACE NVIM_MSGPACK_HAS_FLOAT32) +endif() + +list(APPEND CMAKE_REQUIRED_INCLUDES "${TreeSitter_INCLUDE_DIRS}") +list(APPEND CMAKE_REQUIRED_LIBRARIES "${TreeSitter_LIBRARIES}") +check_c_source_compiles(" +#include <tree_sitter/api.h> +int +main(void) +{ + TSQueryCursor *cursor = ts_query_cursor_new(); + ts_query_cursor_set_match_limit(cursor, 32); + return 0; +} +" TS_HAS_SET_MATCH_LIMIT) +if(TS_HAS_SET_MATCH_LIMIT) + target_compile_definitions(main_lib INTERFACE NVIM_TS_HAS_SET_MATCH_LIMIT) +endif() +check_c_source_compiles(" +#include <stdlib.h> +#include <tree_sitter/api.h> +int +main(void) +{ + ts_set_allocator(malloc, calloc, realloc, free); + return 0; +} +" TS_HAS_SET_ALLOCATOR) +if(TS_HAS_SET_ALLOCATOR) + target_compile_definitions(main_lib INTERFACE NVIM_TS_HAS_SET_ALLOCATOR) +endif() +list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${TreeSitter_INCLUDE_DIRS}") +list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "${TreeSitter_LIBRARIES}") + +# Include <string.h> because some toolchains define _FORTIFY_SOURCE=2 in +# internal header files, which should in turn be #included by <string.h>. +check_c_source_compiles(" +#include <string.h> + +#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 1 +#error \"_FORTIFY_SOURCE > 1\" +#endif +int +main(void) +{ + return 0; +} +" HAS_ACCEPTABLE_FORTIFY) + +if(NOT HAS_ACCEPTABLE_FORTIFY) + message(STATUS "Unsupported _FORTIFY_SOURCE found, forcing _FORTIFY_SOURCE=1") + # Extract possible prefix to _FORTIFY_SOURCE (e.g. -Wp,-D_FORTIFY_SOURCE). + string(REGEX MATCH "[^\ ]+-D_FORTIFY_SOURCE" _FORTIFY_SOURCE_PREFIX "${CMAKE_C_FLAGS}") + string(REPLACE "-D_FORTIFY_SOURCE" "" _FORTIFY_SOURCE_PREFIX "${_FORTIFY_SOURCE_PREFIX}" ) + if(NOT _FORTIFY_SOURCE_PREFIX STREQUAL "") + message(STATUS "Detected _FORTIFY_SOURCE Prefix=${_FORTIFY_SOURCE_PREFIX}") + endif() + # -U in add_definitions doesn't end up in the correct spot, so we add it to + # the flags variable instead. + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_FORTIFY_SOURCE_PREFIX}-U_FORTIFY_SOURCE ${_FORTIFY_SOURCE_PREFIX}-D_FORTIFY_SOURCE=1") +endif() + +target_compile_definitions(main_lib INTERFACE INCLUDE_GENERATED_DECLARATIONS) + +# Remove --sort-common from linker flags, as this seems to cause bugs (see #2641, #3374). +# TODO: Figure out the root cause. +if(CMAKE_EXE_LINKER_FLAGS MATCHES "--sort-common" OR + CMAKE_SHARED_LINKER_FLAGS MATCHES "--sort-common" OR + CMAKE_MODULE_LINKER_FLAGS MATCHES "--sort-common") + message(STATUS "Removing --sort-common from linker flags") + string(REGEX REPLACE ",--sort-common(=[^,]+)?" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") + string(REGEX REPLACE ",--sort-common(=[^,]+)?" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") + string(REGEX REPLACE ",--sort-common(=[^,]+)?" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}") + + # If no linker flags remain for a -Wl argument, remove it. + # '-Wl$' will match LDFLAGS="-Wl,--sort-common", + # '-Wl ' will match LDFLAGS="-Wl,--sort-common -Wl,..." + string(REGEX REPLACE "-Wl($| )" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") + string(REGEX REPLACE "-Wl($| )" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") + string(REGEX REPLACE "-Wl($| )" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}") +endif() + +if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang") + if(CMAKE_SYSTEM_NAME STREQUAL "SunOS") + target_link_libraries(nvim PRIVATE -Wl,--no-undefined -lsocket) + elseif(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin") + target_link_libraries(nvim PRIVATE -Wl,--no-undefined) + endif() + + # For O_CLOEXEC, O_DIRECTORY, and O_NOFOLLOW flags on older systems + # (pre POSIX.1-2008: glibc 2.11 and earlier). #4042 + # For ptsname(). #6743 + target_compile_definitions(main_lib INTERFACE _GNU_SOURCE) +endif() + +option(USE_GCOV "Enable gcov support" OFF) if(USE_GCOV) if(CLANG_TSAN) # GCOV and TSAN results in false data race reports message(FATAL_ERROR "USE_GCOV cannot be used with CLANG_TSAN") endif() message(STATUS "Enabling gcov support") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage") - add_definitions(-DUSE_GCOV) + target_compile_options(main_lib INTERFACE --coverage) + target_link_libraries(main_lib INTERFACE --coverage) + target_compile_definitions(main_lib INTERFACE USE_GCOV) endif() if(WIN32) if(MINGW) # Enable wmain - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -municode") + target_link_libraries(nvim PRIVATE -municode) endif() elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework CoreServices") - set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -framework CoreServices") + target_link_libraries(nvim PRIVATE "-framework CoreServices") +endif() + +if(UNIX) + # -fstack-protector breaks non Unix builds even in Mingw-w64 + check_c_compiler_flag(-fstack-protector-strong HAS_FSTACK_PROTECTOR_STRONG_FLAG) + check_c_compiler_flag(-fstack-protector HAS_FSTACK_PROTECTOR_FLAG) + if(HAS_FSTACK_PROTECTOR_STRONG_FLAG) + target_compile_options(main_lib INTERFACE -fstack-protector-strong) + target_link_libraries(main_lib INTERFACE -fstack-protector-strong) + elseif(HAS_FSTACK_PROTECTOR_FLAG) + target_compile_options(main_lib INTERFACE -fstack-protector --param ssp-buffer-size=4) + target_link_libraries(main_lib INTERFACE -fstack-protector --param ssp-buffer-size=4) + endif() endif() set(GENERATOR_DIR ${CMAKE_CURRENT_LIST_DIR}/generators) @@ -82,9 +395,11 @@ glob_wrapper(API_HEADERS api/*.h) list(REMOVE_ITEM API_HEADERS ${CMAKE_CURRENT_LIST_DIR}/api/ui_events.in.h) glob_wrapper(MSGPACK_RPC_HEADERS msgpack_rpc/*.h) -include_directories(${GENERATED_DIR}) -include_directories(${CACHED_GENERATED_DIR}) -include_directories(${GENERATED_INCLUDES_DIR}) +target_include_directories(main_lib INTERFACE ${GENERATED_DIR}) +target_include_directories(main_lib INTERFACE ${CACHED_GENERATED_DIR}) +target_include_directories(main_lib INTERFACE ${GENERATED_INCLUDES_DIR}) +target_include_directories(main_lib INTERFACE "${PROJECT_BINARY_DIR}/cmake.config") +target_include_directories(main_lib INTERFACE "${PROJECT_SOURCE_DIR}/src") file(MAKE_DIRECTORY ${TOUCHES_DIR}) file(MAKE_DIRECTORY ${GENERATED_DIR}) @@ -118,8 +433,6 @@ foreach(subdir list(APPEND NVIM_HEADERS ${headers}) endforeach() -glob_wrapper(UNIT_TEST_FIXTURES ${PROJECT_SOURCE_DIR}/test/unit/fixtures/*.c) - # Sort file lists to ensure generated files are created in the same order from # build to build. list(SORT NVIM_SOURCES) @@ -158,22 +471,22 @@ if(NOT MSVC) endif() if(NOT "${MIN_LOG_LEVEL}" MATCHES "^$") - add_definitions(-DMIN_LOG_LEVEL=${MIN_LOG_LEVEL}) + target_compile_definitions(main_lib INTERFACE MIN_LOG_LEVEL=${MIN_LOG_LEVEL}) endif() if(CLANG_ASAN_UBSAN OR CLANG_MSAN OR CLANG_TSAN) - add_definitions(-DEXITFREE) + target_compile_definitions(main_lib INTERFACE EXITFREE) endif() -get_directory_property(gen_cdefs COMPILE_DEFINITIONS) -foreach(gen_cdef ${gen_cdefs} DO_NOT_DEFINE_EMPTY_ATTRIBUTES) +get_target_property(prop main_lib INTERFACE_COMPILE_DEFINITIONS) +foreach(gen_cdef DO_NOT_DEFINE_EMPTY_ATTRIBUTES ${prop}) if(NOT ${gen_cdef} MATCHES "INCLUDE_GENERATED_DECLARATIONS") list(APPEND gen_cflags "-D${gen_cdef}") endif() endforeach() -get_directory_property(gen_includes INCLUDE_DIRECTORIES) -foreach(gen_include ${gen_includes} ${LUA_PREFERRED_INCLUDE_DIRS}) +get_target_property(prop main_lib INTERFACE_INCLUDE_DIRECTORIES) +foreach(gen_include ${prop}) list(APPEND gen_cflags "-I${gen_include}") endforeach() if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_OSX_SYSROOT) @@ -185,14 +498,6 @@ separate_arguments(C_FLAGS_ARRAY UNIX_COMMAND ${CMAKE_C_FLAGS}) separate_arguments(C_FLAGS_${build_type}_ARRAY UNIX_COMMAND ${CMAKE_C_FLAGS_${build_type}}) set(gen_cflags ${gen_cflags} ${C_FLAGS_${build_type}_ARRAY} ${C_FLAGS_ARRAY}) -function(get_preproc_output varname iname) - if(MSVC) - set(${varname} /P /Fi${iname} /nologo PARENT_SCOPE) - else() - set(${varname} -E -o ${iname} PARENT_SCOPE) - endif() -endfunction() - set(NVIM_VERSION_GIT_H ${PROJECT_BINARY_DIR}/cmake.config/auto/versiondef_git.h) add_custom_target(update_version_stamp COMMAND ${CMAKE_COMMAND} @@ -233,7 +538,11 @@ foreach(sfile ${NVIM_SOURCES} set(gf_h_h "${GENERATED_INCLUDES_DIR}/${r}.h.generated.h") set(gf_i "${GENERATED_DIR}/${r}.i") - get_preproc_output(PREPROC_OUTPUT ${gf_i}) + if(MSVC) + set(PREPROC_OUTPUT /P /Fi${gf_i} /nologo) + else() + set(PREPROC_OUTPUT -E -o ${gf_i}) + endif() set(depends "${HEADER_GENERATOR}" "${sfile}") if("${f}" STREQUAL "version.c") @@ -388,77 +697,44 @@ endforeach() # Our dependencies come first. if (CMAKE_SYSTEM_NAME MATCHES "OpenBSD") - list(APPEND NVIM_LINK_LIBRARIES pthread c++abi) -endif() - -if (LibIntl_FOUND) - list(APPEND NVIM_LINK_LIBRARIES ${LibIntl_LIBRARY}) -endif() - -if(Iconv_LIBRARIES) - list(APPEND NVIM_LINK_LIBRARIES ${Iconv_LIBRARIES}) + target_link_libraries(main_lib INTERFACE pthread c++abi) endif() if(WIN32) - list(APPEND NVIM_LINK_LIBRARIES netapi32) + target_link_libraries(main_lib INTERFACE netapi32) endif() -# Use "luv" as imported library, to work around CMake using "-lluv" for -# "luv.so". #10407 -add_library(luv UNKNOWN IMPORTED) -set_property(TARGET luv PROPERTY IMPORTED_LOCATION ${LIBLUV_LIBRARIES}) - -# Put these last on the link line, since multiple things may depend on them. -list(APPEND NVIM_LINK_LIBRARIES - luv - ${LIBUV_LIBRARIES} - ${MSGPACK_LIBRARIES} - ${LIBVTERM_LIBRARIES} - ${LIBTERMKEY_LIBRARIES} - ${UNIBILIUM_LIBRARIES} - ${UTF8PROC_LIBRARIES} - ${TreeSitter_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} -) - if(UNIX) - list(APPEND NVIM_LINK_LIBRARIES - m) + target_link_libraries(main_lib INTERFACE m) if (NOT CMAKE_SYSTEM_NAME STREQUAL "SunOS") - list(APPEND NVIM_LINK_LIBRARIES - util) + target_link_libraries(main_lib INTERFACE util) endif() endif() -set(NVIM_EXEC_LINK_LIBRARIES ${NVIM_LINK_LIBRARIES} ${LUA_PREFERRED_LIBRARIES}) - -add_executable(nvim ${NVIM_GENERATED_FOR_SOURCES} ${NVIM_GENERATED_FOR_HEADERS} +target_sources(nvim PRIVATE ${NVIM_GENERATED_FOR_SOURCES} ${NVIM_GENERATED_FOR_HEADERS} ${NVIM_GENERATED_SOURCES} ${NVIM_SOURCES} ${NVIM_HEADERS} ${EXTERNAL_SOURCES} ${EXTERNAL_HEADERS}) set_target_properties(nvim PROPERTIES - EXPORT_COMPILE_COMMANDS ON) + EXPORT_COMPILE_COMMANDS ON + ENABLE_EXPORTS TRUE) if(${CMAKE_VERSION} VERSION_LESS 3.20) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) endif() -target_link_libraries(nvim ${NVIM_EXEC_LINK_LIBRARIES}) +target_link_libraries(nvim PRIVATE main_lib PUBLIC libuv_lib) install_helper(TARGETS nvim) if(MSVC) install(FILES $<TARGET_PDB_FILE:nvim> DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL) endif() -set_property(TARGET nvim APPEND PROPERTY - INCLUDE_DIRECTORIES ${LUA_PREFERRED_INCLUDE_DIRS}) -set_property(TARGET nvim PROPERTY ENABLE_EXPORTS TRUE) - if(ENABLE_LTO) include(CheckIPOSupported) check_ipo_supported(RESULT IPO_SUPPORTED) if(IPO_SUPPORTED AND (NOT CMAKE_BUILD_TYPE MATCHES Debug)) - set_property(TARGET nvim PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) + set_target_properties(nvim PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE) endif() endif() @@ -580,8 +856,6 @@ add_library( ${NVIM_HEADERS} ${NVIM_GENERATED_FOR_SOURCES} ${NVIM_GENERATED_FOR_HEADERS} ${EXTERNAL_SOURCES} ${EXTERNAL_HEADERS} ) -set_property(TARGET libnvim APPEND PROPERTY - INCLUDE_DIRECTORIES ${LUA_PREFERRED_INCLUDE_DIRS}) if(MSVC) set(LIBNVIM_NAME libnvim) else() @@ -593,12 +867,13 @@ set_target_properties( POSITION_INDEPENDENT_CODE ON OUTPUT_NAME ${LIBNVIM_NAME} ) -target_compile_options(libnvim PRIVATE -DMAKE_LIB) +target_compile_definitions(libnvim PRIVATE MAKE_LIB) +target_link_libraries(libnvim PRIVATE main_lib PUBLIC libuv_lib) if(NOT LUAJIT_FOUND) message(STATUS "luajit not found, skipping nvim-test (unit tests) target") else() - set(NVIM_TEST_LINK_LIBRARIES ${NVIM_LINK_LIBRARIES} ${LUAJIT_LIBRARIES}) + glob_wrapper(UNIT_TEST_FIXTURES ${PROJECT_SOURCE_DIR}/test/unit/fixtures/*.c) add_library( nvim-test MODULE @@ -608,39 +883,46 @@ else() ${EXTERNAL_SOURCES} ${EXTERNAL_HEADERS} ${UNIT_TEST_FIXTURES} ) - target_link_libraries(nvim-test ${NVIM_TEST_LINK_LIBRARIES}) - target_link_libraries(libnvim ${NVIM_TEST_LINK_LIBRARIES}) - set_property( - TARGET nvim-test - APPEND PROPERTY INCLUDE_DIRECTORIES ${LUAJIT_INCLUDE_DIRS} - ) + target_link_libraries(nvim-test PRIVATE ${LUAJIT_LIBRARIES} main_lib PUBLIC libuv_lib) + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + target_link_libraries(nvim-test PRIVATE "-framework CoreServices") + endif() + target_include_directories(nvim-test PRIVATE ${LUAJIT_INCLUDE_DIRS}) set_target_properties( nvim-test PROPERTIES POSITION_INDEPENDENT_CODE ON ) - target_compile_options(nvim-test PRIVATE -DUNIT_TESTING) + target_compile_definitions(nvim-test PRIVATE UNIT_TESTING) endif() if(CLANG_ASAN_UBSAN) message(STATUS "Enabling Clang address sanitizer and undefined behavior sanitizer for nvim.") if(CI_BUILD) # Try to recover from all sanitize issues so we get reports about all failures - set(SANITIZE_RECOVER -fsanitize-recover=all) + target_compile_options(nvim PRIVATE -fsanitize-recover=all) else() - set(SANITIZE_RECOVER -fno-sanitize-recover=all) + target_compile_options(nvim PRIVATE -fno-sanitize-recover=all) endif() - set_property(TARGET nvim APPEND PROPERTY COMPILE_OPTIONS ${SANITIZE_RECOVER} -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize=address -fsanitize=undefined -fsanitize-blacklist=${PROJECT_SOURCE_DIR}/src/.asan-blacklist) - set_property(TARGET nvim APPEND_STRING PROPERTY LINK_FLAGS "-fsanitize=address -fsanitize=undefined ") + target_compile_options(nvim PRIVATE + -fno-omit-frame-pointer + -fno-optimize-sibling-calls + -fsanitize=address + -fsanitize=undefined + -fsanitize-blacklist=${PROJECT_SOURCE_DIR}/src/.asan-blacklist) + target_link_libraries(nvim PRIVATE -fsanitize=address -fsanitize=undefined) elseif(CLANG_MSAN) message(STATUS "Enabling Clang memory sanitizer for nvim.") - set_property(TARGET nvim APPEND PROPERTY COMPILE_OPTIONS -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer -fno-optimize-sibling-calls) - set_property(TARGET nvim APPEND_STRING PROPERTY LINK_FLAGS "-fsanitize=memory -fsanitize-memory-track-origins ") + target_compile_options(nvim PRIVATE + -fsanitize=memory + -fsanitize-memory-track-origins + -fno-omit-frame-pointer + -fno-optimize-sibling-calls) + target_link_libraries(nvim PRIVATE -fsanitize=memory -fsanitize-memory-track-origins) elseif(CLANG_TSAN) message(STATUS "Enabling Clang thread sanitizer for nvim.") - set_property(TARGET nvim APPEND PROPERTY COMPILE_OPTIONS -fsanitize=thread) - set_property(TARGET nvim APPEND PROPERTY COMPILE_OPTIONS -fPIE) - set_property(TARGET nvim APPEND_STRING PROPERTY LINK_FLAGS "-fsanitize=thread ") + target_compile_options(nvim PRIVATE -fsanitize=thread -fPIE) + target_link_libraries(nvim PRIVATE -fsanitize=thread) endif() function(get_test_target prefix sfile relative_path_var target_var) @@ -683,10 +965,7 @@ foreach(hfile ${NVIM_HEADERS}) ${texe} EXCLUDE_FROM_ALL ${tsource} ${NVIM_HEADERS} ${NVIM_GENERATED_FOR_HEADERS}) - set_property( - TARGET ${texe} - APPEND PROPERTY INCLUDE_DIRECTORIES ${LUA_PREFERRED_INCLUDE_DIRS} - ) + target_link_libraries(${texe} PRIVATE main_lib) set_target_properties(${texe} PROPERTIES FOLDER test) list(FIND NO_SINGLE_CHECK_HEADERS "${relative_path}" hfile_exclude_idx) diff --git a/src/nvim/api/win_config.c b/src/nvim/api/win_config.c index 3fdd062ef0..f81d26b486 100644 --- a/src/nvim/api/win_config.c +++ b/src/nvim/api/win_config.c @@ -74,6 +74,7 @@ /// - "editor" The global editor grid /// - "win" Window given by the `win` field, or current window. /// - "cursor" Cursor position in current window. +/// - "mouse" Mouse position /// - win: |window-ID| for relative="win". /// - anchor: Decides which corner of the float to place at (row,col): /// - "NW" northwest (default) @@ -349,6 +350,8 @@ static bool parse_float_relative(String relative, FloatRelative *out) *out = kFloatRelativeWindow; } else if (striequal(str, "cursor")) { *out = kFloatRelativeCursor; + } else if (striequal(str, "mouse")) { + *out = kFloatRelativeMouse; } else { return false; } diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 7442e60024..c794b88229 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -1028,10 +1028,11 @@ typedef enum { kFloatRelativeEditor = 0, kFloatRelativeWindow = 1, kFloatRelativeCursor = 2, + kFloatRelativeMouse = 3, } FloatRelative; EXTERN const char *const float_relative_str[] INIT(= { "editor", "win", - "cursor" }); + "cursor", "mouse" }); typedef enum { kWinStyleUnused = 0, @@ -1418,20 +1419,20 @@ struct window_S { typedef struct statuscol statuscol_T; struct statuscol { - int width; // width of the status column - int cur_attr; // current attributes in text - int num_attr; // attributes used for line number - int fold_attr; // attributes used for fold column - int sign_attr[SIGN_SHOW_MAX]; // attributes used for signs - int truncate; // truncated width - bool draw; // draw statuscolumn or not - char fold_text[10]; // text in fold column (%C) - char *sign_text[SIGN_SHOW_MAX]; // text in sign column (%s) - char text[MAXPATHL]; // text in status column - char *textp; // current position in text - size_t text_len; // length of text - stl_hlrec_t *hlrec; // highlight groups - stl_hlrec_t *hlrecp; // current highlight group + int width; ///< width of the status column + int cur_attr; ///< current attributes in text + int num_attr; ///< attributes used for line number + int fold_attr; ///< attributes used for fold column + int sign_attr[SIGN_SHOW_MAX + 1]; ///< attributes used for signs + int truncate; ///< truncated width + bool draw; ///< draw statuscolumn or not + char fold_text[10]; ///< text in fold column (%C) + char *sign_text[SIGN_SHOW_MAX + 1]; ///< text in sign column (%s) + char text[MAXPATHL]; ///< text in status column + char *textp; ///< current position in text + char *text_end; ///< end of text (the NUL byte) + stl_hlrec_t *hlrec; ///< highlight groups + stl_hlrec_t *hlrecp; ///< current highlight group }; /// Macros defined in Vim, but not in Neovim diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c index 23ef7400b7..e54566c3e5 100644 --- a/src/nvim/drawline.c +++ b/src/nvim/drawline.c @@ -403,8 +403,8 @@ static int get_sign_attrs(buf_T *buf, linenr_T lnum, SignTextAttrs *sattrs, int /// /// @param[out] stcp Status column attributes static void get_statuscol_str(win_T *wp, linenr_T lnum, int row, int startrow, int filler_lines, - int cul_attr, int sign_num_attr, SignTextAttrs *sattrs, - foldinfo_T foldinfo, char_u *extra, statuscol_T *stcp) + int cul_attr, int sign_num_attr, int sign_cul_attr, char_u *extra, + foldinfo_T foldinfo, SignTextAttrs *sattrs, statuscol_T *stcp) { long relnum = 0; bool wrapped = row != startrow + filler_lines; @@ -427,7 +427,8 @@ static void get_statuscol_str(win_T *wp, linenr_T lnum, int row, int startrow, i for (; i < wp->w_scwidth; i++) { SignTextAttrs *sattr = wrapped ? NULL : sign_get_attr(i, sattrs, wp->w_scwidth); stcp->sign_text[i] = sattr && sattr->text ? sattr->text : " "; - stcp->sign_attr[i] = use_cul && cul_attr ? cul_attr : sattr ? sattr->hl_attr_id : 0; + stcp->sign_attr[i] = sattr ? (use_cul && sign_cul_attr ? sign_cul_attr : sattr->hl_attr_id) + : win_hl_attr(wp, use_cul ? HLF_CLS : HLF_SC); } stcp->sign_text[i] = NULL; @@ -450,14 +451,13 @@ static void get_statuscol_str(win_T *wp, linenr_T lnum, int row, int startrow, i stcp->textp = stcp->text; stcp->hlrecp = stcp->hlrec; stcp->cur_attr = stcp->num_attr; - stcp->text_len = strlen(stcp->text); + stcp->text_end = stcp->text + strlen(stcp->text); int fill = stcp->width - width; if (fill > 0) { // Fill up with ' ' - memset(&stcp->text[stcp->text_len], ' ', (size_t)fill); - stcp->text_len += (size_t)fill; - stcp->text[stcp->text_len] = NUL; + memset(stcp->text_end, ' ', (size_t)fill); + *(stcp->text_end += fill) = NUL; } } @@ -476,10 +476,9 @@ static void get_statuscol_display_info(LineDrawState *draw_state, int *char_attr *draw_state = WL_STC; *char_attr = stcp->cur_attr; *pp_extra = stcp->textp; - *n_extrap = stcp->hlrecp->start ? (int)(stcp->hlrecp->start - stcp->textp) - : (int)strlen(*pp_extra); + *n_extrap = (int)((stcp->hlrecp->start ? stcp->hlrecp->start : stcp->text_end) - stcp->textp); // Prepare for next highlight section if not yet at the end - if (stcp->textp + *n_extrap < stcp->text + stcp->text_len) { + if (stcp->textp + *n_extrap < stcp->text_end) { int hl = stcp->hlrecp->userhl; stcp->textp = stcp->hlrecp->start; stcp->cur_attr = hl < 0 ? syn_id2attr(-stcp->hlrecp->userhl) @@ -488,7 +487,7 @@ static void get_statuscol_display_info(LineDrawState *draw_state, int *char_attr *draw_state = WL_STC - 1; } // Skip over empty highlight sections - } while (*n_extrap == 0 && stcp->textp < stcp->text + stcp->text_len); + } while (*n_extrap == 0 && stcp->textp < stcp->text_end); } /// Return true if CursorLineNr highlight is to be used for the number column. @@ -1328,9 +1327,9 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool nochange, draw_state = WL_STC; // Draw the 'statuscolumn' if option is set. if (statuscol.draw) { - if (statuscol.text_len == 0) { - get_statuscol_str(wp, lnum, row, startrow, filler_lines, cul_attr, - sign_num_attr, sattrs, foldinfo, extra, &statuscol); + if (statuscol.textp == NULL) { + get_statuscol_str(wp, lnum, row, startrow, filler_lines, cul_attr, sign_num_attr, + sign_cul_attr, extra, foldinfo, sattrs, &statuscol); if (wp->w_redr_statuscol) { return 0; } @@ -2823,7 +2822,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool nochange, if (statuscol.draw) { if (row == startrow + 1 || row == startrow + filler_lines) { // Re-evaluate 'statuscolumn' for the first wrapped row and non filler line - statuscol.text_len = 0; + statuscol.textp = NULL; } else { // Otherwise just reset the text/hlrec pointers statuscol.textp = statuscol.text; statuscol.hlrecp = statuscol.hlrec; diff --git a/src/nvim/mouse.c b/src/nvim/mouse.c index 88103d1888..ee8c553cd5 100644 --- a/src/nvim/mouse.c +++ b/src/nvim/mouse.c @@ -1110,7 +1110,7 @@ retnomove: ? wp->w_winbar_height != 0 : false; - on_statuscol = grid == (col < win_col_off(wp)) + on_statuscol = (grid == (col < win_col_off(wp))) ? *wp->w_p_stc != NUL : false; diff --git a/src/nvim/move.c b/src/nvim/move.c index 0d2a38b041..271b322464 100644 --- a/src/nvim/move.c +++ b/src/nvim/move.c @@ -379,12 +379,19 @@ static bool check_top_offset(void) return false; } +/// Update w_curswant. +void update_curswant_force(void) +{ + validate_virtcol(); + curwin->w_curswant = curwin->w_virtcol; + curwin->w_set_curswant = false; +} + +/// Update w_curswant if w_set_curswant is set. void update_curswant(void) { if (curwin->w_set_curswant) { - validate_virtcol(); - curwin->w_curswant = curwin->w_virtcol; - curwin->w_set_curswant = false; + update_curswant_force(); } } diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 6da71a9354..d1b23da3bf 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -5011,10 +5011,12 @@ static void nv_visual(cmdarg_T *cap) VIsual_mode = resel_VIsual_mode; if (VIsual_mode == 'v') { if (resel_VIsual_line_count <= 1) { - validate_virtcol(); + update_curswant_force(); assert(cap->count0 >= INT_MIN && cap->count0 <= INT_MAX); - curwin->w_curswant = (curwin->w_virtcol - + resel_VIsual_vcol * (int)cap->count0 - 1); + curwin->w_curswant += resel_VIsual_vcol * (int)cap->count0; + if (*p_sel != 'e') { + curwin->w_curswant--; + } } else { curwin->w_curswant = resel_VIsual_vcol; } @@ -5024,10 +5026,9 @@ static void nv_visual(cmdarg_T *cap) curwin->w_curswant = MAXCOL; coladvance(MAXCOL); } else if (VIsual_mode == Ctrl_V) { - validate_virtcol(); + update_curswant_force(); assert(cap->count0 >= INT_MIN && cap->count0 <= INT_MAX); - curwin->w_curswant = (curwin->w_virtcol - + resel_VIsual_vcol * (int)cap->count0 - 1); + curwin->w_curswant += resel_VIsual_vcol * (int)cap->count0 - 1; coladvance(curwin->w_curswant); } else { curwin->w_set_curswant = true; @@ -5276,9 +5277,7 @@ static void nv_g_dollar_cmd(cmdarg_T *cap) coladvance((colnr_T)i); // Make sure we stick in this column. - validate_virtcol(); - curwin->w_curswant = curwin->w_virtcol; - curwin->w_set_curswant = false; + update_curswant_force(); if (curwin->w_cursor.col > 0 && curwin->w_p_wrap) { // Check for landing on a character that got split at // the end of the line. We do not want to advance to @@ -5309,9 +5308,7 @@ static void nv_g_dollar_cmd(cmdarg_T *cap) } // Make sure we stick in this column. - validate_virtcol(); - curwin->w_curswant = curwin->w_virtcol; - curwin->w_set_curswant = false; + update_curswant_force(); } } diff --git a/src/nvim/statusline.c b/src/nvim/statusline.c index 7d8394e1b4..6857bef810 100644 --- a/src/nvim/statusline.c +++ b/src/nvim/statusline.c @@ -1502,7 +1502,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, char *opt_n case STL_LINE: // Overload %l with v:lnum for 'statuscolumn' - num = strcmp(opt_name, "statuscolumn") == 0 ? get_vim_var_nr(VV_LNUM) + num = opt_name != NULL && strcmp(opt_name, "statuscolumn") == 0 ? get_vim_var_nr(VV_LNUM) : (wp->w_buffer->b_ml.ml_flags & ML_EMPTY) ? 0L : (long)(wp->w_cursor.lnum); break; @@ -1602,7 +1602,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, char *opt_n case STL_ROFLAG: case STL_ROFLAG_ALT: // Overload %r with v:relnum for 'statuscolumn' - if (strcmp(opt_name, "statuscolumn") == 0) { + if (opt_name != NULL && strcmp(opt_name, "statuscolumn") == 0) { num = get_vim_var_nr(VV_RELNUM); } else { itemisflag = true; @@ -1628,7 +1628,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, char *opt_n bool fold = opt == STL_FOLDCOL; *buf_tmp = NUL; - for (int i = 0; i <= 9; i++) { + for (int i = 0; i <= SIGN_SHOW_MAX; i++) { char *p = fold ? stcp->fold_text : stcp->sign_text[i]; if ((!p || !*p) && *buf_tmp == NUL) { break; diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim index c17ac16a97..52608b84cf 100644 --- a/src/nvim/testdir/test_filetype.vim +++ b/src/nvim/testdir/test_filetype.vim @@ -525,6 +525,7 @@ let s:filename_checks = { \ 'slrnrc': ['.slrnrc'], \ 'slrnsc': ['file.score'], \ 'sm': ['sendmail.cf'], + \ 'smali': ['file.smali'], \ 'smarty': ['file.tpl'], \ 'smcl': ['file.hlp', 'file.ihlp', 'file.smcl'], \ 'smith': ['file.smt', 'file.smith'], diff --git a/src/nvim/testdir/test_utf8.vim b/src/nvim/testdir/test_utf8.vim index aa3b02b575..9146cf7ab3 100644 --- a/src/nvim/testdir/test_utf8.vim +++ b/src/nvim/testdir/test_utf8.vim @@ -2,6 +2,7 @@ source check.vim source view_util.vim +source screendump.vim " Visual block Insert adjusts for multi-byte char func Test_visual_block_insert() @@ -198,6 +199,22 @@ func Test_setcellwidths() call setcellwidths([]) endfunc +func Test_setcellwidths_dump() + CheckRunVimInTerminal + + let lines =<< trim END + call setline(1, "\ue5ffDesktop") + END + call writefile(lines, 'XCellwidths', 'D') + let buf = RunVimInTerminal('-S XCellwidths', {'rows': 6}) + call VerifyScreenDump(buf, 'Test_setcellwidths_dump_1', {}) + + call term_sendkeys(buf, ":call setcellwidths([[0xe5ff, 0xe5ff, 2]])\<CR>") + call VerifyScreenDump(buf, 'Test_setcellwidths_dump_2', {}) + + call StopVimInTerminal(buf) +endfunc + func Test_print_overlong() " Text with more composing characters than MB_MAXBYTES. new diff --git a/src/nvim/testdir/test_visual.vim b/src/nvim/testdir/test_visual.vim index 712ea343ed..14d62089cf 100644 --- a/src/nvim/testdir/test_visual.vim +++ b/src/nvim/testdir/test_visual.vim @@ -1338,6 +1338,18 @@ func Test_visual_reselect_with_count() call delete('XvisualReselect') endfunc +func Test_visual_reselect_exclusive() + new + call setline(1, ['abcde', 'abcde']) + set selection=exclusive + normal 1G0viwd + normal 2G01vd + call assert_equal(['', ''], getline(1, 2)) + + set selection& + bwipe! +endfunc + func Test_visual_block_insert_round_off() new " The number of characters are tuned to fill a 4096 byte allocated block, diff --git a/src/nvim/window.c b/src/nvim/window.c index 5c05417dd8..37f297909a 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -804,6 +804,15 @@ void win_config_float(win_T *wp, FloatConfig fconfig) fconfig.row += curwin->w_wrow; fconfig.col += curwin->w_wcol; fconfig.window = curwin->handle; + } else if (fconfig.relative == kFloatRelativeMouse) { + int row = mouse_row, col = mouse_col, grid = mouse_grid; + win_T *mouse_win = mouse_find_win(&grid, &row, &col); + if (mouse_win != NULL) { + fconfig.relative = kFloatRelativeWindow; + fconfig.row += row; + fconfig.col += col; + fconfig.window = mouse_win->handle; + } } bool change_external = fconfig.external != wp->w_float_config.external; diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index 98bfb83dbd..aa2f46bb59 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -3126,7 +3126,12 @@ describe('API', function() eq('E539: Illegal character <}>', pcall_err(meths.eval_statusline, '%{%}', {})) end) - it('supports %S item', function() + it('supports various items', function() + eq({ str = '0', width = 1 }, + meths.eval_statusline('%l', { maxwidth = 5 })) + command('set readonly') + eq({ str = '[RO]', width = 4 }, + meths.eval_statusline('%r', { maxwidth = 5 })) local screen = Screen.new(80, 24) screen:attach() command('set showcmd') diff --git a/test/functional/fixtures/CMakeLists.txt b/test/functional/fixtures/CMakeLists.txt index a5410c2f8c..6e64b1e4dc 100644 --- a/test/functional/fixtures/CMakeLists.txt +++ b/test/functional/fixtures/CMakeLists.txt @@ -1,14 +1,23 @@ -add_executable(tty-test EXCLUDE_FROM_ALL tty-test.c) -target_link_libraries(tty-test ${LIBUV_LIBRARIES}) +add_library(test_lib INTERFACE) +if(MINGW) + target_link_libraries(test_lib INTERFACE -municode) +endif() +if(WIN32) + target_compile_definitions(test_lib INTERFACE MSWIN) +endif() +target_link_libraries(test_lib INTERFACE nvim) +add_executable(tty-test EXCLUDE_FROM_ALL tty-test.c) add_executable(shell-test EXCLUDE_FROM_ALL shell-test.c) # Fake pwsh (powershell) for testing make_filter_cmd(). #16271 add_executable(pwsh-test EXCLUDE_FROM_ALL shell-test.c) add_executable(printargs-test EXCLUDE_FROM_ALL printargs-test.c) add_executable(printenv-test EXCLUDE_FROM_ALL printenv-test.c) -if(MINGW) - set_target_properties(printenv-test PROPERTIES LINK_FLAGS -municode) -endif() - add_executable(streams-test EXCLUDE_FROM_ALL streams-test.c) -target_link_libraries(streams-test ${LIBUV_LIBRARIES}) + +target_link_libraries(tty-test PRIVATE test_lib) +target_link_libraries(shell-test PRIVATE test_lib) +target_link_libraries(pwsh-test PRIVATE test_lib) +target_link_libraries(printargs-test PRIVATE test_lib) +target_link_libraries(printenv-test PRIVATE test_lib) +target_link_libraries(streams-test PRIVATE test_lib) diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index f0950959ff..6759510ad1 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -168,6 +168,29 @@ describe('float window', function() eq(7, pos[2]) end) + it('opened with correct position relative to the mouse', function() + meths.input_mouse('left', 'press', '', 0, 10, 10) + local pos = exec_lua([[ + local bufnr = vim.api.nvim_create_buf(false, true) + + local opts = { + width = 10, + height = 10, + col = 1, + row = 2, + relative = 'mouse', + style = 'minimal' + } + + local win_id = vim.api.nvim_open_win(bufnr, false, opts) + + return vim.api.nvim_win_get_position(win_id) + ]]) + + eq(12, pos[1]) + eq(11, pos[2]) + end) + it('opened with correct position relative to the cursor', function() local pos = exec_lua([[ local bufnr = vim.api.nvim_create_buf(false, true) @@ -1350,9 +1373,9 @@ describe('float window', function() [2:----------------------------------------]| [3:----------------------------------------]| ## grid 2 - {20:1}{21: }{19: }{20: }{22:^x}{21: }| - {14:2 }{19: }{14: }{22:y} | - {14:3 }{19: }{14: }{22: } | + {20:1}{19: }{20: }{22:^x}{21: }| + {14:2}{19: }{14: }{22:y} | + {14:3}{19: }{14: }{22: } | {0:~ }| {0:~ }| {0:~ }| @@ -1366,9 +1389,9 @@ describe('float window', function() ]], float_pos={[4] = {{id = 1001}, "NW", 1, 4, 10, true}}} else screen:expect{grid=[[ - {20:1}{21: }{19: }{20: }{22:^x}{21: }| - {14:2 }{19: }{14: }{22:y} | - {14:3 }{19: }{14: }{22: } {15:x } | + {20:1}{19: }{20: }{22:^x}{21: }| + {14:2}{19: }{14: }{22:y} | + {14:3}{19: }{14: }{22: } {15:x } | {0:~ }{15:y }{0: }| {0:~ }{15: }{0: }| {0:~ }{15: }{0: }| diff --git a/test/functional/ui/sign_spec.lua b/test/functional/ui/sign_spec.lua index a1683a32c9..7dcd4cff25 100644 --- a/test/functional/ui/sign_spec.lua +++ b/test/functional/ui/sign_spec.lua @@ -156,6 +156,9 @@ describe('Signs', function() {0:~ }| | ]]) + -- Check that 'statuscolumn' correctly applies numhl + command('set statuscolumn=%s%=%l\\ ') + screen:expect_unchanged() end) it('highlights the cursorline sign with culhl', function() @@ -233,11 +236,13 @@ describe('Signs', function() | ]]) command('set cursorlineopt=number') + command('hi! link SignColumn IncSearch') + feed('Go<esc>2G') screen:expect([[ {1:>>}a | {8:>>}^b | {1:>>}c | - {0:~ }| + {5: } | {0:~ }| {0:~ }| {0:~ }| @@ -249,6 +254,9 @@ describe('Signs', function() {0:~ }| | ]]) + -- Check that 'statuscolumn' cursorline/signcolumn highlights are the same (#21726) + command('set statuscolumn=%s') + screen:expect_unchanged() end) it('multiple signs #9295', function() diff --git a/test/functional/ui/statuscolumn_spec.lua b/test/functional/ui/statuscolumn_spec.lua index cdc2cb8746..ca7d8af7f4 100644 --- a/test/functional/ui/statuscolumn_spec.lua +++ b/test/functional/ui/statuscolumn_spec.lua @@ -181,6 +181,8 @@ describe('statuscolumn', function() [1] = {foreground = Screen.colors.Brown}, [2] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGrey}, [3] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey}, + [4] = {bold = true, foreground = Screen.colors.Brown}, + [5] = {background = Screen.colors.Grey90}, }) screen:expect([[ {1: 4│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| @@ -206,91 +208,133 @@ describe('statuscolumn', function() command('sign place 3 line=6 name=piet1 buffer=1') command('sign place 4 line=6 name=piet2 buffer=1') screen:expect([[ - {1:>> 4│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {1: │ }aaaaa | - {0:>!}{1: 5│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {1: │ }aaaaa | + {1:>>}{2: }{1: 4│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: │ }aaaaa | + {0:>!}{2: }{1: 5│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: │ }aaaaa | {1:>>}{0:>!}{1: 6│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {1: │ }aaaaa | - {1: 7│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {1: │ }aaaaa | - {1: 8│ }^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {1: │ }aaaaa | - {1: 9│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {1: │ }aaaaa | - {1: 10│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa{0:@@@}| + {2: }{1: │ }aaaaa | + {2: }{1: 7│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: │ }aaaaa | + {2: }{1: 8│ }^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: │ }aaaaa | + {2: }{1: 9│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: │ }aaaaa | + {2: }{1:10│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa{0:@@@}| | ]]) command('norm zf$') -- Check that alignment works properly with signs after %= command("set stc=%C%=%{v:wrap?'':v:lnum}│%s\\ ") screen:expect([[ - {2: }{1: 4│>> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {2: }{1: │ }aaaaaa | - {2: }{1: 5│}{0:>!}{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {2: }{1: │ }aaaaaa | + {2: }{1: 4│>>}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: │}{2: }{1: }aaaaaa | + {2: }{1: 5│}{0:>!}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: │}{2: }{1: }aaaaaa | {2: }{1: 6│>>}{0:>!}{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {2: }{1: │ }aaaaaa | - {2: }{1: 7│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {2: }{1: │ }aaaaaa | - {2:+}{1: 8│ }{3:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}| - {2: }{1: 9│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {2: }{1: │ }aaaaaa | - {2: }{1:10│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {2: }{1: │ }aaaaaa | + {2: }{1: │}{2: }{1: }aaaaaa | + {2: }{1: 7│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: │}{2: }{1: }aaaaaa | + {2:+}{1: 8│}{2: }{1: }{3:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}| + {2: }{1: 9│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: │}{2: }{1: }aaaaaa | + {2: }{1:10│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: │}{2: }{1: }aaaaaa | + | + ]]) + command('set cursorline') + screen:expect([[ + {2: }{1: 4│>>}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: │}{2: }{1: }aaaaaa | + {2: }{1: 5│}{0:>!}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: │}{2: }{1: }aaaaaa | + {2: }{1: 6│>>}{0:>!}{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: │}{2: }{1: }aaaaaa | + {2: }{1: 7│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: │}{2: }{1: }aaaaaa | + {2:+}{4: 8│}{2: }{4: }{5:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}| + {2: }{1: 9│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: │}{2: }{1: }aaaaaa | + {2: }{1:10│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: │}{2: }{1: }aaaaaa | | ]]) -- v:lnum is the same value on wrapped lines command("set stc=%C%=%{v:lnum}│%s\\ ") screen:expect([[ - {2: }{1: 4│>> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {2: }{1: 4│ }aaaaaa | - {2: }{1: 5│}{0:>!}{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {2: }{1: 5│ }aaaaaa | + {2: }{1: 4│>>}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: 4│}{2: }{1: }aaaaaa | + {2: }{1: 5│}{0:>!}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: 5│}{2: }{1: }aaaaaa | {2: }{1: 6│>>}{0:>!}{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {2: }{1: 6│ }aaaaaa | - {2: }{1: 7│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {2: }{1: 7│ }aaaaaa | - {2:+}{1: 8│ }{3:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}| - {2: }{1: 9│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {2: }{1: 9│ }aaaaaa | - {2: }{1:10│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {2: }{1:10│ }aaaaaa | + {2: }{1: 6│}{2: }{1: }aaaaaa | + {2: }{1: 7│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: 7│}{2: }{1: }aaaaaa | + {2:+}{4: 8│}{2: }{4: }{5:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}| + {2: }{1: 9│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: 9│}{2: }{1: }aaaaaa | + {2: }{1:10│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1:10│}{2: }{1: }aaaaaa | | ]]) -- v:relnum is the same value on wrapped lines command("set stc=%C%=\\ %{v:relnum}│%s\\ ") screen:expect([[ - {2: }{1: 4│>> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {2: }{1: 4│ }aaaaaa | - {2: }{1: 3│}{0:>!}{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {2: }{1: 3│ }aaaaaa | + {2: }{1: 4│>>}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: 4│}{2: }{1: }aaaaaa | + {2: }{1: 3│}{0:>!}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: 3│}{2: }{1: }aaaaaa | {2: }{1: 2│>>}{0:>!}{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {2: }{1: 2│ }aaaaaa | - {2: }{1: 1│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {2: }{1: 1│ }aaaaaa | - {2:+}{1: 0│ }{3:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}| - {2: }{1: 1│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {2: }{1: 1│ }aaaaaa | - {2: }{1: 2│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {2: }{1: 2│ }aaaaaa | + {2: }{1: 2│}{2: }{1: }aaaaaa | + {2: }{1: 1│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: 1│}{2: }{1: }aaaaaa | + {2:+}{4: 0│}{2: }{4: }{5:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}| + {2: }{1: 1│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: 1│}{2: }{1: }aaaaaa | + {2: }{1: 2│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: 2│}{2: }{1: }aaaaaa | | ]]) command("set stc=%C%=\\ %{v:wrap?'':v:relnum}│%s\\ ") screen:expect([[ - {2: }{1: 4│>> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {2: }{1: │ }aaaaaa | - {2: }{1: 3│}{0:>!}{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {2: }{1: │ }aaaaaa | + {2: }{1: 4│>>}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: │}{2: }{1: }aaaaaa | + {2: }{1: 3│}{0:>!}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: │}{2: }{1: }aaaaaa | {2: }{1: 2│>>}{0:>!}{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {2: }{1: │ }aaaaaa | - {2: }{1: 1│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {2: }{1: │ }aaaaaa | - {2:+}{1: 0│ }{3:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}| - {2: }{1: 1│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {2: }{1: │ }aaaaaa | - {2: }{1: 2│ }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - {2: }{1: │ }aaaaaa | + {2: }{1: │}{2: }{1: }aaaaaa | + {2: }{1: 1│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: │}{2: }{1: }aaaaaa | + {2:+}{4: 0│}{2: }{4: }{5:^+-- 1 line: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}| + {2: }{1: 1│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: │}{2: }{1: }aaaaaa | + {2: }{1: 2│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: │}{2: }{1: }aaaaaa | + | + ]]) + -- Up to 9 signs in a line + command('set signcolumn=auto:9 foldcolumn=auto') + command('sign place 5 line=6 name=piet1 buffer=1') + command('sign place 6 line=6 name=piet2 buffer=1') + command('sign place 7 line=6 name=piet1 buffer=1') + command('sign place 8 line=6 name=piet2 buffer=1') + command('sign place 9 line=6 name=piet1 buffer=1') + command('sign place 10 line=6 name=piet2 buffer=1') + command('sign place 11 line=6 name=piet1 buffer=1') + screen:expect([[ + {2: }{1: 4│>>}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: │}{2: }{1: }aaaaaaaaaaaaaaaaaaaa | + {2: }{1: 3│}{0:>!}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: │}{2: }{1: }aaaaaaaaaaaaaaaaaaaa | + {2: }{1: 2│>>}{0:>!}{1:>>}{0:>!}{1:>>}{0:>!}{1:>>}{0:>!}{1:>> }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: │}{2: }{1: }aaaaaaaaaaaaaaaaaaaa | + {2: }{1: 1│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: │}{2: }{1: }aaaaaaaaaaaaaaaaaaaa | + {2:+}{4: 0│}{2: }{4: }{5:^+-- 1 line: aaaaaaaaaaaaaaaaa}| + {2: }{1: 1│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: │}{2: }{1: }aaaaaaaaaaaaaaaaaaaa | + {2: }{1: 2│}{2: }{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {2: }{1: │}{2: }{1: }aaaaaaaaaaaaaaaaaaaa | | ]]) end) diff --git a/test/includes/CMakeLists.txt b/test/includes/CMakeLists.txt index b4da4c0611..0d30736091 100644 --- a/test/includes/CMakeLists.txt +++ b/test/includes/CMakeLists.txt @@ -23,7 +23,6 @@ foreach(hfile ${PRE_HEADERS}) COMMAND ${CMAKE_C_COMPILER} -std=c99 -E -P ${CMAKE_CURRENT_SOURCE_DIR}/${hfile} ${gen_cflags} - -I${LIBUV_INCLUDE_DIRS} -o ${CMAKE_CURRENT_BINARY_DIR}/${post_hfile}) list(APPEND POST_HEADERS ${post_hfile}) endforeach() |