Instead of deciding provider status in eval_has_provider, move the
decision to the provider Vim scripts.
Previously, provider loading worked as follows:
1. eval_has_provider() verified provider availability by searching for
the provider#providername#Call function and cached this verificaion as a static
variable for some providers
2. providers short-circuited on loading to prevent the definition of the
Call function (with the exception of the node provider that did not)
This commit changes the expected interface between nvim and its
providers to facilitate provider reloading, by splitting the
verification of the provider from the availability of the Call function.
eval_has_provider() now checks for a provider#providername#enabled
variable. It is up to the provider script to set this to 0 or 1
accordingly. eval_call_provider() remains unchanged.
All providers hosting a Call function were updated to respect this.
The clipboard provider now has a Reload function to reload the
provider.
Windows: In order for jobstart(['foo']), system(['foo']) to find
"foo.cmd", we must replace "foo" with "foo.cmd" before sending `argv` to
process_spawn().
Rationale: jobstart([…]), system([…]) "executable" semantics should be
consistent with the VimL executable() function.
fix#9569
related: #10554
Typically most shell output is the result of non-trivial work, so it
would not blast stdout instantaneously. To more closely simulate that
typical scenario, change `shell-test REP` to wait 1 millisecond between
iterations.
Also fix V576: use width specification
> Incorrect format. Consider checking the third actual argument of the
> 'sscanf' function. It's dangerous to use string specifier without width
> specification. Buffer overflow is possible.
Note: the test fails on non-Windows CI (Travis linux, Quickbuild bsd):
even on master before the env.c changes in this patch-series.
Maybe the unix part of printenv-test.c needs to be revisited.
Signed-off-by: Justin M. Keyes <justinkz@gmail.com>
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)
start_batch_changes() doesn't avoid invoking the clipboard
once-per-line, because the loop is actually in ex_echo(), which calls
redir_write() for each message. But we've already entered
start_batch_changes() by then, so that was never the problem.
redir_write at /home/vagrant/old.neovim/build/../src/nvim/message.c:2523
msg_puts_attr_len at /home/vagrant/old.neovim/build/../src/nvim/message.c:1600
msg_outtrans_len_attr at /home/vagrant/old.neovim/build/../src/nvim/message.c:1221
ex_echo at /home/vagrant/old.neovim/build/../src/nvim/eval.c:19433
do_one_cmd at /home/vagrant/old.neovim/build/../src/nvim/ex_docmd.c:2242
Trying to defer _explicit_ clipboard updates is difficult.
:redir @+ | silent echo system('cat foo') | redir END
is essentially equivalent to:
for l in readfile('foo')
let @+ .= l
endfor
We cannot make judgements about when to ignore a script's bad decisions.
start_batch_changes() only works around the case of clipboard=unnamed,
i.e. _implicit_ clipboard updates (`:g/foo/d`). Not explicit
assignment.
During a preview, we can stop looking for matches after we got enough
lines for the preview buffer.
Because of this perf improvement, the 'redrawtime' test needs to be
slowed down in a different way: _long_ lines instead of just many lines.
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
Tokenize p_sh if used as default in ex_terminal(). Previously p_sh was
used as the first arg in a list when calling termopen(), this would try
to call an untokenized version of shell, meaning if you had an argument
in 'shell':
set shell=/bin/bash\ --login
the command would fail.
Helped-by: oni-link <knil.ino@gmail.com>
Closes#3999
API level is disconnected from NVIM version. The API metadata holds the
current API level, and the lowest backwards-compatible level supported
by this instance.
Release 0.1.6 is the first release that reports the Nvim version and API
level.
metadata['version'] = {
major: 0,
minor: 1,
patch: 6,
api_level: 1,
api_compatible: 0,
api_prerelease: false,
}
The API level may remain unchanged across Nvim releases if the API has
not changed.
When changing the API,
- set NVIM_API_PRERELEASE to true
- increment NVIM_API_LEVEL (at most once per Nvim version)
- adjust NVIM_API_LEVEL_COMPAT if backwards-compatibility was broken
api_level_0.mpack was generated from Nvim 0.1.5 with:
nvim --api-info
The API level is disconnected from the NVIM version. The API metadata
holds the current API level, and the lowest backwards-compatible level
supported by this instance.
Release 0.1.6 will be the first release reporting the Nvim version and
API level.
metadata['version'] = {
major: 0,
minor: 1,
patch: 6,
prerelease: true,
api_level: 1,
api_compatible: 0,
}
The API level may remain unchanged across Neovim releases if the API has
not changed.
When changing the API the CMake variable NVIM_API_PRERELEASE is set to
true, and NVIM_API_CURRENT/NVIM_API_COMPATIBILITY are incremented
accordingly.
The functional tests check the API table against fixtures of past
versions of Neovim. It compares all the functions in the old table with
the new one, it does ignore some metadata attributes that do not alter
the function signature or were removed since 0.1.5. Currently the only
fixture is 0.mpack, generated from Neovim 0.1.5 with nvim --api-info.
To healthcheck the "foo" plugin:
:CheckHealth foo
To healthcheck the "foo" and "bar" plugins:
:CheckHealth foo bar
To run all auto-discovered healthchecks:
:CheckHealth
Old behaviour: termopen('cmd') would run `&shell &shcf "cmd"`, which
caused the functional tests to fail on some systems due to the process
not "owning" the terminal. Also, it is inconsistent with jobstart().
Modify termopen() so that &shell is not invoked, but maintain the old
behaviour with :terminal. Factor the common code for building the
argument vector from jobstart() and modify the functional tests to call
termopen() instead of :terminal (fixes#2354).
Also:
* Add a 'name' option for termopen() so that `:terminal {cmd}` produces
a buffer named "term//{cwd}/{cmd}" and termopen() users can customize
the name.
* Update the documentation.
* Add functional tests for `:terminal` sinse its behaviour now differs
from termopen(). Add "test/functional/fixtures/shell-test.c" and move
"test/functional/job/tty-test.c" there, too.
Helped-by: Justin M. Keyes <@justinmk>