Commit Graph

2818 Commits

Author SHA1 Message Date
Björn Linse
2c2f160a27 ui: add 'redrawdebug' option for flexible debugging of redrawing 2019-07-09 15:13:24 +02:00
Björn Linse
4af1ada9ef compositor: handle float overlapping left half of doublewidth char 2019-07-09 14:46:58 +02:00
Justin M. Keyes
06af88cd72
viml/reltime(): allow negative result #10453
- define proftime_T as signed integer
- profile_sub(): allow negative result

closes #10452
2019-07-09 12:08:54 +02:00
Daniel Hahler
13fbeda0e5
Revert "tests: executable_spec: enable pending test #10443" (#10454)
This reverts commit b53c483a4a.
2019-07-09 11:46:23 +02:00
Björn Linse
42bdccdf6c
Merge pull request #10234 from bfredl/resizefloat
window: allow resize wincmds for floats
2019-07-08 19:50:43 +02:00
Björn Linse
d11a146516 window: allow resize wincmds for floats 2019-07-08 19:45:57 +02:00
Daniel Hahler
c07f266c5b
tests: ex_terminal_spec: add test for previous leak (#10450)
Closes https://github.com/neovim/neovim/pull/4766.
2019-07-08 18:42:52 +02:00
Björn Linse
524fe6205d
Merge pull request #10090 from bfredl/floatpopup
api/window: add style="minimal" flag to disable unwanted UI features for simple floats
2019-07-07 21:35:55 +02:00
Daniel Hahler
28a86608a8 CI: improve gcov handling #10404
- Move __gcov_flush to process_spawn, for more reliable coverage
  tracking of subprocesses
- Travis: use GCOV_ERROR_FILE
- codecov: use "-X fix" to skip "fixing" uploaded coverage data; it
  should be handled by codecov's backend instead.
- AppVeyor: no $PATH mangling, which breaks with the improved coverage tracking
  due to missing .dll in PATH.
2019-07-07 21:09:37 +02:00
Björn Linse
ef3e32d57e api/window: add style="minimal" flag to nvim_open_win() 2019-07-07 20:52:15 +02:00
Daniel Hahler
b53c483a4a tests: executable_spec: enable pending test #10443
Should hopefully work now after efc6d9951b.
2019-07-07 13:05:52 +02:00
Jan Edmund Lazo
8062e6ff88 vim-patch:8.1.1614: 'numberwidth' can only go up to 10
Problem:    'numberwidth' can only go up to 10.
Solution:   Allow up to 20. (Charlie Stanton, closes vim/vim#4584)
f8a0712655
2019-07-05 21:26:46 -04:00
Björn Linse
48efafc81c
Merge pull request #10398 from bfredl/resizeautocmd
screen: disable redrawing inside VimResized
2019-07-05 20:27:01 +02:00
Björn Linse
51a451570d screen: disable redrawing inside VimResized
Note: test doesn't fail on master. I cannot reproduce the glitches with
-u NONE, probably it requires interfering events. But add some coverage
for these checks at least.
2019-07-05 16:58:53 +02:00
Björn Linse
399eb49baf highlight: show "hi Group" message correctly when not using the screen
ext_message doesn't set msg_col. Add a space and let client deal with
wrapping. When using silent redirect show the unwrapped message form.

Removed check is already part of msg_advance()
2019-07-05 15:52:59 +02:00
Daniel Hahler
68c594b10c
tests: loop_spec: retry (#10413)
Flaky test (osx):

    [  FAILED  ] ...is/build/neovim/neovim/test/functional/lua/loop_spec.lua @ 23: vim.loop timer
    ...is/build/neovim/neovim/test/functional/lua/loop_spec.lua:56: Expected objects to be the same.
    Passed in:
    (number) 0
    Expected:
    (number) 2
    stack traceback:
            ...is/build/neovim/neovim/test/functional/lua/loop_spec.lua:56: in function <...is/build/neovim/neovim/test/functional/lua/loop_spec.lua:23>

It was bumped from sleeping for 20ms to 50ms in d33aaa0f5f already.
2019-07-04 16:42:10 +02:00
Daniel Hahler
05a17e419a
tests: fix flaky ':digraphs displays digraphs' (#10406) 2019-07-04 15:22:59 +02:00
Daniel Hahler
32361a1245 Improve luacheck setup [skip appveyor]
- 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
2019-07-04 12:29:54 +02:00
Daniel Hahler
f6298aba82
tests: shell-test: add INTERACT mode (#10405)
Use it to improve ls_spec: it should not use the user's real shell for
performance and other reasons.
2019-07-03 22:49:13 +02:00
Daniel Hahler
0dc73b87f1
tests: executable_spec: keep assertion (#10408)
It was moved to become pending in 18127f64c, but the assertion should be
kept.
2019-07-03 12:56:03 +02:00
Daniel Hahler
e48257e63e
tests: fix/improve "TUI background color" tests (#10229)
- Ensure the opposite of the expected bg is active.
- Improves performance: 1.2s instead of 4.5s.
2019-07-03 03:37:19 +02:00
Daniel Hahler
5b94a2977a
tests: fix flaky "TermClose event triggers when fast-exiting terminal job stops" (#10377)
[  ERROR   ]...neovim/neovim/test/functional/autocmd/termclose_spec.lua @ TermClose event triggers when fast-exiting terminal job stops
    test/functional/helpers.lua:96: Vim(call):E900: Invalid channel id

    stack traceback:
            test/functional/helpers.lua:96: in function 'request'
            test/functional/helpers.lua:254: in function 'command'
            ...neovim/neovim/test/functional/autocmd/termclose_spec.lua:23: in function <...neovim/neovim/test/functional/autocmd/termclose_spec.lua:20>
2019-07-02 22:44:11 +02:00
Daniel Hahler
1c45ba462b
tests: fix flaky "terminal (with fake shell) with not arguments …" (#10401)
`retry()` would only try it three times (waiting for 20ms in between),
despite the large timeout.

Fixes https://github.com/neovim/neovim/issues/10265.
2019-07-02 19:31:36 +02:00
Justin M. Keyes
097f85ae6c
defaults: wildoptions=pum,tagfile #10384
ref #6289
2019-07-01 23:59:24 +02:00
Björn Linse
5e4b93a38f
Merge pull request #10389 from bfredl/luafloat
api/lua: make nvim_execute_lua use native lua floats, not special tables
2019-07-01 20:28:00 +02:00
Björn Linse
6ee05536ca api/lua: make nvim_execute_lua use native lua floats, not special tables
Rationale: the purpose of nvim_execute_lua is to simply call lua code with lua
values. If a lua function expects a floating point value, it should be enough
to specify a float as argument to nvim_execute_lua.

However, make sure to preserve the existing roundtripping behavior of
API values when using `vim.api` functions. This is covered by existing
lua/api_spec.lua tests.
2019-07-01 18:44:58 +02:00
Björn Linse
b98d1cf68b cmdline: correct the column position of wildoptions=pum popupmenu
- position might get invalid with "longest" match
- position might be wrong when completed pattern ends in "/"
2019-07-01 18:24:00 +02:00
Björn Linse
10a533e9d4
Merge pull request #10316 from bfredl/cb_safety
luv callbacks: throw error on deferred methods instead of crashing
2019-06-30 16:03:58 +02:00
Kovas Palunas
fdd8dcae01 man.vim: Handle ANSI escape sequences with ":" #10267
closes #10267
2019-06-30 15:25:49 +02:00
Björn Linse
99f24dfbed make vim.loop == require'luv'
This avoids initializing libluv a second time if a plugin invokes
require'luv'. It is probably not an issue, but better to be safe.
2019-06-30 15:16:32 +02:00
Björn Linse
d33aaa0f5f libluv: use luv_set_callback to control callback execution
Disable the use of deferred API functions in a fast lua callback
Correctly display error messages from a fast lua callback
2019-06-30 13:13:08 +02:00
Daniel Hahler
52fced6090
build: update some test dependencies (#10339)
* build: update some test dependencies

* luacheck ignores

* BuildLua: add ${BUSTED} to depends for ${BUSTED_LUA}

This is required to rebuild it when busted gets updated.
2019-06-29 22:25:00 +02:00
Justin M. Keyes
2d4a37ebab
:ls : show "R", "F" for terminal-jobs #10370
This matches Vim behavior. From `:help :ls` :

    R    a terminal buffer with a running job
    F    a terminal buffer with a finished job
    ?    a terminal buffer without a job: `:terminal NONE`

TODO: implement `:terminal NONE`.

ref #10349
2019-06-29 21:03:38 +02:00
Daniel Hahler
e9f1bdabb8
tests: fix flaky "timers can be stopped from the handler" (#10364)
Seen on Travis (osx):

    [ RUN      ] timers can be stopped from the handler: FAIL
    .../build/neovim/neovim/test/functional/eval/timer_spec.lua:167: Expected objects to be the same.
    Passed in:
    (number) 2
    Expected:
    (number) 3
    stack traceback:
            .../build/neovim/neovim/test/functional/eval/timer_spec.lua:167: in function <.../build/neovim/neovim/test/functional/eval/timer_spec.lua:153>
2019-06-29 17:53:09 +02:00
Björn Linse
ac013d7147
Merge pull request #10342 from bfredl/apisandbox
eval/api: don't allow the API to be called in the sandbox
2019-06-26 11:59:08 +02:00
Björn Linse
8b263c7a68
Merge pull request #10344 from bfredl/extcmdredraw
cmdline: remove invalid cmdline_show event when aborting mapping
2019-06-26 10:47:18 +02:00
Björn Linse
4bf05ba399 cmdline: remove invalid cmdline_show event when aborting mapping 2019-06-26 09:16:17 +02:00
Björn Linse
2a2d288228 compositor: handle scrolling of blended window 2019-06-26 08:37:36 +02:00
Björn Linse
619a86cb1e eval/api: don't allow the API to be called in the sandbox.
Identifying and maintaining a "secure" subset of the API would be too
much busywork. So just disable the entire thing.
2019-06-26 08:19:57 +02:00
Björn Linse
4c4d964eeb ui: add 'winblend' to support blending of floating windows
Also add `hi blend=` attribute to override transparency of indiviual attributes.
2019-06-25 18:08:21 +02:00
Alan Wu
9fd4a0b526 getchar: Handle incomplete <Paste> in typeahead buffer #10311
<Paste> is a 3-byte sequence and the beginning one or two bytes can appear at
the very end of the typeahead buffer. When this happens, we were exiting from
`vgetorpeek()` instead of reading more characters to see the complete sequence.

I think this should fix #7994 -- at least partially. Before this change, when I
paste exactly 64 characters into a freshly booted instance, I get what I pasted
plus the literal text "<Paste>" at the end. Nvim also stays in nopaste mode.
The attached test case fails in this manner without the code change.

Fix #7994
2019-06-24 00:28:04 +02:00
oni-link
0bdeec8ef0 screen: Adjust buffer sizes for multiple sign columns #10314
* screen: Fix to draw signs with combining characters.
The buffer size for signs can be too small, because the upper length
limit of a sign can be 56 bytes. If combining characters are only two
bytes in size, this reduces to 32 bytes.

* screen: Adjust buffer size to maximal sign column count
2019-06-24 00:01:01 +02:00
Daniel Hahler
bc10a15ea7 tests: fix "api nvim_get_proc_children returns child process ids" (#10296)
There might be an existing job already - maybe due to some other test,
but in this case there was only one failure in the test run.

```
[----------] Running tests from C:/projects/neovim/test/functional\api\proc_spec.lua
  [ RUN      ] api nvim_get_proc_children returns child process ids: ERR
  test\functional\helpers.lua:392:
  retry() attempts: 450
  C:/projects/neovim/test/functional\api\proc_spec.lua:22: Expected objects to be the same.
  Passed in:
  (number) 2
  Expected:
  (number) 1

  stack traceback:
  	test\functional\helpers.lua:392: in function 'retry'
  	C:/projects/neovim/test/functional\api\proc_spec.lua:21: in function <C:/projects/neovim/test/functional\api\proc_spec.lua:17>
```

https://ci.appveyor.com/project/neovim/neovim/builds/25461215/job/8ns204v6091iy9rs?fullLog=true#L2672
2019-06-22 15:29:39 +02:00
Björn Linse
d4938743e6 channel: refactor events, prevent recursive invocation of events 2019-06-18 10:49:38 +02:00
Björn Linse
e39d217592 messages: fix crash with msg_advance when using ext_messages 2019-06-16 11:31:35 +02:00
Björn Linse
41f31ca90d messages: support shortmess-=S in ext_messages 2019-06-16 11:07:29 +02:00
Björn Linse
64cdf9f78a api/lua: add on_detach to nvim_buf_attach 2019-06-15 13:19:12 +02:00
Daniel Hahler
93f8c2793c
ci: AppVeyor: fix cov job, remove duplicate non-cov one (#10217)
* ci: AppVeyor: set GCOV_ERROR_FILE

This prevents the warnings/errors to be spilled into test results,
causing them to fail them, e.g.:

    [  FAILED  ] C:/projects/neovim/test/functional\core\main_spec.lua @ 97: Command-line option -s errors out when trying to use nonexistent file with -s
    C:/projects/neovim/test/functional\core\main_spec.lua:98: Expected objects to be the same.
    Passed in:
    (string) 'Cannot open for reading: "Xtest-functional-core-main-s.nonexistent": no such file or directory
    profiling:C:\projects\neovim\build/src/nvim/CMakeFiles/nvim.dir/buffer.c.gcda:Data file mismatch - some data files may have been concurrently updated without locking support
    '
    Expected:
    (string) 'Cannot open for reading: "Xtest-functional-core-main-s.nonexistent": no such file or directory
    '

    stack traceback:
            C:/projects/neovim/test/functional\core\main_spec.lua:98: in function <C:/projects/neovim/test/functional\core\main_spec.lua:97>

For reference, the locking appears to have been reworked for gcc 9.1 [1].

1: https://github.com/gcc-mirror/gcc/commit/56621355b

helpers.clear: keep GCOV_ERROR_FILE in environment

* ci: AppVeyor: remove MINGW_64 config (used with cov now)

Also:

- run MINGW_64-gcov first, and with PRs, since it provides coverage.
2019-06-14 13:39:57 +02:00
Daniel Hahler
dd21cd2a4d
tests: increase timeout with "timers doesn't mess up the cmdline" (#10212)
This might be required on (slower) CI.

    [ RUN      ] timers doesn't mess up the cmdline: ERR
    test/functional/ui/screen.lua:562: expected intermediate screen state before final screen state
    stack traceback:
            test/functional/ui/screen.lua:562: in function '_wait'
            test/functional/ui/screen.lua:366: in function 'expect'
            .../build/neovim/neovim/test/functional/eval/timer_spec.lua:221: in function <.../build/neovim/neovim/test/functional/eval/timer_spec.lua:199>

Ref: https://travis-ci.org/neovim/neovim/jobs/544974506#L3861
2019-06-13 22:11:33 +02:00
Harm te Hennepe
424ddd01f5 tui: support rgba background detection (#10205)
Fixes https://github.com/neovim/neovim/issues/10159.
2019-06-13 14:14:41 +02:00
Daniel Hahler
6f27f5ef91 main: do event_init before early_init #10183
Fixes https://github.com/neovim/neovim/issues/10172

* move log_init to event_init
* move init_signs to end of early_init
2019-06-12 14:22:42 +02:00
erw7
ce90a19abd TUI: set os/input.c:global_fd to input->in_fd #10174
Problem: When we changed startup to wait for the TUI (like a remote UI),
         we forgot to set os/input.c:global_fd.  That used to be done by
         input_start().

Solution: Initialize os/input.c:global_fd before initializing libtermkey
          (termkey_new_abstract) so that tui_get_stty_erase() and
          friends can inspect the correct fd.

fixes #10134
close #10174
2019-06-10 16:43:52 +02:00
George Zhao
c83926cd0a lua: introduce vim.loop (expose libuv event-loop) #10123
Co-authored-by: Andrey Popp <8mayday@gmail.com>

closes #9546
closes #10084
2019-06-10 14:13:18 +02:00
erw7
2fbeea8326 Change to not test msg_puts_pirntf() in unix CI 2019-06-09 19:02:52 +09:00
erw7
da8f7141ce Add msg_puts_printf() test for multibyte characters 2019-06-09 13:29:51 +09:00
erw7
53551d823e Add test for #7967 2019-06-09 13:28:10 +09:00
Justin M. Keyes
bb24fec333
defaults: exclude "S" from 'shortmess' #10136
ref #6289
2019-06-07 23:11:28 +02:00
Björn Linse
b684bd05b5 lua: docs and tests for vim.schedule 2019-06-05 10:46:22 +02:00
Björn Linse
16ee24082f
Merge pull request #10117 from bfredl/ctrl-o_event
normal: Don't exit CTRL-O mode after processing K_EVENT
2019-06-04 15:23:40 +02:00
Björn Linse
3adb8a10b1
Merge pull request #9170 from bfredl/lua_cb
lua callbacks for nvim_buf_attach
2019-06-04 14:54:44 +02:00
Björn Linse
e50aa2a6c6 normal: Don't exit CTRL-O mode after processing K_EVENT 2019-06-04 13:59:43 +02:00
Björn Linse
f5c56f03bb api: allow nvim_buf_attach from lua using callbacks 2019-06-04 13:45:20 +02:00
erw7
89c2747eed Fix issue where test fails 2019-06-04 08:49:27 +09:00
Justin M. Keyes
49733df939 Merge #9338 'vim-patch:8.1.{569,571}' 2019-06-03 22:56:43 +02:00
Björn Linse
7ac3c311ee api/buffer: create new buffers in the "opened" state
Otherwise vim will think that ml_append() needs to "enter" the buffer,
which emits unexpected autocommands.

ref https://github.com/vim-airline/vim-airline/issues/1930
2019-06-03 13:54:03 +02:00
Björn Linse
3d24bb48e7 test: don't detach screen just to change the size 2019-06-03 11:23:10 +02:00
Jit Yao Yap
c96aed2ba7 Add test 2019-06-03 11:14:07 +02:00
Jan Edmund Lazo
f0078c26c2 functionaltests: fix new execute() tests 2019-06-03 00:12:01 -04:00
Sha Liu
5a4e7af77d update functional test for "places cursor correctly #6035" 2019-06-03 00:12:01 -04:00
Sha Liu
73a2922413 UI: Fix wrong msg_col after execute()
closes #6035
closes #9250
2019-06-03 00:12:01 -04:00
Justin M. Keyes
c0134660ab test: avoid some boilerplate 2019-06-03 00:08:32 +02:00
Ville Hakulinen
40218d1180 Make sure msg_clear is sent after confirm message (#10065) 2019-06-02 23:38:19 +02:00
Jit
b65a7b7f66 [RDY] Fix wildmode=list,full and display+=msgsep interaction (#10103)
* Fix wildmode=list and display+=msgsep interaction
* Add test to check ext_messages behaviour is unchanged
2019-06-02 21:38:34 +02:00
Justin M. Keyes
2e171a6fd1 test: cleanup, reduce verbosity 2019-06-01 21:59:42 +02:00
Justin M. Keyes
fb4d5a1846
UI/ext_messages: restore kind=quickfix #10067
Accidentally removed in 34f9e72af9.
ref #6201
2019-05-27 00:01:41 +02:00
Justin M. Keyes
1ca84897a0
Merge #10059 from jerdna-regeiz/vim-8.1.0614
vim-patch:8.1.0614,8.1.0632,8.1.0644,8.1.0658,8.1.0660,8.1.0669,8.1.0673,8.1.0679,8.1.0697,8.1.0701,8.1.0702,8.1.0709,8.1.0717,8.1.0750,8.1.0767,8.1.0772,8.1.0039
2019-05-26 20:59:28 +02:00
Jit
0bbaef8a99 UI/cmdline: check if redraw is needed after K_EVENT, K_COMMAND #9804
fixes #8490
2019-05-26 19:52:30 +02:00
Andrej Zieger
35fbb4e1ca vim-patch:8.1.0701: sign message not translated and inconsistent spacing
Problem:    Sign message not translated and inconsistent spacing.
Solution:   Add _() for translation.  Add a space. (Ken Takata)  Also use
            MSG_BUF_LEN instead of BUFSIZ.
d730c8e297
2019-05-26 19:32:32 +02:00
Andrej Zieger
fb9abd7d99 vim-patch:8.1.0614: placing signs can be complicated
Problem:    Placing signs can be complicated.
Solution:   Add functions for defining and placing signs.  Introduce a group
            name to avoid different plugins using the same signs. (Yegappan
            Lakshmanan, closes vim/vim#3652)
162b71479b
2019-05-26 19:32:31 +02:00
Björn Linse
aabda31d54
Merge pull request #9547 from bfredl/rpc_multiline_err
messages: use proper multiline errors for rpcrequest and API wrappers
2019-05-26 18:11:49 +02:00
Björn Linse
8ed54bbec3 messages: use proper multiline error message for rpcrequest and API wrappers 2019-05-26 15:42:16 +02:00
Jan Edmund Lazo
08aa9b0023 vim-patch:8.1.0211: expanding a file name "~" results in $HOME
Problem:    Expanding a file name "~" results in $HOME. (Aidan Shafran)
Solution:   Change "~" to "./~" before expanding. (closes vim/vim#3072)
00136dc321
2019-05-25 20:36:01 -04:00
Justin M. Keyes
a9d7ec4587 refactor: introduce XFREE_CLEAR()
Unfortunately we cannot indiscriminately replace xfree() with
XFREE_CLEAR(), because comparing pointers after freeing them is a common
pattern. Example in `tv_list_remove_items()`:

    xfree(li);
    if (li == item2) {
      break;
    }

Instead we can do it selectively/explicitly.

ref #1375
2019-05-25 10:01:17 +02:00
Justin M. Keyes
5b04a4fa09 lua/shared: share trim() impl 2019-05-20 23:46:56 +02:00
Justin M. Keyes
7cc01c704c Merge #9709 'fileio: use os_copy to create backups'
ref #8288
2019-05-20 22:33:19 +02:00
Justin M. Keyes
e4c2d85c77 lua/shared: share deepcopy() with test/*
deepcopy() was duplicated in test/helpers.lua
2019-05-19 17:58:54 +02:00
Justin M. Keyes
9d7aaf7149 lua/shared: move table util funcs to vim.shared
Use `tbl_` prefix for all table-util functions. Specify in the function
docstring if it expects a list-like or map-like table.
2019-05-18 21:07:30 +02:00
Justin M. Keyes
fd04877eb0 test: remove use of require('test.helpers')
The test.functional.helpers and test.unit.helpers modules now include
all of the public functions from test.helpers, so there is no need to
separately require('test.helpers').
2019-05-18 15:48:13 +02:00
Justin M. Keyes
7669fc1e9b test: share implementation of testdir/load.vim
Also, don't compute load factor unless load_adjust() was called, it
slows down the test suite.

ref #9292
2019-05-18 15:48:13 +02:00
Justin M. Keyes
bba75eb184 lua/stdlib: Introduce vim.shared
This is where "pure functions" can live, which can be shared by Nvim and
test logic which may not have a running Nvim instance available.

If in the future we use Nvim itself as the Lua engine for tests, then
these functions could be moved directly onto the `vim` Lua module.

closes #6580
2019-05-18 15:48:13 +02:00
Justin M. Keyes
2b87485c22 test: Extend {unit,functional}.helpers with global helpers
Automatically include all "global helper" util functions in the
unit.helpers and functional.helpers and modules.  So tests don't need to
expicitly do:

    local global_helpers = require('test.helpers')
2019-05-18 14:51:01 +02:00
Björn Linse
94f78ccf89
Merge pull request #9883 from bfredl/termredraw
make terminal state redraw like any other state
2019-05-14 13:39:00 +02:00
Björn Linse
5020daa6e5 ui/terminal: make terminal state redraw like any other state
Previously, ordinary redraws were missing from terminal mode. Instead,
there was an async callback that invoked update_screen() on terminal
data regardless of mode (as if :redraw! was invoked by a timer).

This created some issues:

- async changes to an unrelated ordinary buffer were not always redrawn in
  terminal mode
- screen cursor position was not properly updated in terminal mode (partial
  fix, will be properly fixed in a follow up PR)
- ad-hoc logic was needed for interaction with special states such as
  inccommand or horizontal wildmenu.

Instead redraw terminal mode just like any other state. This disables forced
redraws in cmdline mode, which were inconisent which async changes to
normal buffers (which are not redrawn in cmdline mode).
2019-05-14 12:54:39 +02:00
Björn Linse
9e0982a1a2
Merge pull request #9985 from bfredl/shenanigans
Fix aucmd_win issues: crashes and redrawing errors.
2019-05-13 23:24:14 +02:00
Björn Linse
74751117eb autocmd: fixes and tests for autocmd window issues
- redraw! in an invisible buffer rendered the screen unusable.
- storing the autocmd window handle and using it in API function could lead
  to crashes. Unregister the handle when the window is not active.
2019-05-13 20:32:04 +02:00
Justin M. Keyes
60aaae1c86 API/nvim_set_keymap: remove mode-shortname aliases
Reduce the API surface-area a bit. No need to have aliases for a mode.
ref #9924
2019-05-12 13:27:07 +02:00
Justin M. Keyes
f35d233e07 API/nvim_set_keymap: minor cleanup
ref #9924
2019-05-12 13:04:48 +02:00
Yilin Yang
fbf2c414ad API: nvim_set_keymap, nvim_del_keymap #9924
closes #9136

- Treat empty {rhs} like <Nop>

- getchar.c: Pull "repl. MapArg termcodes" into func
  The "preprocessing code" surrounding the replace_termcodes calls needs
  to invoke replace_termcodes, and also check if RHS is equal to "<Nop>".
  To reduce code duplication, factor this out into a helper function.

  Also add an rhs_is_noop flag to MapArguments; buf_do_map_explicit
  expects an empty {rhs} string for "<Nop>", but also needs to distinguish
  that from something like ":map lhs<cr>" where no {rhs} was provided.

- getchar.c: Use allocated buffer for rhs in MapArgs
  Since the MAXMAPLEN limit does not apply to the RHS of a mapping (or
  else an RHS that calls a really long autoload function from a plugin
  would be incorrectly rejected as being too long), use an allocated
  buffer for RHS rather than a static buffer of length MAXMAPLEN + 1.

- Mappings LHS and RHS can contain literal space characters, newlines, etc.

- getchar.c: replace_termcodes in str_to_mapargs
  It makes sense to do this; str_to_mapargs is, intuitively, supposed to
  take a "raw" command string and parse it into a totally "do_map-ready"
  struct.

- api/vim.c: Update lhs, rhs len after replace_termcodes
  Fixes a bug in which replace_termcodes changes the length of lhs or rhs,
  but the later search through the mappings/abbreviations hashtables
  still uses the old length value. This would cause the search to fail
  erroneously and throw 'E31: No such mapping' errors or 'E24: No such
  abbreviation' errors.

- getchar: Create new map_arguments struct
  So that a string of map arguments can be parsed into a more useful, more
  portable data structure.

- getchar.c: Add buf_do_map function
  Exactly the same as the old do_map, but replace the hardcoded references
  to the global `buf_T* curbuf` with a function parameter so that we can
  invoke it from nvim_buf_set_keymap.

- Remove gettext calls in do_map error handling
2019-05-12 11:44:48 +02:00
Justin M. Keyes
24f9dd73d5 test/channels_spec: cleanup
- Remove stray print()
- Use uname() instead of system('uname')
2019-05-12 00:43:28 +02:00
Justin M. Keyes
3d1ed7c959 UI/ext_messages: learn more message kinds
ref #6201
2019-05-11 23:42:55 +02:00
Justin M. Keyes
b9ad12e6c2 UI/nvim_ui_attach(): add override option
Before now, Nvim always degrades UI capabilities to the lowest-common
denominator. For example, if any connected UI has `ext_messages=false`
then `ext_messages=true` requested by any other connected UI is ignored.

Now `nvim_ui_attach()` supports `override=true`, which flips the
behavior: if any UI requests an `ext_*` UI capability then the
capability is enabled (and the legacy behavior is disabled).

Legacy UIs will be broken while a `override=true` UI is connected, but
it's useful for debugging: you can type into the TUI and observe the UI
events from another connected (UI) client. And the legacy UI will
"recover" after the `override=true` UI disconnects.

Example using pynvim:

    >>> n.ui_attach(2048, 2048, rgb=True, override=True, ext_multigrid=True, ext_messages=True, ext_popupmenu=True)
    >>> while True: n.next_message();
2019-05-09 22:27:41 +02:00
hashinclude
400ee59247 API: fix cursor position when lines are added #9961
Restore code removed in #9674.
2019-05-07 09:17:37 +02:00
Justin M. Keyes
4b65a0059a test: cleanup
Avoid hyper-granularity. Don't need subdirectories for every little
thing.
2019-05-05 23:01:35 +02:00
Marco Hinz
1eda387951
tests: adjust to latest Vim patches 2019-05-05 14:05:25 +02:00
Marco Hinz
e6c21c4bc0
vim-patch:8.0.1782: no simple way to label quickfix entries
Problem:    No simple way to label quickfix entries.
Solution:   Add the "module" item, to be used instead of the file name for
            display purposes. (Martin Szamotulski)

d76ce85266
2019-05-05 13:46:19 +02:00
Justin M. Keyes
fd0fd752c8 terminal: swap priority of terminal, editor highlights
closes #9964
2019-05-02 09:56:22 +02:00
Carlo Abelli
49c51f839b ex_getln: fix statusline redraw logic #9967
fixes #9908
2019-05-02 11:38:21 +02:00
Justin M. Keyes
8aca932aa0
clipboard: setreg("*") with clipboard=unnamed #9954
Helped-by: Björn Linse <bjorn.linse@gmail.com>
fix #5646
2019-04-28 21:06:24 +02:00
Justin M. Keyes
769f44e918 win/defaults: Use "…/nvim-data/site" in 'runtimepath'
On Windows we store non-config data in "$XDG_DATA_HOME/nvim-data". But
the "…/site" items in 'runtimepath' did not correctly point to that
location, they used "…/nvim/site".

Fix the init logic to use  "…/nvim-data/site".

closes #9910
2019-04-28 00:27:07 +02:00
Justin M. Keyes
698c4f662d test: clear(): remove opts.headless parameter
Callers can instead specify `args_rm={'--headless'}`.

TODO: should `nvim_argv` have "--headless" by default? Need to inspect
      some uses of spawn(nvim_argv) ...
2019-04-27 16:31:26 +02:00
Justin M. Keyes
17291642bd test: clear(): args_rm parameter 2019-04-27 16:19:40 +02:00
Justin M. Keyes
f0a7e3fc9a test: 'shadafile' default
ref 773bdd41ec
2019-04-27 16:19:40 +02:00
Jan Edmund Lazo
9d77a07686 vim-patch:8.0.1510: cannot assert beep #9938
Problem:    Cannot test if a command causes a beep.
Solution:   Add assert_beeps().
b48e96f61c
2019-04-25 14:31:33 +02:00
Gabriel Cruz
8c6f5b7f92 Spurious quote mark in command line when typing <C-R> (#9934)
Remove <C-R> special char after reading following chars
2019-04-24 10:41:07 +02:00
glacambre
b3fd83a0ea Reset stop_insert_mode in terminal_enter rather than terminal_check
Problem: Using `:stopinsert` while in normal mode in a terminal buffer
prevents neovim from entering insert mode.

Solution: Move `stop_insert_mode = false` from terminal_check to
terminal_enter to be consistent with edit.c, as suggested by bfredl in
 #9889.

Closes https://github.com/neovim/neovim/issues/9889.
2019-04-20 10:41:46 +02:00
Björn Linse
0be8fb47a4
Merge pull request #9898 from bfredl/floatwidth
windows: float config changes
2019-04-14 13:35:11 +02:00
Björn Linse
c8acbe3b62 windows: float config changes
- Allow floating windows of width 1. #9846
- For a new floating window the size must be specified. Later on we
  might try to calculate a reasonable size by buffer contents
- Remember the configured size of a window, just like its position.
- Make get_config and set_config more consistent. Handle relative='' properly in set_config.
  get_config doesn't return keys that don't make sense for a non-floating window.
- Don't use width=0 for non-changed width, just omit the key.
2019-04-14 10:12:09 +02:00
Justin M. Keyes
dd9554a820 inccommand: Ignore :redraw during preview
closes #9777
2019-04-14 02:22:19 +02:00
Justin M. Keyes
82d48c0dab
Merge pull request #9896 from justinmk/api-async-error
API: emit nvim_error_event on failed async request
2019-04-13 19:53:09 +02:00
Justin M. Keyes
7e1591e06a API: emit nvim_error_event on failed async request
We already do this for _invalid_ async requests #9300.
Now we also do it for failed invocation of valid requests.
2019-04-13 17:07:58 +02:00
Marco Hinz
5f996e36d1
options: properly reset directories on 'autochdir' (#9894)
Fixes https://github.com/neovim/neovim/issues/9892
2019-04-13 12:50:36 +02:00
Gabriel Cruz
3b7a4f233b vim-patch:8.0.0714: cmdline redraw during timer #9835
vim-patch:8.0.0714: when a timer causes a command line redraw " goes missing
Problem:    When a timer causes a command line redraw the " that is displayed
            for CTRL-R goes missing.
Solution:   Remember an extra character to display.
a92522fbf3

vim-patch:8.0.0720: unfinished mapping not displayed when running timer
Problem:    Unfinished mapping not displayed when running timer.
Solution:   Also use the extra_char while waiting for a mapping and digraph.
            (closes vim/vim#1844)
6a77d2667e

close #9835
2019-04-12 03:20:05 +02:00
Marco Hinz
ae88e46563
float: always change to valid windows (#9878)
Using `:wincmd j` and friends doesn't make much sense to a floating window. For
convenience though, any direction will simply change to the previous window.

Make sure the previous window is valid, not the current window, and not another
floating window. Change to the first window (which is never a floating window)
otherwise.
2019-04-11 20:20:17 +02:00
Justin M. Keyes
ddd0eb6f51
startup: -es/-Es (silent/batch mode): skip swapfile #8540
To use Nvim as a scripting engine the side-effects of swapfiles and user
config should be avoided by default.
2019-04-10 03:27:25 +02:00
Björn Linse
5a81561e7a
Merge pull request #9866 from bfredl/setbufcursor
api/window: validate cursor in nvim_win_set_buf
2019-04-08 13:41:39 +02:00
Björn Linse
344c69b66b api/window: validate cursor in nvim_win_set_buf
validate_cursor() is called regularly, but only for the current window.
When changing the buffer for a non-current window, we need to invoke it
in the context of that window.
2019-04-08 12:39:08 +02:00
Justin M. Keyes
943bedfc86
event-loop: do not set CA_COMMAND_BUSY #9853
CA_COMMAND_BUSY in nv_event() was carried over from Vim nv_cursorhold()
(ref: e5165bae11). It prevents :startinsert from working during a RPC
call, so remove it.

Helped-by: glacambre <me@r4>
closes #7254
2019-04-08 02:33:00 +02:00
glacambre
d928b036dc :stopinsert should leave terminal-mode #9856
Problem:  Calling :stopinsert from RPC while in terminal-mode does not
          go back to normal-mode.
Solution: Implement a check() handler for state_enter(), adapted from
          insert_check().

Fix #7807
2019-04-08 01:13:43 +02:00
Justin M. Keyes
a7a56293aa
CI/AppVeyor: per-compiler deps cache #9852
The deps cache does not work for MSVC builds because the MINGW builds
ovewrite it.  Cache saves 10+ minutes on the build.
2019-04-07 03:54:22 +02:00
Marco Hinz
d9de4c0efb
vim-patch:8.1.1072: extending sign and foldcolumn below the text is confusing (#9816)
Problem:    Extending sign and foldcolumn below the text is confusing.
Solution:   Let the sign and foldcolumn stop at the last text line, just like
            the line number column.  Also stop the command line window leader.
            (Christian Brabandt)

8ee4c01b8c

Closes https://github.com/neovim/neovim/issues/9613
2019-04-03 10:48:47 +02:00
Justin M. Keyes
8eaa452073
Merge #9516 from erw7/improve-executable-on-windows
Improve executable() and exepath() on windows
2019-04-02 12:40:36 +02:00
Justin M. Keyes
c7039fd0d3 test: "$PATHEXT=::" 2019-04-02 01:28:11 +02:00
Abdelhakeem Osama
35362495c9 jumplist: avoid extra tail entry #9805
fixes #9775
2019-04-02 00:50:28 +02:00
erw7
ece8d88b10 test/win: Remove unnecessary set shell 2019-04-01 19:47:58 +09:00
erw7
3be5aa1a34 test/win: executable(), exepath() #9516 2019-04-01 03:13:11 +02:00
Olivier G-R
d13803f64f keymap, terminal: more keycodes #9810
- input: recognize <kEqual>, <kComma>
- terminal.c: If we need to support function key, a change must be made
  in libvtermkey. Currently, it emulates strictly VT220 terminal, and
  returning numeric value in 'normal' mode is the expected behaviour.

closes #9810
2019-03-31 23:39:06 +02:00
Marco Hinz
4c4a570156
Merge #9807 from mhinz/window-local-last-cursormoved 2019-03-31 15:13:38 +02:00
Qiming zhao
9e52255de2 autocmd: rename MenuPopupChanged to CompleteChanged #9819 2019-03-31 01:15:41 +01:00
Said Al Attrach
2bf18e7843
test: move trim to global helpers 2019-03-30 18:14:20 +01:00
Marco Hinz
33d4c38131
cursormoved: add tests for CursorMoved 2019-03-29 10:58:53 +01:00
Olivier G-R
f6fb370b1b keymap: add more (keypad) keycodes #9793
- K_KORIGIN instead of K_KCENTER: This name is similar to what is used
  by xev. Alternative could be K_KBEGIN as hinted here:
  https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-PC-Style-Function-Keys
  But I find Begin and Home too similar, and it might induced some
  confusion. The naming looked related to some old keyboard
  configuration.

- keymap.c: alias KPPeriod to kDel instead of kPoint.
  This might seems weird, but this is actually the behaviour that should
  be expected. libtermkey produces "KPPeriod" when num lock is off. To
  fix this would need to change this name in termkey.

closes #9780
closes #9793
2019-03-29 01:11:57 +01:00
Justin M. Keyes
fbaee922d1 doc [ci skip]
closes #9719
2019-03-26 19:55:33 +01:00
Dan Aloni
36762a00a8 signs: support multiple columns #9295
closes #990
closes #9295

- Support for multiple auto-adjusted sign columns.
  With this change, having more than one sign on a line, and with the
  'auto' setting on 'signcolumn', extra columns will shown automatically
  to accomodate all the existing signs.

  For example, suppose we have this view:

   5147             }
   5148
   5149             return sign->typenr;
   5150         }
   5151     }
   5152     return 0;
   5153 }
   5154

  We have GitGutter installed, so it tells us about modified lines that
  are not commmited. So let's change line 5152:

     5147             }
     5148
     5149             return sign->typenr;
     5150         }
     5151     }
   ~ 5152     return 0;
     5153 }
     5154

  Now we add a mark over line 5152 using 'ma' in normal mode:

      5147             }
      5148
      5149             return sign->typenr;
      5150         }
      5151     }
  a ~ 5152     return 0;
      5153 }
      5154

  Previously, Vim/Nvim would have picked only one of the signs,
  because there was no support for having multiple signs in a line.

- Remove signs from deleted lines.
  Suppose we have highlights on a group of lines and we delete them:

   +     6 use std::ops::Deref;
   --+   7 use std::borrow::Cow;
   --+   8 use std::io::{Cursor};
         9 use proc_macro2::TokenStream;
        10 use syn::export::ToTokens;
   --+  11 use std::io::Write;
   >>   12 use std::ops::Deref;

  Without this change, these signs will momentarily accumulate in
  the sign column until the plugins wake up to refresh them.

  + --+ --+ --+ >>  6

  Discussion: It may be better to extend the API a bit and allow this
  to happen for only certain types of signs. For example, VIM marks
  and vim-gitgutter removal signs may want to be presreved, unlike
  line additions and linter highlights.

- 'signcolumn': support 'auto:NUM' and 'yes:NUM' settings
- sort signs according to id, from lowest to highest. If you have
  git-gutter, vim-signature, and ALE, it would appear in this order:
  git-gutter - vim-signature - ALE.
- recalculate size before screen update
- If no space for all signs, prefer the higher ids (while keeping the
  rendering order from low to high).
- Prevent duplicate signs. Duplicate signs were invisible to the user,
  before using our extended non-standard signcolumn settings.
- multi signcols: fix bug related to wrapped lines.
  In wrapped lines, the wrapped parts of a line did not include the extra
  columns if they existed. The result was a misdrawing of the wrapped
  parts. Fix the issue by:
    1. initializing the signcol counter to 0 when we are on a wrap boundary
    2. allowing for the draw of spaces in that case.
2019-03-25 02:17:47 +01:00
Said Al Attrach
a9df3fa5d2
test: make first attempt at some kind of test 2019-03-24 00:21:26 +01:00
Jit Yao Yap
2a618e0ad0 Update test 2019-03-23 22:14:03 +01:00
Jit Yao Yap
31fa064c68 floating-window.c: fix crash when using inccommand 2019-03-23 22:14:03 +01:00
Björn Linse
ae49e8da58 window: don't crash when closing two floats in a row
prevwin can be set to the current window. Then we can't jump to it
after closing a float.
2019-03-23 20:12:37 +01:00
Marco Hinz
3e78319ac6
help: ignore snapshotted window if invalid (#9774)
Nvim doesn't expect a window-changing command on an created-window event.

    autocmd WinNew * wincmd p
    help help

- A snapshot for window 1000 is created.
- The window is split and the cursor changes to the new window 1001.
- The autocmd kicks in and switches back to 1000.
- The help buffer is opened.
- On closing the help window 1000, it tries to go back to the snapshotted window
  which is... 1000.
- wp1000->w_buffer == NULL
- w_buffer is used by check_cursor()
- 🧨 -> 💥

Fixes https://github.com/neovim/neovim/issues/9773
2019-03-23 00:23:39 +01:00
Marco Hinz
3edf7fc64f
api: ignore floating windows for laststatus=1 (#9771)
ONE_WINDOW considers all windows whereas one_window() ignores floating windows.

Fixes https://github.com/neovim/neovim/issues/9768
2019-03-22 17:17:33 +01:00
Chris LaRose
c5631338b1 :mksession : restore tab-local working directories #9754 2019-03-21 11:53:38 +01:00