Up to now g:clipboard["copy"] only supported string values invoked as
system commands.
This commit enables the use of VimL functions instead. The function
signatures are the same as in provider/clipboard.vim. A clipboard
provider is expected to store and return a list of lines (i.e. the text)
and a register type (as seen in setreg()).
cache_enabled is ignored if "copy" is provided by a VimL function.
Problem: Expression evaluation may repeat an error message. (Jason
Franklin)
Solution: Increment did_emsg and check for the value when giving an error
for the echo command.
76a6345433
closes#9274
ref #9028
If stdin closed then read_error_exit calls preserve_exit. Handling
SIGHUP during preserve_exit would cause a premature teardown, and
conflicts with e.g. ui_bridge_stop which waits for TUI to teardown.
Vim ignores SIGHUP in its prepare_to_exit and getout_preserve_modified
routines:
/* Ignore SIGHUP, because a dropped connection causes a read error, which
* makes Vim exit and then handling SIGHUP causes various reentrance
* problems. */
signal(SIGHUP, SIG_IGN);
Namespaces is a lightweight concept that should be used to group
objects for purposes of bulk operations and introspection. This is
initially used for highlights and virtual text in buffers, and is
planned to also be used for extended marks. There is no plan use them
for privileges or isolation, neither to introduce nanespace-level
options.
By historical accident, Nvim defaults to background=light. So on a dark
background, `:colorscheme default` looks completely wrong.
The "smart" logic that Vim uses is confusing for anyone who uses Vim on
multiple platforms, so rather than mimic that, pick the (hopefully) most
common default.
- Since Neovim is dark-powered, we assume most users have dark backgrounds.
- Most of the GUIs tend to have a dark background by default.
ref #6289
- window_split_tab_spec.lua: Put cursor at bottom of :terminal buffer so
that it follows output.
- inccommand_spec.lua: Increase timeout to allow 2nd retry.
- Timer tests are less reliable on Travis CI macOS 10.12/10.13.
ref #6829
ref e39dade80b
ref de13113dc1
ref https://github.com/neovim/neovim/pull/9095#issuecomment-429603452
> We don't guarantee that a X ms timer is triggered during Y ms sleep
> for any X<Y, though I would expect the load to be really bad for this
> to happen with X=10ms, Y=40ms.
* os/fs.c: add os_isdir_executable()
* eval.c: fix hang on job start caused by non-executable cwd option
* channel.c: assert cwd is an executable directory
* test: jobstart() produces error when using non-executable cwd
Test is unreliable on macOS 10.13. The lower-bound isn't central to the
purpose of the test, so just relax it.
ref https://github.com/neovim/neovim/pull/9095#issuecomment-429603452
> We don't guarantee that a X ms timer is triggered during Y ms sleep
> for any X<Y, though I would expect the load to be really bad for this
> to happen with X=10ms, Y=40ms.
related: #6829
Avoid clearing the screen in most situations. NOT_VALID should be
equivalent to CLEAR unless some external force messed up the terminal,
for these situations <c-l> and :mode will still clear the screen.
Also eliminate some obsolete code in screen.c, that dealt with that in
vim drawing window 1 can mess up window 2, but this never happens in
nvim.
But what about slow terminals? There is two common meanings in which
a terminal is said to be "slow":
Most commonly (and in the sense of vim:s nottyfast) it means low
bandwidth for sending bytes from nvim to the terminal. If the screen is
very similar before and after the update_screen(CLEAR) this change
should reduce bandwidth. If the screen is quite different, but there is
no new regions of contiguous whitespace, clearing doesn't reduce
bandwidth significantly. If the new screen contains a lot of whitespace,
it will depend of if vsplits are used or not: as long as there is no
vsplits, ce is used to cheaply clear the rest of the line, so
full-screen clear is not needed to reduce bandwith. However a left
vsplit currently needs to be padded with whitespace all the way to the
separator. It is possible ec (clear N chars) can be used to reduce
bandwidth here if this is a problem. (All of this assumes that one
doesn't set Normal guibg=... on a non-BCE terminal, if you do you are
doomed regardless of this change).
Slow can also mean that drawing pixels on the screen is slow. E-ink
screens is a recent example. Avoiding clearing and redrawing the
unchanged part of the screen will always improve performance in these
cases.
Sometimes 008_autocommands_spec fails like this:
[ RUN ] autocommands that delete and unload buffers: BufUnload, VimLeave: -- Output to stderr:
CMake Error at /home/travis/build/neovim/neovim/cmake/RunTests.cmake:53 (message):
functional tests failed with error: 1
The final :quit + wait() is a race. Use command() instead, which is
synchronous. Use command('silent! ...') everywhere else too, because
it's clearer instead of feeding input and clearing the expected errors
with CTRL-L.
Problem: Cursorline not removed when using 'cursorbind'. (Justin Keyes)
Solution: Store the last cursor line per window. (closesvim/vim#3488)
4a5abbd613
tmpdir_get() may be an absolute path, but we invoke glob() with
a relative `initial_path`.
That can lead to this error:
[ ERROR ] test/functional/helpers.lua @ 752: after_each
test/helpers.lua:95: cannot open ./Xtest-tmpdir/nvim8jKCjR: No such file or directory
stack traceback:
test/helpers.lua:95: in function 'glob'
test/helpers.lua:273: in function 'check_cores'
test/functional/helpers.lua:757: in function <test/functional/helpers.lua:752>
NB: existing `color default` test was actually enough to trigger the bug,
when ext_newgrid=false is used. I created the `:hi Normal` test as
I thought the builtin colors wouldn't set Normal (unless 'bg' is changed)
But as the root cause actually comes from `:hi Normal`, it makes sense
to still add the separate test (if `color default` here gets optimized to
become a no-op, or something).
Give embeders a chance to set up nvim, by processing a request before
startup. This allows an external UI to show messages and prompts from
--cmd and buffer loading (e.g. swap files)
Problem: Incorrect adjusting the popup menu for the preview window.
Solution: Compute position and height properl. (Ronan Pigott) Also show at
least ten items. (closesvim/vim#3414)
msgpack_rpc_to_object (called by handle_request .. msgpack_rpc_to_array)
always NUL-terminates API Strings.
But handle_request .. msgpack_rpc_get_handler_for operates on a raw
msgpack_object, before preparation.
Problem: C indent wrong when * immediately follows comment. (John Bowler)
Solution: Do not see "/*" after "*" as a comment start. (closesvim/vim#2321)
f8c53d3d26
closes#8362
Vim's code calls `call_shell` directly from `get_system_output_as_rettv`
whereas in Nvim this function has been rewritten to not call `call_shell` but to call
`os_system` via `do_os_system`, losing the support for profiling and verbose.
Changing the code to call `call_shell` from `get_system_output_as_rettv`
seems to be too complicated to be worth it on the current version of the
code. So this commit duplicates the relevant code.
The following (run as a script) used to cause a crash due to :sign using a
special redraw (not updating nvim's specific highlight data structures)
without proper redraw first, as split just flags for redraw later.
set cursorline
sign define piet text=>> texthl=Search
split
sign place 3 line=2 name=piet buffer=1
Problem: :packadd does not load packages from the "start" directory.
(Alejandro Hernandez)
Solution: Make :packadd look in the "start" directory if those packages were
not loaded on startup.
9e1d399e63
Add ext_newgrid and ext_hlstate extensions. These use predefined
highlights and line-segment based updates, for efficiency and
simplicity.. The ext_hlstate extension in addition allows semantic
identification of builtin and syntax highlights.
Reimplement the old char-based updates in the remote UI layer, for
compatibility. For the moment, this is still the default. The bulitin
TUI uses the new line-based protocol.
cmdline uses curwin cursor position when ext_cmdline is active.
Problem: ":if 0|syntax {on,off}|endif" skips the default of "syntax on"
because the executor was setting the `did_syntax_onoff` flag even though
"syntax {on,off}" is not actually executed.
closes#8728
Show a proper confirmation dialog when trying to unload a terminal buffer while
the confirm option is set or when :confirm is used.
Fixes https://github.com/neovim/neovim/issues/4651
Now that uv.h is directly being included, pre-processing of
test/includes/pre/uv.h fails on Linux with
In file included from «SRCDIR»/neovim/test/includes/pre/uv.h:1:
In file included from /usr/include/uv.h:62:
/usr/include/uv/unix.h:72:11: fatal error: 'uv/pthread-barrier.h' file not found
# include "uv/pthread-barrier.h"
^~~~~~~~~~~~~~~~~~~~~~
1 error generated.
This happens because we're missing -D_GNU_SOURCE (part of ${gen_cdefs}),
which makes the pthread_barrier_* functionality visible.
libuv users are only supposed to directly include uv.h. In v1.21.0, all
the uv-*.h headers were renamed to uv/*.h, which caused the unit tests
to fail with
[123/125] Generating post/uv-errno.h
FAILED: test/includes/post/uv-errno.h
cd «SRCDIR»/src/neovim/build/test/includes && /usr/bin/clang -std=c99 -E -P «SRCDIR»/src/neovim/test/includes/pre/uv-errno.h -I/usr/include -I/usr/include -o «SRCDIR»/neovim/build/test/includes/post/uv-errno.h
«SRCDIR»/src/neovim/test/includes/pre/uv-errno.h:1:10: error: 'uv-errno.h' file not found with <angled> include; use "quotes" instead
#include <uv-errno.h>
^~~~~~~~~~~~
"uv-errno.h"
The intention of the file is to extend libuv's error constants with more
values used by the unit tests. This can just as easily be achieved
without poking into pseudo-private header files.
closes#8466closes#8664
Regression by 0d7daaad98.
- Fix length comparison.
- Fix loop(s) which iterated over all fields of array `pcc` even if it
was not filled up (try unicode 0x9f as statusline character).
Note about the tests:
- To input unicode with more than two hex digits you can use <C-v>U...:
a + U+fe20: a︠
a + U+fe20 + U+fe21: a︠︡
Use LuaJIT FFI to create char pointer.
Validate output with utf_ptr2char(), vim_iswordc() and vim_iswordp().
Use const for LuaJIT string-to-char conversion.
closes#7383closes#7715
This implements the compromise described in #7383:
* low-priority CursorLine if foreground is not set
* high-priority ("same as Vim" priority) CursorLine if foreground is set
ref d1874ab282
ref 56eda2aa17
DWIM: avoid empty buffer 1 when stdin was empty. If other files were
specified at startup, we assume that stdin is only accidentally
not-a-TTY: user did not intend to send text from it.
ref #8560
ref #8561
If stdin is not a TTY we read it into buffer 1, as text. But if the
stdin pipe is empty, Nvim was most likely invoked for some other reason.
DWIM: select buffer 2 (if it exists). Example:
echo file1 | xargs nvim
closes#8560closes#8561
ref https://github.com/equalsraf/neovim-qt/issues/417
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.
Before this change, -E/-Es without `-u NONE` reads stdin as Ex commands.
It should always read stdin as text (into buffer 1), like this:
echo foo | nvim -Es +'%p'
foo
echo foo | nvim -Es -u NORC +'%p'
foo
This changes Ex mode (Q, -e) to work like Vim's "improved Ex mode"
(gQ, -E). That brings some small behavior differences, but should not
impact most Ex scripts (unless, for example, they depend on mappings
being disabled--but that can be solved for -e by skipping user config).
Before this change:
* the screen test hangs.
After this change:
* Q acts like gQ.
* -e/-es differs from -E/-Es only in its treatment of stdin.
This moves towards potentially removing getexmodeline().
(HINT: That does NOT mean "removing Ex mode", it means removing the
Vi-compatible Ex mode, which differs from Vim's "improved Ex mode" only
in some minor details (e.g. mappings are disabled).)
ref #1089 :-)~
Problem: For some people the hint about quitting is not sufficient.
Solution: Put <Enter> separately. Also use ":qa!" to get out even when
there are changes.
28a8193e31
According to POSIX[0], only octal escapes are supported by the printf
command. GNU coreutils' printf and some shells' builtin printf versions
which support hex escapes, but dash and non-GNU printf do not.
[0]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/printf.html
Problem: When using an assert function one can either specify a message or
get a message about what failed, not both.
Solution: Concatenate the error with the message.
c7b831ca15
Fixes 2 failing tests in startup_spec.lua.
The Windows-only `--literal` option complicates support of "stdin-as-text
+ file-args" (#7679). Could work around it, but it's not worth
the trouble:
- users have a reasonable (and englightening) alternative: nvim +"n *"
- "always literal" is more consistent/predictable
- avoids platform-specific special-case
Unrelated changes:
- Replace fileno(stdxx) with STDXX_FILENO for consistency (not motivated
by any observed technical reason).
silent-mode (-es/-Es) has been broken for years. The workaround up to
now was to include --headless. But --headless is not equivalent because
it prints all messages, not the limited subset defined by silent-mode.
Treat stdin as text by default (so the "-" file is not needed):
echo foo | nvim
It works with file args (implemented in next commit), too:
echo foo | nvim file1.txt file2.txt
Why? Because:
- Execution of input is (1) almost always unintentional/confusing,
and (2) potentially destructive.
- Avoids the need for time-delayed warning. #7659
- The _common_ case is to open text in a buffer, not send commands.
Note:
- Not for Ex-mode (-es) because it is used by scripts. But maybe `-Es`?
- Not for --headless, because stdio may be a protocol stream and may be
used for any purpose by stdioopen().
To treat stdin as Normal-mode commands, use `-s -` instead:
echo ifoo | nvim -s -
Other alternatives:
- Replay a register. E.g. the following mostly works, except @q aborts
on any "beep" (e.g. if the cursor can't move).
nvim -c '%d q|norm @q' -
- Future: Let `:%source` work with unsaved buffer contents?
closes#2087closes#7659
mkfifo (msysgit) does not work outside of msys2 environment.
gzip tests fail on Windows.
mklink requires admin privs for file symbolic links so mklink fails.
`cat` is distributed with neovim, so when can use it everywhere, as
opposed to `sort`.
The diffget test fails for unknown reasons on appveyor, mark it pending
for now.
likely fixes#7768#7913
If multiple internal stream callbacks were recieved before vimL
callbacks got called, only invoke one vimL callback with all data.
Problem: No autocmd triggered in Insert mode with visible popup menu.
Solution: Add TextChangedP. (Prabir Shrestha, Christian Brabandt,
closesvim/vim#2372, closesvim/vim#1691)
Fix that the TextChanged autocommands are not always triggered
when sourcing a script.
5a09343719
- Return VimL errors instead of generic errors for:
- nvim_call_function
- nvim_call_dict_function
- Fix tests which were silently broken before this change.
This violates #6150 where we agreed not to translate API errors. But
that can be fixed later.
The `internal` param is difficult to explain, and will rarely be
anything but `true`. To avoid it, use a hack: check if the resolved
dict value starts with "function(".
Make `:verbose set ...` show when an option was last modified by an
API client or Lua script/chunk. In the case of an API client, the
channel ID is displayed.
Avoid a hot loop in retry(), there's no need to retry more than 50/s.
Also use luv.sleep() to implement sleep() instead of spinning the
event-loop, so events are not silently discarded.
1. Don't check elapsed time in children_kill_cb(), it's already implied
by the start-time of the timer itself.
2. Restart timer from children_kill_cb() for PTY jobs, to send SIGKILL
after SIGTERM. There is an edge case where SIGKILL might follow
SIGTERM too quickly, if jobstop() is called near the 2-second timer
window. But this edge case is not worth code complication.
I failed to deduce why analyzer thinks E882 may not be triggered, though
conditions for triggering it are strange: it would trigger E882 only in the
single case “function returned non-number”. Cases “function thrown exception”,
or “built-in sorter encountered error” will neither yield E882 nor stop
sort()/uniq().
Note though that searching test code revealed that neither E702 nor E882 are not
tested anywhere.
* Reading from stdin on Windows is fixed in the same way as it was in
#8267.
* The file_read function was returning without filling the
destination buffer when it was called with a non-blocking file
descriptor.