This avoids errors when using "make lint", but "flake8" is not
available. We do not want to install it then via third-party.
On CI "make pylint" is used explicitly.
* build: require unibilium>=2.0
This also ports FindUnibilium to LibFindMacros, which was planned
anyway, and makes the version check easier.
With an older Unibilium our fallback code in `terminfo_from_builtin`
will not work (because it assumes the new data structures from 2.0.0 [1]),
and nvim would crash later because of `ut` being NUL.
1: 42f3cdd284
Might not be necessary anymore, at least it is fine on gcc 9.1, and
since the bug is still open/unresolved, something else might have fixed
it.
Ref: 4b81f627c
Ref: #7083
`check_c_compiler_flag(-Wno-doesnotexist …)` is successful always,
apparently for all "no-" prefixes.
Therefore check for the flag itself (without "no-" prefix).
I am seeing a warning if the source fails to compile:
> cc1: warning: unrecognized command line option ‘-Wno-meh’
Which is turned into an error with `-Werror`:
> cc1: error: unrecognized command line option ‘-Wno-meh’ [-Werror]
But when it compiles successfully, there is no warning/error.
gcc (GCC) 9.1.0.
* build: FindLibIntl: fix warning about CMP0075
The common pattern elsewhere to set this only during the check, and here
it was not unset, resulting in a warning later (on Alpine 3.10):
-- Found Iconv
-- Looking for pthread.h
CMake Warning (dev) at /usr/share/cmake/Modules/CheckIncludeFile.cmake:80 (message):
Policy CMP0075 is not set: Include file check macros honor
CMAKE_REQUIRED_LIBRARIES. Run "cmake --help-policy CMP0075" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
CMAKE_REQUIRED_LIBRARIES is set to:
/usr/lib/libintl.so
For compatibility with CMake 3.11 and below this check is ignoring it.
Call Stack (most recent call first):
/usr/share/cmake/Modules/FindThreads.cmake:105 (CHECK_INCLUDE_FILE)
CMakeLists.txt:482 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Looking for pthread.h - found
* build: remove lists / REMOVE_ITEM around check_c_source_compiles
- Move .luacheckrc to root, add read_globals=vim
- Simplify lualint target, run it on all lua files
- Lint preload.lua, but ignore W211
- Remove testlint target, included in lualint (and lint)
- Clean up .luacheckrc
Required after d33aaa0f5.
Does not really make a difference, since the VERSION is not handled with
our FindLibLUV (due to missing pkg-config information
(https://github.com/luvit/luv/issues/354)).
Keeps using add_definitions for compatibility with older CMake.
Newer CMake (3.12) would have `add_compile_definitions`, but it is not
required, since `add_defitions` was meant to be used for
compile/preprocessor definitions initially anyway.
Ref: https://github.com/neovim/neovim/pull/4389
Just set it from `${CMAKE_HOST_SYSTEM_NAME}` directly, instead of passing it
from the main CMake file (CMAKE_SYSTEM_NAME defaults to it, but is empty
in script mode).
Initially added in 9ce81f7b2, but then even used with unrelated commands
(that do not use RunTests.cmake, e.g. 221f6fffa).
- Minimum required libuv is now v1.12
- Because `uv_os_getenv` requires allocating, we must manage a map
(`envmap` in `env.c`) to maintain the old behavior of `os_getenv` .
- free() map-items after removal. khash.h does not make copies of
anything, so even its keys must be memory-managed by the caller.
closes#8398closes#9267
There was never any investigation done to determine whether using
jemalloc was actually a net benefit for nvim. It has been a portability
limitation and adds another factor to consider when triaging issues.
Note about shada.c:
- shada_read_next_item_start was intentionally shadowing `unpacked` and
`i` because many of the macros (e.g. ADDITIONAL_KEY) implicitly
depended on those variable names.
- Macros were changed to parameterize `unpacked` (but not `i`). Macros
like CLEAR_GA_AND_ERROR_OUT do control-flow (goto), so any other
approach is messy.
Besides the "visible" improvements, this release features numerous
internal improvements to the UI/screen code and test infrastructure.
Numerous patches were merged from Vim, which are not mentioned below.
FEATURES:
07ad5d71ab clipboard: Support custom VimL functions #9304725da1feeb#9401 win/TUI: Improve terminal/console support
7a8dadbedb#9077 startup: Use $XDG_CONFIG_DIRS/nvim/sysinit.vim if it exists
feec926633#9299 support <cmd> mapping in more places
0653ed63a5#9028 diff/highlight: Show underline for low-priority CursorLine
bddcbbb571 signs: Add "numhl" argument #911305f9c7c2f7 clipboard: support Wayland (#9230)
14ae394532#9052 TUI: add support for undercurl and underline color
4fa3492a6f#9023 man.vim: soft (dynamic) wrap #9023
API:
8b39e4ec79#6920 API: implement object namespaces
b1aaa0a881 API: Implement nvim_win_set_buf() #91008de87c7b1c#8180 API: virtual text annotations (nvim_buf_set_virtual_text)
2b9fc9a13f#8660 API: add nvim_buf_is_loaded()
API: buf_get_lines, buf_line_count handle unloaded buffers
88f77c28e5 API: nvim_buf_get_offset_for_line
94841e5eae API/UI: #8221 ext_newgrid, ext_hlstate
(use line-based rather than char-based updates)
UI
b5cfac0894#8806 TUI: use BCE again more often, (smoother resizes/scrolling)
77b5e9ae25#9315 screen: add missing status redraw when redraw_later(CLEAR) was used
5f15788dc3 TUI: clip invalid regions on resize (#8779), fixes#8774c936ae0f36#9193 TUI: improvements for scrolling and clearing
f20427451e#9143 UI: disable clearing almost everywhere
f4b2b66661#9079 TUI: always use safe cursor movement after resize
d36afafc8d#9211 ui_options: also send when starting or from OptionSet
67f80d485c TUI: Avoid reset_cursor_color in old VTE #9191e55ebae373#9021 don't erase screen on `:hi Normal` during startup
c5790d9189#8915 TUI: Hint wrapped lines to terminals.
FIXES:
231de72539 RPC: turn errors from async calls into notifications
907ad921bc TUI: Restore terminal title via "title stacking" (#9407)
cb76a8a95f genappimage: Unset $ARGV0 at invocation #9376b48efd9ba7#9347 TUI: FreeBSD: Improve support for BSD vt console
c16529afa5 TUI: Konsole 18.07.70 supports DECSCUSR (#9364)
aec096fc5b os/lang: use the correct LC_NUMERIC also for OS X
5fee0be915 provider: improve error message (#9344)
3c42d7a10a TUI: alacritty supports set_cursor_color #93537bff9a5de8 TUI: Alacritty supports DECSCUSR (#9048)
57acfceabe macOS: infer primary language if $LANG is empty #9345bc132ae123 runtime/syntax: Fix highlighting of augroup contents (#9328)
715fdfee1e#9297 VimL/confirm(): Show dialog even if :silent
799d9c3215 clipboard: Prefer xclip (#9302)
6dae7776ed provider/nodejs: fix npm,yarn detection
16bc1e9c17#9218 channel: avoid buffering output when only terminal and no callbacks are active
72fecad1ff#8804 Fix crash in lang_init() on macOS if lang_region = NULL
d581398779 ruby: detect rbenv shims for other versions (#8733)
e568ac7a68#9123 third-party/unibilium: Fix parsing of extended capability entries
c4c74c3883 jobstart(): Fix hang on non-executable cwd #92041cf50cbfd9 provider/nodejs: Simultaneously query npm and yarn #90546c496db4b7 undo: Fix infinite loop if undo_read_byte returns EOF #2880f8f83579ff#9034 'swapfile: always show dialog'
CHANGES:
c236e80cf3#9024 --embed: wait for UI unless --headless
180b50dddc#9248 python: 'neovim' module was renamed to 'pynvim'
2000b6a64a#8589 VimL: Remove legacy aliases "v:errmsg", "v:shell_error", "v:this_session"
deb18a050e defaults: background=dark #2894 (#9205)
c1187d4af0 defaults: win: 'shellpipe' for cmd.exe (#8827)
ref #9280
Introduce the `vim.compat` module, to help environments with system Lua
5.2+ run the build/tests. Include the module implicitly in all tests.
ref #8677
legacy `vim` module:
beep
buffer
command
dict
eval
firstline
lastline
line
list
open
type
window
As of CMake 3.12, check_include_files() also link the check executable
against the libraries listed in CMAKE_REQUIRED_LIBRARIES. Therefore we
should unset the CMAKE_REQUIRED_* variables after each respective use to
avoid them unnecessarily bleeding into other checks.
There's a mix of CXX and C related variables being set/referenced in our
CMake files. Since we only use C, use an explicit language list of "C"
instead of the implicit "C CXX" and replace all uses of CXX variables
with their C counterparts
The Debian hurd-i386 [build] failed (partly) due to -D_GNU_SOURCE not be
defined:
[215/286] /usr/bin/cc -DINCLUDE_GENERATED_DECLARATIONS -Iconfig -I../src -Isrc/nvim/auto -Iinclude -I/usr/include/luajit-2.1 -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -DDISABLE_LOG -Wdate-time -D_FORTIFY_SOURCE=2 -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -O2 -g -DMIN_LOG_LEVEL=3 -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -Wno-array-bounds -MD -MT src/nvim/CMakeFiles/nvim.dir/os/pty_process_unix.c.o -MF src/nvim/CMakeFiles/nvim.dir/os/pty_process_unix.c.o.d -o src/nvim/CMakeFiles/nvim.dir/os/pty_process_unix.c.o -c ../src/nvim/os/pty_process_unix.c
../src/nvim/os/pty_process_unix.c: In function 'pty_process_tty_name':
../src/nvim/os/pty_process_unix.c:121:10: warning: implicit declaration of function 'ptsname'; did you mean 'ttyname'? [-Wimplicit-function-declaration]
return ptsname(ptyproc->tty_fd);
Hurd is obviously not Linux, but it is using a GNU compiler and glibc so
it needs -D_GNU_SOURCE for the ptsname() definition to be visible.
[build]: https://buildd.debian.org/status/fetch.php?pkg=neovim&arch=hurd-i386&ver=0.3.0-2&stamp=1528981349&raw=0
Enabling CMake's USE_FOLDERS option and adding the FOLDER property to
targets allows some IDEs to list the targets in an organized
hierarchy of folders.
Environment variables are used to detect when the project is being built
from within Clion or Visual Studio, so that the build process can be
simplified by automatically building the bundled dependencies for them.
"Always use `find_package` with `REQUIRED`."
- We make an exception for LuaJit (not REQUIRED): the `nvim-test` target
is included only if we can find LuaJit.
This is partially a cargo-cult (reference below), but it uncovered at
least one problem: `find_package(LibIntl REQUIRED)` fails on my vanilla
ubuntu 16.04 system.
ref: https://schneide.blog/2017/11/06/4-tips-for-better-cmake/
> optional dependencies is nice, but skipping on REQUIRED is not the way
> you want to do it. In the worst case, some of your features will just
> not work if those packages are not found, with no explanation
> whatsoever. Instead, use explicit feature-toggles (e.g. using option())
> that either skip the find_package call or use it with REQUIRED, so the
> user will know that another lib is needed for this feature.
Prior to CMake 2.8.12, generator expressions could only be used in
custom commands so the path to libnvim-test in test/config/paths.lua was
set by inspecting the target's LOCATION property. Post 2.8.12, the
file(GENERATE) command exists to handle this, but it can't interpolate
normal CMake variables.
In order to bridge the gap while < 2.8.12 is supported, use
configure_file() to create paths.lua.gen with the
$<TARGET_FILE:nvim-test> generator expression and then generate the
final paths.lua file.
Closes#7077
New logging is guarded by cmake LOG_LIST_ACTIONS define. To make it more
efficient it is allocated as a linked list with chunks of length
2^(7+chunk_num); that uses basically the same idea as behind increasing kvec
length (make appending O(1) (amortized)), but reduces constant by not bothering
to move memory around what realloc() would surely do: it is not like we need
random access to log entries here to justify usage of a single continuous memory
block.
closes#7283
regression by 42d892913d
- Don't need to explicitly put "-O2 -g" in RelWithDebInfo; CMake does
that already. That was left-over from 42d892913d which removed the
"Dev" custom build-type, but repurposed the logic for RelWithDebInfo.
- `if(DEFINED MIN_LOG_LEVEL)` doesn't work.
- `if(${MIN_LOG_LEVEL} MATCHES "^$")` doesn't work if -DMIN_LOG_LEVEL is
omitted.
- `if(MIN_LOG_LEVEL)` also isn't what we want: it would be true if
MIN_LOG_LEVEL=0.
As of unibilium 1.2.1, directly manipulating unibi_var_t is deprecated.
../src/nvim/tui/tui.c: In function 'update_attrs':
../src/nvim/tui/tui.c:321:7: warning: 'i' is deprecated: use unibi_var_from_num or unibi_num_from_var instead [-Wdeprecated-declarations]
data->params[0].i = (fg >> 16) & 0xff; // red
^~~~
In file included from ../src/nvim/tui/tui.c:12:0:
/usr/include/unibilium.h:632:9: note: declared here
int i UNIBI_DEPRECATED("use unibi_var_from_num or unibi_num_from_var instead");
^
All use should go through unibi_{num,str}_from_var and
unibi_var_from_{num,str}. Wrap access of unibi_var_t behind a new
UNIBI_SET_NUM_VAR macro which uses the new functions when they're
available.
Handling of process exit is still broken. It detects the moment when the
child process exits, then quickly stops polling for process output. It
should continue polling for output until the agent has scraped all of the
process' output. This problem is easy to notice by running a command like
"dir && exit", but even typing "exit<ENTER>" can manifest the problem --
the "t" might not appear.
winpty's Cygwin adapter handles shutdown by waiting for the agent to close
the CONOUT pipe, which it does after it has scraped the child's last
output. AFAIK, neovim doesn't do anything interesting when winpty closes
the CONOUT pipe.
The main purpose of this build-type was to avoid unwanted ~/.nvimlog
files (which could get really big, and also affects performance) for
non-devs. But that is no longer necessary since the log system now
avoids non-critical logging by default (#6827).
This essentially reverts 87e5a41316
- Establish ERROR log level as "critical". Such errors are rare and will
be valuable when users encounter unusual circumstances.
- Set -DMIN_LOG_LEVEL=3 for release-type builds
Compile `nvim` executable against Lua if PREFER_LUA=ON.
As the testing library `nvim-test` requires LuaJIT, it is
still compiled against LuaJIT. If LuaJIT is not available,
`nvim-test` is not built.
For CI builds unibilium is provided through msys2 packages, and
libtermkey is built from source in third-party from equalsraf/libtermkey.
In Windows we cannot read terminal input from the stdin file descriptor,
instead use libuv's uv_tty API. It should handle key input and encoding.
The UI suspend is not implemented for Windows, because the
SIGSTP/SIGCONT do not exist in windows. Currently this is a NOOP.
Closes#3902Closes#6640
FEATURES:
bc4a2e1576 help, man.vim: "outline" (TOC) feature #516958422f17d8 'guicursor' works in the TUI (and sends info to UIs) #6423129f107c0c api: nvim_get_mode() #62470b59f988f4 api/ui: externalize tabline #6583bc6d868d00 'listchars': `Whitespace` highlight group #63676afa7d66cd writefile() obeys 'fsync' option #6427c60e409471 eval.c refactor (also improves some error messages) #51199d200cd0a3 getcompletion("cmdline") #63762ea7bfc627 terminal: Support extra arguments in 'shell'. #4504bf5110266c DirChanged autocmd #5928#62621743df82f9 'cpoptions': "_" flag to toggle `cw` behaviour #623522337b1c01 CTRL-R omits trailing ^M when pasting to cmdline #61370e44916fff :edit allows unescaped spaces in filename #6119abdbfd26bc eval: Add id() function and make printf("%p") useful #6095bdfa1479d2 findfile(), :find, gf work in :terminal. #60092f38ed11c9 providers: Disable if `g:loaded_*` exists.
b5560a69b1 setpos() can set lowercase marks in other buffers #57537c513d646d Throttle :! output, pulse "..." message. #5396d2e8c76dc2 v:exiting #5651
:terminal improvements #6185#6142
- cursor keeps position after leaving insert-mode.
- 4ceec30cd0 Follows output only if cursor is at end of buffer.
- e7bbd35c81 new option: 'scrollback'
- fedb8443d5 quasi-support for undo and 'modifiable'
- b45ddf731b disables 'list' by default
- disables 'relativenumber' by default
:help now contains full API documentation at `:help api`.
man.vim saw numerous improvements.
Windows support:
- Windows is no longer "experimental", it is fully supported.
- Windows package includes a GUI, curl.exe and other utilities.
"Vim 8" features: partials, lambdas.
SECURITY FIXES:
CVE-2017-5953 CVE-2017-6349 CVE-2017-6350 #6485
CHANGES:
NVIM_TUI_ENABLE_CURSOR_SHAPE was removed. Use 'guicursor' instead.
See https://github.com/neovim/neovim/wiki/Following-HEAD#2017040281525dc5c3 'mouse=a' is no longer the default. (This will probably
change again after it is improved.) #60220c1f783164 defaults: 'showcmd', 'belloff', 'ruler' #6087eb0e94f71b api: {get,set}_option update local options as appropriate #6405bdcb2a38b3 "Reading from stdin..." message was removed. #6298
FIXES:
12fc1defd6 ops: fix i<c-r> with multi-byte text #6524dd391bfca1 Windows: system() and friends #649713352c00f1 Windows: os_get_hostname() #641316babc6687 tui: Less-noisy mouse seqs #64113a9dd13f9e (vim bug) folding edge-cases #6207f6946c68ae job-control: set CLOEXEC on pty processes. #5986d1afd434f3 rplugin: Call s:LoadRemotePlugins() on startup.
1215084676 backtick-expansion works with `shell=fish` #6224e32ec03d67 tui: Improved behavior after resize. #620286c2adc074 edit.c: CTRL-SPC: Insert previously-inserted text. #6090c318d8e672 b:changedtick now follows VimL rules #611234e24cb2f7 terminal: Initialize colors in reverse order #6160e8899178ec undo: Don't set b_u_curhead in ex_undojoin() #5869d25649fa01 undo: :earlier, g-: Set b_u_seq_cur correctly. (#6016)
043d8ba422 'Visual-mode put from @. register' #578242c922b32c open_buffer(): Do `BufEnter` for directories.
50d0d89129 inccommand: Preview :sub commands only after delimiter #59321420e10474 CheckHealth improvements #5519c8d5e9230e jobstart(): Return -1 if cmd is not executable. #5671
Reasoning: luajit is not being compiled with sanitizers, lua is. Given that
linking with sanitized libraries requires sanitizers enabled, it is needed to
either compile libnvim-test with sanitizers or link it with lua compiled without
sanitizers. Most easy way to do the latter is just use luajit which is compiled
without sanitizers (as they do not work well with luajit).
No tests yet, no documentation update, no :lua* stuff, no vim module.
converter.c should also work with typval_T, not Object.
Known problem: luaeval("1", {}) results in
PANIC: unprotected error in call to Lua API (attempt to index a nil value)
Ref #3823
- Add support for TEST_FILE to the `oldtest` target, for consistency
with the busted/lua tests.
Caveat: with the busted/lua tests TEST_FILE takes a full path, whereas
for `oldtest` it must be "test_foo.res".
- Add support for NVIM_PRG, again so that all test-related targets are
consistent.
- Use consistent name for NVIM_PRG. But still need to support NVIM_PROG
for QuickBuild CI.
Note: The `oldtest` target is driven by the top-level Makefile, because
it requires a TTY. CMake 3.2 added a USES_TERMINAL flag to
add_custom_target(). But we support CMake 2.8...
add_custom_target(oldtest
COMMAND make clean
COMMAND make NVIM_PRG=$<TARGET_FILE:nvim> $ENV{MAKEOVERRIDES}
DEPENDS nvim
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/nvim/testdir"
USES_TERMINAL true
)