diff options
33 files changed, 415 insertions, 424 deletions
diff --git a/cmake.deps/CMakeLists.txt b/cmake.deps/CMakeLists.txt index c9736fea15..a7e71ffc92 100644 --- a/cmake.deps/CMakeLists.txt +++ b/cmake.deps/CMakeLists.txt @@ -12,11 +12,19 @@ list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" "${PROJECT_SOURCE_DI include(CheckCCompilerFlag) include(Util) +set(DEPS_CMAKE_ARGS + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_GENERATOR=${CMAKE_GENERATOR} + -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} + -DCMAKE_POSITION_INDEPENDENT_CODE=ON) + +set(DEPS_CMAKE_CACHE_ARGS -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES}) + set_default_buildtype() get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(NOT isMultiConfig) - set(BUILD_TYPE_STRING -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}) + list(APPEND DEPS_CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}) endif() set(DEFAULT_MAKE_CFLAGS CFLAGS+=-g) @@ -37,6 +45,8 @@ else() set(DEPS_INSTALL_DIR "${CMAKE_BINARY_DIR}/usr" CACHE PATH "Dependencies install directory.") endif() +list(APPEND DEPS_CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR}) + set(DEPS_BIN_DIR "${DEPS_INSTALL_DIR}/bin" CACHE PATH "Dependencies binary install directory.") set(DEPS_LIB_DIR "${DEPS_INSTALL_DIR}/lib" CACHE PATH "Dependencies library install directory.") set(DEPS_BUILD_DIR "${CMAKE_BINARY_DIR}/build" CACHE PATH "Dependencies build directory.") diff --git a/cmake.deps/cmake/BuildGettext.cmake b/cmake.deps/cmake/BuildGettext.cmake index 4ba1f46d2e..1f9fd38702 100644 --- a/cmake.deps/cmake/BuildGettext.cmake +++ b/cmake.deps/cmake/BuildGettext.cmake @@ -10,13 +10,10 @@ if(MSVC) PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/cmake/GettextCMakeLists.txt ${DEPS_BUILD_DIR}/src/gettext/CMakeLists.txt - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR} - ${BUILD_TYPE_STRING} - -DCMAKE_GENERATOR=${CMAKE_GENERATOR} - -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} + CMAKE_ARGS ${DEPS_CMAKE_ARGS} -DLIBICONV_INCLUDE_DIRS=${DEPS_INSTALL_DIR}/include - -DLIBICONV_LIBRARIES=${DEPS_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}libcharset${CMAKE_STATIC_LIBRARY_SUFFIX}$<SEMICOLON>${DEPS_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}libiconv${CMAKE_STATIC_LIBRARY_SUFFIX}) + -DLIBICONV_LIBRARIES=${DEPS_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}libcharset${CMAKE_STATIC_LIBRARY_SUFFIX}$<SEMICOLON>${DEPS_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}libiconv${CMAKE_STATIC_LIBRARY_SUFFIX} + CMAKE_CACHE_ARGS ${DEPS_CMAKE_CACHE_ARGS}) else() message(FATAL_ERROR "Trying to build gettext in an unsupported system ${CMAKE_SYSTEM_NAME}/${CMAKE_C_COMPILER_ID}") endif() diff --git a/cmake.deps/cmake/BuildLibiconv.cmake b/cmake.deps/cmake/BuildLibiconv.cmake index 382aae3df7..4b9c07ed6c 100644 --- a/cmake.deps/cmake/BuildLibiconv.cmake +++ b/cmake.deps/cmake/BuildLibiconv.cmake @@ -10,11 +10,8 @@ if(MSVC) PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/cmake/LibiconvCMakeLists.txt ${DEPS_BUILD_DIR}/src/libiconv/CMakeLists.txt - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR} - ${BUILD_TYPE_STRING} - -DCMAKE_GENERATOR=${CMAKE_GENERATOR} - -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM}) + CMAKE_ARGS ${DEPS_CMAKE_ARGS} + CMAKE_CACHE_ARGS ${DEPS_CMAKE_CACHE_ARGS}) else() message(FATAL_ERROR "Trying to build libiconv in an unsupported system ${CMAKE_SYSTEM_NAME}/${CMAKE_C_COMPILER_ID}") endif() diff --git a/cmake.deps/cmake/BuildLibtermkey.cmake b/cmake.deps/cmake/BuildLibtermkey.cmake index ac453591e0..6457a864ba 100644 --- a/cmake.deps/cmake/BuildLibtermkey.cmake +++ b/cmake.deps/cmake/BuildLibtermkey.cmake @@ -9,14 +9,10 @@ ExternalProject_Add(libtermkey PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/cmake/libtermkeyCMakeLists.txt ${DEPS_BUILD_DIR}/src/libtermkey/CMakeLists.txt - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR} + CMAKE_ARGS ${DEPS_CMAKE_ARGS} -DCMAKE_SHARED_LIBRARY_LINK_C_FLAGS="" # Hack to avoid -rdynamic in Mingw - -DCMAKE_GENERATOR=${CMAKE_GENERATOR} - -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} - -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DUNIBILIUM_INCLUDE_DIRS=${DEPS_INSTALL_DIR}/include -DUNIBILIUM_LIBRARIES=${DEPS_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}unibilium${CMAKE_STATIC_LIBRARY_SUFFIX} - ${BUILD_TYPE_STRING}) + CMAKE_CACHE_ARGS ${DEPS_CMAKE_CACHE_ARGS}) list(APPEND THIRD_PARTY_DEPS libtermkey) diff --git a/cmake.deps/cmake/BuildLibuv.cmake b/cmake.deps/cmake/BuildLibuv.cmake index c21e166d95..eb88458644 100644 --- a/cmake.deps/cmake/BuildLibuv.cmake +++ b/cmake.deps/cmake/BuildLibuv.cmake @@ -5,15 +5,11 @@ ExternalProject_Add(libuv URL ${LIBUV_URL} URL_HASH SHA256=${LIBUV_SHA256} DOWNLOAD_NO_PROGRESS TRUE - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR} + DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/libuv + CMAKE_ARGS ${DEPS_CMAKE_ARGS} -DCMAKE_INSTALL_LIBDIR=lib -DBUILD_TESTING=OFF - -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DLIBUV_BUILD_SHARED=OFF - ${BUILD_TYPE_STRING} - CMAKE_CACHE_ARGS - -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES} - DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/libuv) + CMAKE_CACHE_ARGS ${DEPS_CMAKE_CACHE_ARGS}) list(APPEND THIRD_PARTY_DEPS libuv) diff --git a/cmake.deps/cmake/BuildLibvterm.cmake b/cmake.deps/cmake/BuildLibvterm.cmake index 2e508a8dc8..1578d56fba 100644 --- a/cmake.deps/cmake/BuildLibvterm.cmake +++ b/cmake.deps/cmake/BuildLibvterm.cmake @@ -33,6 +33,8 @@ ExternalProject_Add(libvterm BUILD_IN_SOURCE 1 CONFIGURE_COMMAND "${LIBVTERM_CONFIGURE_COMMAND}" BUILD_COMMAND "${LIBVTERM_BUILD_COMMAND}" - INSTALL_COMMAND "${LIBVTERM_INSTALL_COMMAND}") + INSTALL_COMMAND "${LIBVTERM_INSTALL_COMMAND}" + CMAKE_ARGS ${DEPS_CMAKE_ARGS} + CMAKE_CACHE_ARGS ${DEPS_CMAKE_CACHE_ARGS}) list(APPEND THIRD_PARTY_DEPS libvterm) diff --git a/cmake.deps/cmake/BuildLuv.cmake b/cmake.deps/cmake/BuildLuv.cmake index ec0707020a..38c0503c5b 100644 --- a/cmake.deps/cmake/BuildLuv.cmake +++ b/cmake.deps/cmake/BuildLuv.cmake @@ -2,18 +2,12 @@ set(LUV_INCLUDE_FLAGS "-I${DEPS_INSTALL_DIR}/include -I${DEPS_INSTALL_DIR}/include/luajit-2.1") set(LUV_CMAKE_ARGS - -DCMAKE_GENERATOR=${CMAKE_GENERATOR} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} - ${BUILD_TYPE_STRING} - -DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR} -DLUA_BUILD_TYPE=System -DLUA_COMPAT53_DIR=${DEPS_BUILD_DIR}/src/lua-compat-5.3 -DWITH_SHARED_LIBUV=ON -DBUILD_SHARED_LIBS=OFF -DBUILD_STATIC_LIBS=ON - -DBUILD_MODULE=OFF - -DCMAKE_POSITION_INDEPENDENT_CODE=ON) + -DBUILD_MODULE=OFF) if(USE_BUNDLED_LUAJIT) list(APPEND LUV_CMAKE_ARGS -DWITH_LUA_ENGINE=LuaJit) @@ -63,9 +57,8 @@ ExternalProject_Add(luv-static DOWNLOAD_NO_PROGRESS TRUE DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/luv SOURCE_DIR ${DEPS_BUILD_DIR}/src/luv - CMAKE_ARGS ${LUV_CMAKE_ARGS} - CMAKE_CACHE_ARGS - -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES}) + CMAKE_ARGS ${DEPS_CMAKE_ARGS} ${LUV_CMAKE_ARGS} + CMAKE_CACHE_ARGS ${DEPS_CMAKE_CACHE_ARGS}) list(APPEND THIRD_PARTY_DEPS luv-static) if(USE_BUNDLED_LUAJIT) diff --git a/cmake.deps/cmake/BuildMsgpack.cmake b/cmake.deps/cmake/BuildMsgpack.cmake index 8347eb6170..431420fb62 100644 --- a/cmake.deps/cmake/BuildMsgpack.cmake +++ b/cmake.deps/cmake/BuildMsgpack.cmake @@ -1,13 +1,3 @@ -set(MSGPACK_CMAKE_ARGS - -DMSGPACK_BUILD_TESTS=OFF - -DMSGPACK_BUILD_EXAMPLES=OFF - -DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_GENERATOR=${CMAKE_GENERATOR} - -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} - -DCMAKE_POSITION_INDEPENDENT_CODE=ON - ${BUILD_TYPE_STRING}) - if(USE_EXISTING_SRC_DIR) unset(MSGPACK_URL) endif() @@ -16,8 +6,9 @@ ExternalProject_Add(msgpack URL_HASH SHA256=${MSGPACK_SHA256} DOWNLOAD_NO_PROGRESS TRUE DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/msgpack - CMAKE_ARGS "${MSGPACK_CMAKE_ARGS}" - CMAKE_CACHE_ARGS - -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES}) + CMAKE_ARGS ${DEPS_CMAKE_ARGS} + -DMSGPACK_BUILD_TESTS=OFF + -DMSGPACK_BUILD_EXAMPLES=OFF + CMAKE_CACHE_ARGS ${DEPS_CMAKE_CACHE_ARGS}) list(APPEND THIRD_PARTY_DEPS msgpack) diff --git a/cmake.deps/cmake/BuildTreesitter.cmake b/cmake.deps/cmake/BuildTreesitter.cmake index 836c25fe1d..d906e6aa59 100644 --- a/cmake.deps/cmake/BuildTreesitter.cmake +++ b/cmake.deps/cmake/BuildTreesitter.cmake @@ -1,21 +1,3 @@ -if(MSVC) - set(TREESITTER_CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_CURRENT_SOURCE_DIR}/cmake/TreesitterCMakeLists.txt - ${DEPS_BUILD_DIR}/src/tree-sitter/CMakeLists.txt - COMMAND ${CMAKE_COMMAND} ${DEPS_BUILD_DIR}/src/tree-sitter/CMakeLists.txt - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_GENERATOR=${CMAKE_GENERATOR} - -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} - ${BUILD_TYPE_STRING} - -DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR}) - set(TREESITTER_BUILD_COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>) - set(TREESITTER_INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config $<CONFIG>) -else() - set(TREESITTER_BUILD_COMMAND ${MAKE_PRG} CC=${DEPS_C_COMPILER}) - set(TREESITTER_INSTALL_COMMAND - ${MAKE_PRG} CC=${DEPS_C_COMPILER} PREFIX=${DEPS_INSTALL_DIR} install) -endif() - if(USE_EXISTING_SRC_DIR) unset(TREESITTER_URL) endif() @@ -25,9 +7,10 @@ ExternalProject_Add(tree-sitter DOWNLOAD_NO_PROGRESS TRUE DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/tree-sitter INSTALL_DIR ${DEPS_INSTALL_DIR} - BUILD_IN_SOURCE 1 - CONFIGURE_COMMAND "${TREESITTER_CONFIGURE_COMMAND}" - BUILD_COMMAND "${TREESITTER_BUILD_COMMAND}" - INSTALL_COMMAND "${TREESITTER_INSTALL_COMMAND}") + PATCH_COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/TreesitterCMakeLists.txt + ${DEPS_BUILD_DIR}/src/tree-sitter/CMakeLists.txt + CMAKE_ARGS ${DEPS_CMAKE_ARGS} + CMAKE_CACHE_ARGS ${DEPS_CMAKE_CACHE_ARGS}) list(APPEND THIRD_PARTY_DEPS tree-sitter) diff --git a/cmake.deps/cmake/BuildTreesitterParsers.cmake b/cmake.deps/cmake/BuildTreesitterParsers.cmake index ead039aae6..d62b19d97d 100644 --- a/cmake.deps/cmake/BuildTreesitterParsers.cmake +++ b/cmake.deps/cmake/BuildTreesitterParsers.cmake @@ -8,14 +8,12 @@ function(BuildTSParser LANG TS_URL TS_SHA256 TS_CMAKE_FILE) URL_HASH SHA256=${TS_SHA256} DOWNLOAD_NO_PROGRESS TRUE DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/${NAME} - CMAKE_CACHE_ARGS - -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES} PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${TS_CMAKE_FILE} ${DEPS_BUILD_DIR}/src/${NAME}/CMakeLists.txt - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR} - -DPARSERLANG=${LANG}) + CMAKE_ARGS ${DEPS_CMAKE_ARGS} + -DPARSERLANG=${LANG} + CMAKE_CACHE_ARGS ${DEPS_CMAKE_CACHE_ARGS}) endfunction() BuildTSParser(c ${TREESITTER_C_URL} ${TREESITTER_C_SHA256} TreesitterParserCMakeLists.txt) diff --git a/cmake.deps/cmake/BuildUnibilium.cmake b/cmake.deps/cmake/BuildUnibilium.cmake index dd42480a75..9a8caf89d1 100644 --- a/cmake.deps/cmake/BuildUnibilium.cmake +++ b/cmake.deps/cmake/BuildUnibilium.cmake @@ -6,11 +6,7 @@ ExternalProject_Add(unibilium URL_HASH SHA256=${UNIBILIUM_SHA256} DOWNLOAD_NO_PROGRESS TRUE DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/unibilium - CMAKE_ARGS - -DCMAKE_GENERATOR=${CMAKE_GENERATOR} - -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} - -DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR} - -DCMAKE_POSITION_INDEPENDENT_CODE=ON - ${BUILD_TYPE_STRING}) + CMAKE_ARGS ${DEPS_CMAKE_ARGS} + CMAKE_CACHE_ARGS ${DEPS_CMAKE_CACHE_ARGS}) list(APPEND THIRD_PARTY_DEPS unibilium) diff --git a/cmake.deps/cmake/TreesitterCMakeLists.txt b/cmake.deps/cmake/TreesitterCMakeLists.txt index 27a57f80af..49fb19c96a 100644 --- a/cmake.deps/cmake/TreesitterCMakeLists.txt +++ b/cmake.deps/cmake/TreesitterCMakeLists.txt @@ -2,7 +2,8 @@ cmake_minimum_required(VERSION 3.10) project(tree-sitter LANGUAGES C) add_library(tree-sitter lib/src/lib.c) -target_include_directories(tree-sitter PRIVATE lib/include) +target_include_directories(tree-sitter + PRIVATE lib/src lib/include) install(FILES lib/include/tree_sitter/api.h diff --git a/cmake.deps/cmake/libtermkeyCMakeLists.txt b/cmake.deps/cmake/libtermkeyCMakeLists.txt index b419d38d7b..26c9d7730b 100644 --- a/cmake.deps/cmake/libtermkeyCMakeLists.txt +++ b/cmake.deps/cmake/libtermkeyCMakeLists.txt @@ -20,17 +20,4 @@ install(TARGETS termkey ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) -enable_testing() -file(GLOB TESTSOURCES "t/[0-9]*.c") -foreach(f ${TESTSOURCES}) - get_filename_component(t ${f} NAME_WE) - if(${t} STREQUAL 05read) - continue() - endif() - - add_executable("test_${t}" ${f} t/taplib.c) - target_link_libraries("test_${t}" termkey) - add_test("${t}" "test_${t}") -endforeach() - # vim: set ft=cmake: diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 85effcaf5e..4d2c85b134 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -8328,6 +8328,7 @@ synIDattr({synID}, {what} [, {mode}]) *synIDattr()* "underdotted" "1" if dotted underlined "underdashed" "1" if dashed underlined "strikethrough" "1" if struckthrough + "altfont" "1" if alternative font "nocombine" "1" if nocombine Returns an empty string on error. diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 9757bc9693..215515a2d9 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -832,128 +832,118 @@ start({config}, {opts}) *vim.lsp.start()* start_client({config}) *vim.lsp.start_client()* Starts and initializes a client with the given configuration. - Parameter `cmd` is required. - - The following parameters describe fields in the {config} table. - - Parameters: ~ - • {cmd} (table|string|fun(dispatchers: table):table) - command string or list treated like |jobstart()|. - The command must launch the language server - process. `cmd` can also be a function that - creates an RPC client. The function receives a - dispatchers table and must return a table with - the functions `request`, `notify`, `is_closing` - and `terminate` See |vim.lsp.rpc.request()| and - |vim.lsp.rpc.notify()| For TCP there is a - built-in rpc client factory: - |vim.lsp.rpc.connect()| - • {cmd_cwd} (string, default=|getcwd()|) Directory to launch - the `cmd` process. Not related to `root_dir`. - • {cmd_env} (table) Environment flags to pass to the LSP on - spawn. Can be specified using keys like a map or - as a list with `k=v` pairs or both. Non-string values are coerced to - string. Example: > - - { "PRODUCTION=true"; "TEST=123"; PORT = 8080; HOST = "0.0.0.0"; } + Field `cmd` in {config} is required. + + Parameters: ~ + • {config} (table) Configuration for the server: + • cmd: (table|string|fun(dispatchers: table):table) command + string or list treated like |jobstart()|. The command must + launch the language server process. `cmd` can also be a + function that creates an RPC client. The function receives + a dispatchers table and must return a table with the + functions `request`, `notify`, `is_closing` and + `terminate` See |vim.lsp.rpc.request()| and + |vim.lsp.rpc.notify()| For TCP there is a built-in rpc + client factory: |vim.lsp.rpc.connect()| + • cmd_cwd: (string, default=|getcwd()|) Directory to launch + the `cmd` process. Not related to `root_dir`. + • cmd_env: (table) Environment flags to pass to the LSP on + spawn. Can be specified using keys like a map or as a list + with `k=v` pairs or both. Non-string values are coerced to string. + Example: > + + { "PRODUCTION=true"; "TEST=123"; PORT = 8080; HOST = "0.0.0.0"; } < - • {detached} (boolean, default true) Daemonize the server - process so that it runs in a separate process - group from Nvim. Nvim will shutdown the process - on exit, but if Nvim fails to exit cleanly this - could leave behind orphaned server processes. - • {workspace_folders} (table) List of workspace folders passed to the - language server. For backwards compatibility - rootUri and rootPath will be derived from the - first workspace folder in this list. See - `workspaceFolders` in the LSP spec. - • {capabilities} Map overriding the default capabilities defined - by |vim.lsp.protocol.make_client_capabilities()|, - passed to the language server on initialization. - Hint: use make_client_capabilities() and modify - its result. - • Note: To send an empty dictionary use - `{[vim.type_idx]=vim.types.dictionary}`, else - it will be encoded as an array. - • {handlers} Map of language server method names to - |lsp-handler| - • {settings} Map with language server specific settings. These - are returned to the language server if requested - via `workspace/configuration`. Keys are - case-sensitive. - • {commands} (table) Table that maps string of clientside - commands to user-defined functions. Commands - passed to start_client take precedence over the - global command registry. Each key must be a - unique command name, and the value is a function - which is called if any LSP action (code action, - code lenses, ...) triggers the command. - • {init_options} Values to pass in the initialization request as - `initializationOptions`. See `initialize` in the - LSP spec. - • {name} (string, default=client-id) Name in log messages. - • {get_language_id} function(bufnr, filetype) -> language ID as - string. Defaults to the filetype. - • {offset_encoding} (default="utf-16") One of "utf-8", "utf-16", or - "utf-32" which is the encoding that the LSP - server expects. Client does not verify this is - correct. - • {on_error} Callback with parameters (code, ...), invoked - when the client operation throws an error. `code` - is a number describing the error. Other arguments - may be passed depending on the error kind. See - `vim.lsp.rpc.client_errors` for possible errors. - Use `vim.lsp.rpc.client_errors[code]` to get - human-friendly name. - • {before_init} Callback with parameters (initialize_params, - config) invoked before the LSP "initialize" - phase, where `params` contains the parameters - being sent to the server and `config` is the - config that was passed to - |vim.lsp.start_client()|. You can use this to - modify parameters before they are sent. - • {on_init} Callback (client, initialize_result) invoked - after LSP "initialize", where `result` is a table - of `capabilities` and anything else the server - may send. For example, clangd sends - `initialize_result.offsetEncoding` if - `capabilities.offsetEncoding` was sent to it. You - can only modify the `client.offset_encoding` here - before any notifications are sent. Most language - servers expect to be sent client specified - settings after initialization. Neovim does not - make this assumption. A - `workspace/didChangeConfiguration` notification - should be sent to the server during on_init. - • {on_exit} Callback (code, signal, client_id) invoked on - client exit. - • code: exit code of the process - • signal: number describing the signal used to - terminate (if any) - • client_id: client handle - • {on_attach} Callback (client, bufnr) invoked when client - attaches to a buffer. - • {trace} "off" | "messages" | "verbose" | nil passed - directly to the language server in the initialize - request. Invalid/empty values will default to - "off" - • {flags} A table with flags for the client. The current - (experimental) flags are: - • allow_incremental_sync (bool, default true): - Allow using incremental sync for buffer edits - • debounce_text_changes (number, default 150): - Debounce didChange notifications to the server - by the given number in milliseconds. No - debounce occurs if nil - • exit_timeout (number|boolean, default false): - Milliseconds to wait for server to exit cleanly - after sending the "shutdown" request before - sending kill -15. If set to false, nvim exits - immediately after sending the "shutdown" - request to the server. - • {root_dir} (string) Directory where the LSP server will base - its workspaceFolders, rootUri, and rootPath on - initialization. + • detached: (boolean, default true) Daemonize the server + process so that it runs in a separate process group from + Nvim. Nvim will shutdown the process on exit, but if Nvim + fails to exit cleanly this could leave behind orphaned + server processes. + • workspace_folders: (table) List of workspace folders + passed to the language server. For backwards compatibility + rootUri and rootPath will be derived from the first + workspace folder in this list. See `workspaceFolders` in + the LSP spec. + • capabilities: Map overriding the default capabilities + defined by |vim.lsp.protocol.make_client_capabilities()|, + passed to the language server on initialization. Hint: use + make_client_capabilities() and modify its result. + • Note: To send an empty dictionary use + `{[vim.type_idx]=vim.types.dictionary}`, else it will be + encoded as an array. + + • handlers: Map of language server method names to + |lsp-handler| + • settings: Map with language server specific settings. + These are returned to the language server if requested via + `workspace/configuration`. Keys are case-sensitive. + • commands: table Table that maps string of clientside + commands to user-defined functions. Commands passed to + start_client take precedence over the global command + registry. Each key must be a unique command name, and the + value is a function which is called if any LSP action + (code action, code lenses, ...) triggers the command. + • init_options Values to pass in the initialization request + as `initializationOptions`. See `initialize` in the LSP + spec. + • name: (string, default=client-id) Name in log messages. + • get_language_id: function(bufnr, filetype) -> language ID + as string. Defaults to the filetype. + • offset_encoding: (default="utf-16") One of "utf-8", + "utf-16", or "utf-32" which is the encoding that the LSP + server expects. Client does not verify this is correct. + • on_error: Callback with parameters (code, ...), invoked + when the client operation throws an error. `code` is a + number describing the error. Other arguments may be passed + depending on the error kind. See + `vim.lsp.rpc.client_errors` for possible errors. Use + `vim.lsp.rpc.client_errors[code]` to get human-friendly + name. + • before_init: Callback with parameters (initialize_params, + config) invoked before the LSP "initialize" phase, where + `params` contains the parameters being sent to the server + and `config` is the config that was passed to + |vim.lsp.start_client()|. You can use this to modify + parameters before they are sent. + • on_init: Callback (client, initialize_result) invoked + after LSP "initialize", where `result` is a table of + `capabilities` and anything else the server may send. For + example, clangd sends `initialize_result.offsetEncoding` + if `capabilities.offsetEncoding` was sent to it. You can + only modify the `client.offset_encoding` here before any + notifications are sent. Most language servers expect to be + sent client specified settings after initialization. + Neovim does not make this assumption. A + `workspace/didChangeConfiguration` notification should be + sent to the server during on_init. + • on_exit Callback (code, signal, client_id) invoked on + client exit. + • code: exit code of the process + • signal: number describing the signal used to terminate + (if any) + • client_id: client handle + + • on_attach: Callback (client, bufnr) invoked when client + attaches to a buffer. + • trace: ("off" | "messages" | "verbose" | nil) passed + directly to the language server in the initialize request. + Invalid/empty values will default to "off" + • flags: A table with flags for the client. The current + (experimental) flags are: + • allow_incremental_sync (bool, default true): Allow using + incremental sync for buffer edits + • debounce_text_changes (number, default 150): Debounce + didChange notifications to the server by the given + number in milliseconds. No debounce occurs if nil + • exit_timeout (number|boolean, default false): + Milliseconds to wait for server to exit cleanly after + sending the "shutdown" request before sending kill -15. + If set to false, nvim exits immediately after sending + the "shutdown" request to the server. + + • root_dir: (string) Directory where the LSP server will + base its workspaceFolders, rootUri, and rootPath on + initialization. Return: ~ Client id. |vim.lsp.get_client_by_id()| Note: client may not be fully diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index f325c58efb..47249a484b 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -2392,7 +2392,7 @@ normalize({path}) *vim.fs.normalize()* Examples: >lua - vim.fs.normalize('C:\Users\jdoe') + vim.fs.normalize('C:\\Users\\jdoe') --> 'C:/Users/jdoe' vim.fs.normalize('~/src/neovim') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 853ca23e5d..5c234677ef 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -149,6 +149,8 @@ The following new APIs or features were added. deterministic, and a `LUA_GEN_PRG` build parameter has been introduced to allow for a workaround for some remaining reproducibility problems. +• |:highlight| now supports an additional attribute "altfont". + ============================================================================== CHANGED FEATURES *news-changes* diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index b4afc3f233..bd5a4f1926 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -4958,7 +4958,8 @@ the same syntax file on all UIs. *bold* *underline* *undercurl* *underdouble* *underdotted* *underdashed* *inverse* *italic* - *standout* *nocombine* *strikethrough* + *standout* *strikethrough* *altfont* + *nocombine* cterm={attr-list} *attr-list* *highlight-cterm* *E418* attr-list is a comma-separated list (without spaces) of the following items (in any order): @@ -4973,6 +4974,7 @@ cterm={attr-list} *attr-list* *highlight-cterm* *E418* inverse same as reverse italic standout + altfont nocombine override attributes instead of combining them NONE no attributes used (used to reset it) diff --git a/runtime/doc/ui.txt b/runtime/doc/ui.txt index a2ae9f22ce..3110d0817c 100644 --- a/runtime/doc/ui.txt +++ b/runtime/doc/ui.txt @@ -324,6 +324,7 @@ numerical highlight ids to the actual attributes. `underdouble`: double underlined text. The lines have `special` color. `underdotted`: underdotted text. The dots have `special` color. `underdashed`: underdashed text. The dashes have `special` color. + `altfont`: alternative font. `blend`: Blend level (0-100). Could be used by UIs to support blending floating windows to the background or to signal a transparent cursor. diff --git a/runtime/lua/vim/fs.lua b/runtime/lua/vim/fs.lua index 65e6ca677c..a0d2c4c339 100644 --- a/runtime/lua/vim/fs.lua +++ b/runtime/lua/vim/fs.lua @@ -282,7 +282,7 @@ end --- --- Examples: --- <pre>lua ---- vim.fs.normalize('C:\\Users\\jdoe') +--- vim.fs.normalize('C:\\\\Users\\\\jdoe') --- --> 'C:/Users/jdoe' --- --- vim.fs.normalize('~/src/neovim') diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index 134a009a72..c5392ac154 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -897,115 +897,114 @@ end -- --- Starts and initializes a client with the given configuration. --- ---- Parameter `cmd` is required. ---- ---- The following parameters describe fields in the {config} table. ---- ---- ----@param cmd: (table|string|fun(dispatchers: table):table) command string or ---- list treated like |jobstart()|. The command must launch the language server ---- process. `cmd` can also be a function that creates an RPC client. ---- The function receives a dispatchers table and must return a table with the ---- functions `request`, `notify`, `is_closing` and `terminate` ---- See |vim.lsp.rpc.request()| and |vim.lsp.rpc.notify()| ---- For TCP there is a built-in rpc client factory: |vim.lsp.rpc.connect()| ---- ----@param cmd_cwd: (string, default=|getcwd()|) Directory to launch ---- the `cmd` process. Not related to `root_dir`. ---- ----@param cmd_env: (table) Environment flags to pass to the LSP on ---- spawn. Can be specified using keys like a map or as a list with `k=v` ---- pairs or both. Non-string values are coerced to string. ---- Example: ---- <pre> ---- { "PRODUCTION=true"; "TEST=123"; PORT = 8080; HOST = "0.0.0.0"; } ---- </pre> ---- ----@param detached: (boolean, default true) Daemonize the server process so that it runs in a ---- separate process group from Nvim. Nvim will shutdown the process on exit, but if Nvim fails to ---- exit cleanly this could leave behind orphaned server processes. ---- ----@param workspace_folders (table) List of workspace folders passed to the ---- language server. For backwards compatibility rootUri and rootPath will be ---- derived from the first workspace folder in this list. See `workspaceFolders` in ---- the LSP spec. ---- ----@param capabilities Map overriding the default capabilities defined by ---- |vim.lsp.protocol.make_client_capabilities()|, passed to the language ---- server on initialization. Hint: use make_client_capabilities() and modify ---- its result. ---- - Note: To send an empty dictionary use ---- `{[vim.type_idx]=vim.types.dictionary}`, else it will be encoded as an ---- array. ---- ----@param handlers Map of language server method names to |lsp-handler| ---- ----@param settings Map with language server specific settings. These are ---- returned to the language server if requested via `workspace/configuration`. ---- Keys are case-sensitive. ---- ----@param commands table Table that maps string of clientside commands to user-defined functions. ---- Commands passed to start_client take precedence over the global command registry. Each key ---- must be a unique command name, and the value is a function which is called if any LSP action ---- (code action, code lenses, ...) triggers the command. ---- ----@param init_options Values to pass in the initialization request ---- as `initializationOptions`. See `initialize` in the LSP spec. ---- ----@param name (string, default=client-id) Name in log messages. ---- ----@param get_language_id function(bufnr, filetype) -> language ID as string. ---- Defaults to the filetype. ---- ----@param offset_encoding (default="utf-16") One of "utf-8", "utf-16", ---- or "utf-32" which is the encoding that the LSP server expects. Client does ---- not verify this is correct. ---- ----@param on_error Callback with parameters (code, ...), invoked ---- when the client operation throws an error. `code` is a number describing ---- the error. Other arguments may be passed depending on the error kind. See ---- `vim.lsp.rpc.client_errors` for possible errors. ---- Use `vim.lsp.rpc.client_errors[code]` to get human-friendly name. ---- ----@param before_init Callback with parameters (initialize_params, config) ---- invoked before the LSP "initialize" phase, where `params` contains the ---- parameters being sent to the server and `config` is the config that was ---- passed to |vim.lsp.start_client()|. You can use this to modify parameters before ---- they are sent. ---- ----@param on_init Callback (client, initialize_result) invoked after LSP ---- "initialize", where `result` is a table of `capabilities` and anything else ---- the server may send. For example, clangd sends ---- `initialize_result.offsetEncoding` if `capabilities.offsetEncoding` was ---- sent to it. You can only modify the `client.offset_encoding` here before ---- any notifications are sent. Most language servers expect to be sent client specified settings after ---- initialization. Neovim does not make this assumption. A ---- `workspace/didChangeConfiguration` notification should be sent ---- to the server during on_init. ---- ----@param on_exit Callback (code, signal, client_id) invoked on client +--- Field `cmd` in {config} is required. +--- +---@param config (table) Configuration for the server: +--- - cmd: (table|string|fun(dispatchers: table):table) command string or +--- list treated like |jobstart()|. The command must launch the language server +--- process. `cmd` can also be a function that creates an RPC client. +--- The function receives a dispatchers table and must return a table with the +--- functions `request`, `notify`, `is_closing` and `terminate` +--- See |vim.lsp.rpc.request()| and |vim.lsp.rpc.notify()| +--- For TCP there is a built-in rpc client factory: |vim.lsp.rpc.connect()| +--- +--- - cmd_cwd: (string, default=|getcwd()|) Directory to launch +--- the `cmd` process. Not related to `root_dir`. +--- +--- - cmd_env: (table) Environment flags to pass to the LSP on +--- spawn. Can be specified using keys like a map or as a list with `k=v` +--- pairs or both. Non-string values are coerced to string. +--- Example: +--- <pre> +--- { "PRODUCTION=true"; "TEST=123"; PORT = 8080; HOST = "0.0.0.0"; } +--- </pre> +--- +--- - detached: (boolean, default true) Daemonize the server process so that it runs in a +--- separate process group from Nvim. Nvim will shutdown the process on exit, but if Nvim fails to +--- exit cleanly this could leave behind orphaned server processes. +--- +--- - workspace_folders: (table) List of workspace folders passed to the +--- language server. For backwards compatibility rootUri and rootPath will be +--- derived from the first workspace folder in this list. See `workspaceFolders` in +--- the LSP spec. +--- +--- - capabilities: Map overriding the default capabilities defined by +--- |vim.lsp.protocol.make_client_capabilities()|, passed to the language +--- server on initialization. Hint: use make_client_capabilities() and modify +--- its result. +--- - Note: To send an empty dictionary use +--- `{[vim.type_idx]=vim.types.dictionary}`, else it will be encoded as an +--- array. +--- +--- - handlers: Map of language server method names to |lsp-handler| +--- +--- - settings: Map with language server specific settings. These are +--- returned to the language server if requested via `workspace/configuration`. +--- Keys are case-sensitive. +--- +--- - commands: table Table that maps string of clientside commands to user-defined functions. +--- Commands passed to start_client take precedence over the global command registry. Each key +--- must be a unique command name, and the value is a function which is called if any LSP action +--- (code action, code lenses, ...) triggers the command. +--- +--- - init_options Values to pass in the initialization request +--- as `initializationOptions`. See `initialize` in the LSP spec. +--- +--- - name: (string, default=client-id) Name in log messages. +--- +--- - get_language_id: function(bufnr, filetype) -> language ID as string. +--- Defaults to the filetype. +--- +--- - offset_encoding: (default="utf-16") One of "utf-8", "utf-16", +--- or "utf-32" which is the encoding that the LSP server expects. Client does +--- not verify this is correct. +--- +--- - on_error: Callback with parameters (code, ...), invoked +--- when the client operation throws an error. `code` is a number describing +--- the error. Other arguments may be passed depending on the error kind. See +--- `vim.lsp.rpc.client_errors` for possible errors. +--- Use `vim.lsp.rpc.client_errors[code]` to get human-friendly name. +--- +--- - before_init: Callback with parameters (initialize_params, config) +--- invoked before the LSP "initialize" phase, where `params` contains the +--- parameters being sent to the server and `config` is the config that was +--- passed to |vim.lsp.start_client()|. You can use this to modify parameters before +--- they are sent. +--- +--- - on_init: Callback (client, initialize_result) invoked after LSP +--- "initialize", where `result` is a table of `capabilities` and anything else +--- the server may send. For example, clangd sends +--- `initialize_result.offsetEncoding` if `capabilities.offsetEncoding` was +--- sent to it. You can only modify the `client.offset_encoding` here before +--- any notifications are sent. Most language servers expect to be sent client specified settings after +--- initialization. Neovim does not make this assumption. A +--- `workspace/didChangeConfiguration` notification should be sent +--- to the server during on_init. +--- +--- - on_exit Callback (code, signal, client_id) invoked on client --- exit. ---- - code: exit code of the process ---- - signal: number describing the signal used to terminate (if any) ---- - client_id: client handle ---- ----@param on_attach Callback (client, bufnr) invoked when client ---- attaches to a buffer. ---- ----@param trace: "off" | "messages" | "verbose" | nil passed directly to the language ---- server in the initialize request. Invalid/empty values will default to "off" ----@param flags: A table with flags for the client. The current (experimental) flags are: ---- - allow_incremental_sync (bool, default true): Allow using incremental sync for buffer edits ---- - debounce_text_changes (number, default 150): Debounce didChange ---- notifications to the server by the given number in milliseconds. No debounce ---- occurs if nil ---- - exit_timeout (number|boolean, default false): Milliseconds to wait for server to ---- exit cleanly after sending the "shutdown" request before sending kill -15. ---- If set to false, nvim exits immediately after sending the "shutdown" request to the server. ---- ----@param root_dir string Directory where the LSP ---- server will base its workspaceFolders, rootUri, and rootPath ---- on initialization. +--- - code: exit code of the process +--- - signal: number describing the signal used to terminate (if any) +--- - client_id: client handle +--- +--- - on_attach: Callback (client, bufnr) invoked when client +--- attaches to a buffer. +--- +--- - trace: ("off" | "messages" | "verbose" | nil) passed directly to the language +--- server in the initialize request. Invalid/empty values will default to "off" +--- +--- - flags: A table with flags for the client. The current (experimental) flags are: +--- - allow_incremental_sync (bool, default true): Allow using incremental sync for buffer edits +--- - debounce_text_changes (number, default 150): Debounce didChange +--- notifications to the server by the given number in milliseconds. No debounce +--- occurs if nil +--- - exit_timeout (number|boolean, default false): Milliseconds to wait for server to +--- exit cleanly after sending the "shutdown" request before sending kill -15. +--- If set to false, nvim exits immediately after sending the "shutdown" request to the server. +--- +--- - root_dir: (string) Directory where the LSP +--- server will base its workspaceFolders, rootUri, and rootPath +--- on initialization. --- ---@returns Client id. |vim.lsp.get_client_by_id()| Note: client may not be --- fully initialized. Use `on_init` to do any actions once diff --git a/runtime/tutor/tutor.tutor.json b/runtime/tutor/tutor.tutor.json index bf3eae8586..e8628e2f0e 100644 --- a/runtime/tutor/tutor.tutor.json +++ b/runtime/tutor/tutor.tutor.json @@ -2,8 +2,8 @@ "expect": { "63": "This is text with **important information**", "64": "This is text with **important information**", - "71": "Document '&variable'", - "72": "Document '&variable'", + "71": "TODO: Document '&variable'", + "72": "TODO: Document '&variable'", "78": "# This is a level 1 header", "79": "# This is a level 1 header", "80": "### This is a level 3 header", diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 0929aeeb2a..2361210e59 100755 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -684,8 +684,6 @@ foreach(hfile ${NVIM_GENERATED_FOR_HEADERS}) endif() endforeach() -# Our dependencies come first. - if (CMAKE_SYSTEM_NAME MATCHES "OpenBSD") target_link_libraries(main_lib INTERFACE pthread c++abi) endif() diff --git a/src/nvim/api/keysets.lua b/src/nvim/api/keysets.lua index bd709b7b25..30dcef6127 100644 --- a/src/nvim/api/keysets.lua +++ b/src/nvim/api/keysets.lua @@ -114,6 +114,7 @@ return { "underdashed"; "italic"; "reverse"; + "altfont"; "nocombine"; "default"; "cterm"; @@ -140,6 +141,7 @@ return { "underdashed"; "italic"; "reverse"; + "altfont"; "nocombine"; }}; -- Autocmds diff --git a/src/nvim/highlight.c b/src/nvim/highlight.c index c3a259c87d..9dab91cc2b 100644 --- a/src/nvim/highlight.c +++ b/src/nvim/highlight.c @@ -649,7 +649,7 @@ int hl_blend_attrs(int back_attr, int front_attr, bool *through) cattrs = battrs; cattrs.rgb_fg_color = rgb_blend(ratio, battrs.rgb_fg_color, fattrs.rgb_bg_color); - if (cattrs.rgb_ae_attr & (HL_ANY_UNDERLINE)) { + if (cattrs.rgb_ae_attr & (HL_UNDERLINE_MASK)) { cattrs.rgb_sp_color = rgb_blend(ratio, battrs.rgb_sp_color, fattrs.rgb_bg_color); } else { @@ -667,7 +667,7 @@ int hl_blend_attrs(int back_attr, int front_attr, bool *through) } cattrs.rgb_fg_color = rgb_blend(ratio/2, battrs.rgb_fg_color, fattrs.rgb_fg_color); - if (cattrs.rgb_ae_attr & (HL_ANY_UNDERLINE)) { + if (cattrs.rgb_ae_attr & (HL_UNDERLINE_MASK)) { cattrs.rgb_sp_color = rgb_blend(ratio/2, battrs.rgb_bg_color, fattrs.rgb_sp_color); } else { @@ -825,46 +825,52 @@ void hlattrs2dict(Dictionary *dict, HlAttrs ae, bool use_rgb) Dictionary hl = *dict; int mask = use_rgb ? ae.rgb_ae_attr : ae.cterm_ae_attr; + if (mask & HL_INVERSE) { + PUT_C(hl, "reverse", BOOLEAN_OBJ(true)); + } + if (mask & HL_BOLD) { PUT_C(hl, "bold", BOOLEAN_OBJ(true)); } - if (mask & HL_STANDOUT) { - PUT_C(hl, "standout", BOOLEAN_OBJ(true)); + if (mask & HL_ITALIC) { + PUT_C(hl, "italic", BOOLEAN_OBJ(true)); } - if (mask & HL_UNDERLINE) { + switch (mask & HL_UNDERLINE_MASK) { + case HL_UNDERLINE: PUT_C(hl, "underline", BOOLEAN_OBJ(true)); - } - - if (mask & HL_UNDERCURL) { - PUT_C(hl, "undercurl", BOOLEAN_OBJ(true)); - } + break; - if (mask & HL_UNDERDOUBLE) { + case HL_UNDERDOUBLE: PUT_C(hl, "underdouble", BOOLEAN_OBJ(true)); - } + break; + + case HL_UNDERCURL: + PUT_C(hl, "undercurl", BOOLEAN_OBJ(true)); + break; - if (mask & HL_UNDERDOTTED) { + case HL_UNDERDOTTED: PUT_C(hl, "underdotted", BOOLEAN_OBJ(true)); - } + break; - if (mask & HL_UNDERDASHED) { + case HL_UNDERDASHED: PUT_C(hl, "underdashed", BOOLEAN_OBJ(true)); + break; } - if (mask & HL_ITALIC) { - PUT_C(hl, "italic", BOOLEAN_OBJ(true)); - } - - if (mask & HL_INVERSE) { - PUT_C(hl, "reverse", BOOLEAN_OBJ(true)); + if (mask & HL_STANDOUT) { + PUT_C(hl, "standout", BOOLEAN_OBJ(true)); } if (mask & HL_STRIKETHROUGH) { PUT_C(hl, "strikethrough", BOOLEAN_OBJ(true)); } + if (mask & HL_ALTFONT) { + PUT_C(hl, "altfont", BOOLEAN_OBJ(true)); + } + if (mask & HL_NOCOMBINE) { PUT_C(hl, "nocombine", BOOLEAN_OBJ(true)); } @@ -920,16 +926,17 @@ HlAttrs dict2hlattrs(Dict(highlight) *dict, bool use_rgb, int *link_id, Error *e m = m | flag; \ } + CHECK_FLAG(dict, mask, reverse, , HL_INVERSE); CHECK_FLAG(dict, mask, bold, , HL_BOLD); - CHECK_FLAG(dict, mask, standout, , HL_STANDOUT); + CHECK_FLAG(dict, mask, italic, , HL_ITALIC); CHECK_FLAG(dict, mask, underline, , HL_UNDERLINE); - CHECK_FLAG(dict, mask, undercurl, , HL_UNDERCURL); CHECK_FLAG(dict, mask, underdouble, , HL_UNDERDOUBLE); + CHECK_FLAG(dict, mask, undercurl, , HL_UNDERCURL); CHECK_FLAG(dict, mask, underdotted, , HL_UNDERDOTTED); CHECK_FLAG(dict, mask, underdashed, , HL_UNDERDASHED); - CHECK_FLAG(dict, mask, italic, , HL_ITALIC); - CHECK_FLAG(dict, mask, reverse, , HL_INVERSE); + CHECK_FLAG(dict, mask, standout, , HL_STANDOUT); CHECK_FLAG(dict, mask, strikethrough, , HL_STRIKETHROUGH); + CHECK_FLAG(dict, mask, altfont, , HL_ALTFONT); if (use_rgb) { CHECK_FLAG(dict, mask, fg_indexed, , HL_FG_INDEXED); CHECK_FLAG(dict, mask, bg_indexed, , HL_BG_INDEXED); @@ -1005,13 +1012,14 @@ HlAttrs dict2hlattrs(Dict(highlight) *dict, bool use_rgb, int *link_id, Error *e } cterm_mask_provided = true; + CHECK_FLAG(cterm, cterm_mask, reverse, , HL_INVERSE); CHECK_FLAG(cterm, cterm_mask, bold, , HL_BOLD); - CHECK_FLAG(cterm, cterm_mask, standout, , HL_STANDOUT); + CHECK_FLAG(cterm, cterm_mask, italic, , HL_ITALIC); CHECK_FLAG(cterm, cterm_mask, underline, , HL_UNDERLINE); CHECK_FLAG(cterm, cterm_mask, undercurl, , HL_UNDERCURL); - CHECK_FLAG(cterm, cterm_mask, italic, , HL_ITALIC); - CHECK_FLAG(cterm, cterm_mask, reverse, , HL_INVERSE); + CHECK_FLAG(cterm, cterm_mask, standout, , HL_STANDOUT); CHECK_FLAG(cterm, cterm_mask, strikethrough, , HL_STRIKETHROUGH); + CHECK_FLAG(cterm, cterm_mask, altfont, , HL_ALTFONT); CHECK_FLAG(cterm, cterm_mask, nocombine, , HL_NOCOMBINE); } else if (dict->cterm.type == kObjectTypeArray && dict->cterm.data.array.size == 0) { // empty list from Lua API should clear all cterm attributes diff --git a/src/nvim/highlight_defs.h b/src/nvim/highlight_defs.h index 2557a248c3..a4dcf6eb60 100644 --- a/src/nvim/highlight_defs.h +++ b/src/nvim/highlight_defs.h @@ -15,19 +15,23 @@ typedef enum { HL_INVERSE = 0x01, HL_BOLD = 0x02, HL_ITALIC = 0x04, + // The next three bits are all underline styles + HL_UNDERLINE_MASK = 0x38, HL_UNDERLINE = 0x08, - HL_UNDERCURL = 0x10, - HL_UNDERDOUBLE = 0x20, - HL_UNDERDOTTED = 0x40, - HL_UNDERDASHED = 0x80, - HL_STANDOUT = 0x0100, - HL_NOCOMBINE = 0x0200, - HL_STRIKETHROUGH = 0x0400, + HL_UNDERDOUBLE = 0x10, + HL_UNDERCURL = 0x18, + HL_UNDERDOTTED = 0x20, + HL_UNDERDASHED = 0x28, + // 0x30 and 0x38 spare for underline styles + HL_STANDOUT = 0x0040, + HL_STRIKETHROUGH = 0x0080, + HL_ALTFONT = 0x0100, + // 0x0200 spare + HL_NOCOMBINE = 0x0400, HL_BG_INDEXED = 0x0800, HL_FG_INDEXED = 0x1000, HL_DEFAULT = 0x2000, HL_GLOBAL = 0x4000, - HL_ANY_UNDERLINE = HL_UNDERLINE | HL_UNDERDOUBLE | HL_UNDERCURL | HL_UNDERDOTTED | HL_UNDERDASHED, } HlAttrFlags; /// Stores a complete highlighting entry, including colors and attributes diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 373ce32e05..5b1ea9967d 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -67,11 +67,13 @@ Map(cstr_t, int) highlight_unames = MAP_INIT; static char *(hl_name_table[]) = { "bold", "standout", "underline", "undercurl", "underdouble", "underdotted", "underdashed", - "italic", "reverse", "inverse", "strikethrough", "nocombine", "NONE" }; + "italic", "reverse", "inverse", "strikethrough", "altfont", + "nocombine", "NONE" }; static int hl_attr_table[] = { HL_BOLD, HL_STANDOUT, HL_UNDERLINE, HL_UNDERCURL, HL_UNDERDOUBLE, HL_UNDERDOTTED, HL_UNDERDASHED, - HL_ITALIC, HL_INVERSE, HL_INVERSE, HL_STRIKETHROUGH, HL_NOCOMBINE, 0 }; + HL_ITALIC, HL_INVERSE, HL_INVERSE, HL_STRIKETHROUGH, HL_ALTFONT, + HL_NOCOMBINE, 0 }; /// Structure that stores information about a highlight group. /// The ID of a highlight group is also called group ID. It is the index in @@ -1595,7 +1597,12 @@ const char *highlight_has_attr(const int id, const int flag, const int modec) attr = hl_table[id - 1].sg_cterm; } - return (attr & flag) ? "1" : NULL; + if (flag & HL_UNDERLINE_MASK) { + int ul = attr & HL_UNDERLINE_MASK; + return ul == flag ? "1" : NULL; + } else { + return (attr & flag) ? "1" : NULL; + } } /// Return color name of the given highlight group diff --git a/src/nvim/po/tr.po b/src/nvim/po/tr.po index 7d6af4d2cf..eb7879efc4 100644 --- a/src/nvim/po/tr.po +++ b/src/nvim/po/tr.po @@ -5625,9 +5625,6 @@ msgstr "$VIMRUNTIME öntanımlı konumu: \"" msgid "Nvim is open source and freely distributable" msgstr "Nvim açık kaynaklıdır ve özgürce dağıtılabilir" -msgid "https://neovim.io/#chat" -msgstr "https://neovim.io/#chat" - msgid "type :help nvim<Enter> if you are new! " msgstr "eğer yeniyseniz :help nvim<Enter> " diff --git a/src/nvim/po/uk.po b/src/nvim/po/uk.po index b521e37177..06f845f113 100644 --- a/src/nvim/po/uk.po +++ b/src/nvim/po/uk.po @@ -5550,9 +5550,6 @@ msgstr " заміна для $VIMRUNTIME: \"" msgid "Nvim is open source and freely distributable" msgstr "Nvim — це відкрита й вільно розповсюджувана програма" -msgid "https://neovim.io/#chat" -msgstr "https://neovim.io/#chat" - msgid "type :help nvim<Enter> if you are new! " msgstr ":help nvim<Enter> якщо ви вперше! " diff --git a/src/nvim/po/zh_CN.UTF-8.po b/src/nvim/po/zh_CN.UTF-8.po index 0606adcc37..af050823d3 100644 --- a/src/nvim/po/zh_CN.UTF-8.po +++ b/src/nvim/po/zh_CN.UTF-8.po @@ -19,7 +19,7 @@ msgstr "" "Project-Id-Version: Vim(Simplified Chinese)\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-11-17 08:00+0800\n" -"PO-Revision-Date: 2022-11-17 22:29+0800\n" +"PO-Revision-Date: 2023-01-24 13:00+0800\n" "Last-Translator: Sizhe Zhao <prc.zhao@outlook.com>\n" "Language-Team: Simplified Chinese <i18n-translation@lists.linux.net.cn>\n" "Language: zh_CN\n" @@ -7248,17 +7248,13 @@ msgstr " $VIMRUNTIME 预设值: \"" msgid "Nvim is open source and freely distributable" msgstr "Nvim 是可自由分发的开放源代码软件" -#: ../version.c:2806 -msgid "https://neovim.io/#chat" -msgstr "" - #: ../version.c:2808 msgid "type :help nvim<Enter> if you are new! " -msgstr "" +msgstr "输入 :help nvim<Enter> 了解 Neovim! " #: ../version.c:2809 msgid "type :checkhealth<Enter> to optimize Nvim" -msgstr "" +msgstr "输入 :checkhealth<Enter> 优化 Neovim " #: ../version.c:2810 msgid "type :q<Enter> to exit " @@ -7266,11 +7262,12 @@ msgstr "输入 :q<Enter> 退出 " #: ../version.c:2811 msgid "type :help<Enter> for help " -msgstr "" +msgstr "输入 :help<Enter> 查看帮助 " #: ../version.c:2813 -msgid "type :help news<Enter> to see changes in" -msgstr "" +#, c-format +msgid "type :help news<Enter> to see changes in v%s.%s" +msgstr "输入 :help news<Enter> 查看 v%s.%s 的变化" #: ../version.c:2816 msgid "Help poor children in Uganda!" diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index 44b99f6c84..a50e44f7a3 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -137,6 +137,7 @@ struct TUIData { int enable_bracketed_paste, disable_bracketed_paste; int enable_lr_margin, disable_lr_margin; int enter_strikethrough_mode; + int enter_altfont_mode; int set_rgb_foreground, set_rgb_background; int set_cursor_color; int reset_cursor_color; @@ -251,6 +252,7 @@ static void terminfo_start(TUIData *tui) tui->unibi_ext.enable_bracketed_paste = -1; tui->unibi_ext.disable_bracketed_paste = -1; tui->unibi_ext.enter_strikethrough_mode = -1; + tui->unibi_ext.enter_altfont_mode = -1; tui->unibi_ext.enable_lr_margin = -1; tui->unibi_ext.disable_lr_margin = -1; tui->unibi_ext.enable_focus_reporting = -1; @@ -457,6 +459,7 @@ static void tui_terminal_stop(TUIData *tui) void tui_stop(TUIData *tui) { tui_terminal_stop(tui); + stream_set_blocking(tui->input.in_fd, true); // normalize stream (#2598) tinput_destroy(&tui->input); tui->stopped = true; signal_watcher_close(&tui->winch_handle, NULL); @@ -511,7 +514,7 @@ static bool attrs_differ(TUIData *tui, int id1, int id2, bool rgb) return a1.cterm_fg_color != a2.cterm_fg_color || a1.cterm_bg_color != a2.cterm_bg_color || a1.cterm_ae_attr != a2.cterm_ae_attr - || (a1.cterm_ae_attr & HL_ANY_UNDERLINE + || (a1.cterm_ae_attr & HL_UNDERLINE_MASK && a1.rgb_sp_color != a2.rgb_sp_color); } } @@ -531,6 +534,7 @@ static void update_attrs(TUIData *tui, int attr_id) bool reverse = attr & HL_INVERSE; bool standout = attr & HL_STANDOUT; bool strikethrough = attr & HL_STRIKETHROUGH; + bool altfont = attr & HL_ALTFONT; bool underline; bool undercurl; @@ -538,13 +542,14 @@ static void update_attrs(TUIData *tui, int attr_id) bool underdotted; bool underdashed; if (tui->unibi_ext.set_underline_style != -1) { - underline = attr & HL_UNDERLINE; - undercurl = attr & HL_UNDERCURL; - underdouble = attr & HL_UNDERDOUBLE; - underdashed = attr & HL_UNDERDASHED; - underdotted = attr & HL_UNDERDOTTED; + int ul = attr & HL_UNDERLINE_MASK; + underline = ul == HL_UNDERLINE; + undercurl = ul == HL_UNDERCURL; + underdouble = ul == HL_UNDERDOUBLE; + underdashed = ul == HL_UNDERDASHED; + underdotted = ul == HL_UNDERDOTTED; } else { - underline = attr & HL_ANY_UNDERLINE; + underline = attr & HL_UNDERLINE_MASK; undercurl = false; underdouble = false; underdotted = false; @@ -589,6 +594,9 @@ static void update_attrs(TUIData *tui, int attr_id) if (italic) { unibi_out(tui, unibi_enter_italics_mode); } + if (altfont && tui->unibi_ext.enter_altfont_mode != -1) { + unibi_out_ext(tui, tui->unibi_ext.enter_altfont_mode); + } if (strikethrough && tui->unibi_ext.enter_strikethrough_mode != -1) { unibi_out_ext(tui, tui->unibi_ext.enter_strikethrough_mode); } @@ -2037,6 +2045,11 @@ static void augment_terminfo(TUIData *tui, const char *term, long vte_version, l // to the ECMA-48 strikeout/crossed-out attributes. tui->unibi_ext.enter_strikethrough_mode = unibi_find_ext_str(ut, "smxx"); + // It should be pretty safe to always enable this, as terminals will ignore + // unrecognised SGR numbers. + tui->unibi_ext.enter_altfont_mode = (int)unibi_add_ext_str(ut, "ext.enter_altfont_mode", + "\x1b[11m"); + // Dickey ncurses terminfo does not include the setrgbf and setrgbb // capabilities, proposed by Rüdiger Sonderfeld on 2013-10-15. Adding // them here when terminfo lacks them is an augmentation, not a fixup. diff --git a/src/nvim/version.c b/src/nvim/version.c index 44f795cdf1..417e5116a5 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -29,6 +29,7 @@ #include "nvim/highlight_defs.h" #include "nvim/lua/executor.h" #include "nvim/mbyte.h" +#include "nvim/memory.h" #include "nvim/message.h" #include "nvim/option_defs.h" #include "nvim/os/os_defs.h" @@ -2789,19 +2790,20 @@ void intro_message(int colon) long blanklines; int sponsor; char *p; + char *mesg; + int mesg_size; static char *(lines[]) = { N_(NVIM_VERSION_LONG), "", N_("Nvim is open source and freely distributable"), - N_("https://neovim.io/#chat"), + "https://neovim.io/#chat", "", N_("type :help nvim<Enter> if you are new! "), N_("type :checkhealth<Enter> to optimize Nvim"), N_("type :q<Enter> to exit "), N_("type :help<Enter> for help "), "", - N_("type :help news<Enter> to see changes in") - " v" STR(NVIM_VERSION_MAJOR) "." STR(NVIM_VERSION_MINOR), + N_("type :help news<Enter> to see changes in v%s.%s"), "", N_("Help poor children in Uganda!"), N_("type :help iccf<Enter> for information "), @@ -2833,25 +2835,48 @@ void intro_message(int colon) if (((row >= 2) && (Columns >= 50)) || colon) { for (i = 0; i < (int)ARRAY_SIZE(lines); i++) { p = lines[i]; + mesg = NULL; + mesg_size = 0; + + if (strstr(p, "news") != NULL) { + p = _(p); + mesg_size = snprintf(NULL, 0, p, + STR(NVIM_VERSION_MAJOR), STR(NVIM_VERSION_MINOR)); + assert(mesg_size > 0); + mesg = xmallocz((size_t)mesg_size); + snprintf(mesg, (size_t)mesg_size + 1, p, + STR(NVIM_VERSION_MAJOR), STR(NVIM_VERSION_MINOR)); + } if (sponsor != 0) { if (strstr(p, "children") != NULL) { - p = sponsor < 0 - ? N_("Sponsor Vim development!") - : N_("Become a registered Vim user!"); - } else if (strstr(p, "iccf") != NULL) { - p = sponsor < 0 - ? N_("type :help sponsor<Enter> for information ") - : N_("type :help register<Enter> for information "); - } else if (strstr(p, "Orphans") != NULL) { - p = N_("menu Help->Sponsor/Register for information "); + mesg = sponsor < 0 + ? _("Sponsor Vim development!") + : _("Become a registered Vim user!"); + } + if (strstr(p, "iccf") != NULL) { + mesg = sponsor < 0 + ? _("type :help sponsor<Enter> for information ") + : _("type :help register<Enter> for information "); + } + } + + if (mesg == NULL) { + if (*p != NUL) { + mesg = _(p); + } else { + mesg = ""; } } - if (*p != NUL) { - do_intro_line(row, _(p), 0); + if (*mesg != NUL) { + do_intro_line(row, mesg, 0); } row++; + + if (mesg_size > 0) { + XFREE_CLEAR(mesg); + } } } diff --git a/test/functional/api/highlight_spec.lua b/test/functional/api/highlight_spec.lua index 541ac0ab63..5941d4c68b 100644 --- a/test/functional/api/highlight_spec.lua +++ b/test/functional/api/highlight_spec.lua @@ -32,13 +32,16 @@ describe('API: highlight',function() italic = true, reverse = true, underline = true, - undercurl = true, - underdouble = true, - underdotted = true, - underdashed = true, strikethrough = true, + altfont = true, nocombine = true, } + local expected_undercurl = { + background = Screen.colors.Yellow, + foreground = Screen.colors.Red, + special = Screen.colors.Blue, + undercurl = true, + } before_each(function() clear() @@ -59,9 +62,13 @@ describe('API: highlight',function() eq('Invalid highlight id: 30000', string.match(emsg, 'Invalid.*')) -- Test all highlight properties. - command('hi NewHighlight gui=underline,bold,undercurl,underdouble,underdotted,underdashed,italic,reverse,strikethrough,nocombine') + command('hi NewHighlight gui=underline,bold,italic,reverse,strikethrough,altfont,nocombine') eq(expected_rgb2, nvim("get_hl_by_id", hl_id, true)) + -- Test undercurl + command('hi NewHighlight gui=undercurl') + eq(expected_undercurl, nvim("get_hl_by_id", hl_id, true)) + -- Test nil argument. err, emsg = pcall(meths.get_hl_by_id, { nil }, false) eq(false, err) @@ -207,17 +214,14 @@ describe("API: set highlight", function() bold = true, italic = true, reverse = true, - undercurl = true, underline = true, - underdashed = true, - underdotted = true, - underdouble = true, strikethrough = true, + altfont = true, cterm = { italic = true, reverse = true, - undercurl = true, strikethrough = true, + altfont = true, nocombine = true, } } @@ -227,20 +231,17 @@ describe("API: set highlight", function() bold = true, italic = true, reverse = true, - undercurl = true, underline = true, - underdashed = true, - underdotted = true, - underdouble = true, strikethrough = true, + altfont = true, } local highlight3_result_cterm = { background = highlight_color.ctermbg, foreground = highlight_color.ctermfg, italic = true, reverse = true, - undercurl = true, strikethrough = true, + altfont = true, nocombine = true, } @@ -296,7 +297,7 @@ describe("API: set highlight", function() exec_capture('highlight Test_hl')) meths.set_hl(0, 'Test_hl2', highlight3_config) - eq('Test_hl2 xxx cterm=undercurl,italic,reverse,strikethrough,nocombine ctermfg=8 ctermbg=15 gui=bold,underline,undercurl,underdouble,underdotted,underdashed,italic,reverse,strikethrough guifg=#ff0000 guibg=#0032aa', + eq('Test_hl2 xxx cterm=italic,reverse,strikethrough,altfont,nocombine ctermfg=8 ctermbg=15 gui=bold,underline,italic,reverse,strikethrough,altfont guifg=#ff0000 guibg=#0032aa', exec_capture('highlight Test_hl2')) -- Colors are stored with the name they are defined, but |