Commit Graph

2695 Commits

Author SHA1 Message Date
Björn Linse
2cc83c961c refactor: use inserted_bytes pattern from vim
This covers all "small" inserts and deletes in insert mode, as well
as a few more cases like small normal mode deletes

vim-patch:8.1.0678: text properties as not adjusted for inserted text
2019-11-23 16:46:47 +01:00
Björn Linse
bdebe8516c bufhl: use extmark column adjustment for bufhl
NB: this is not the final implementation. Bufhl should be made a
part of the extmark tree, so that "start" adjustment just works
automatically. But "stop" will still need some ad-hoc trickery,
until extended marks natively support ranges (hopefully sooner than
forever).
2019-11-23 14:50:31 +01:00
Dennis B
d5f14b8372 Clear 'cc' in nvim_open_win 'minimal' style #11361 (#11427)
* Clear 'cc' in nvim_open_win 'minimal' style #11361

Add 'colorcolumn' to the list of options that should be cleared when creating
a 'minimal'-style floating window.
2019-11-22 10:55:04 +01:00
Ashkan Kiani
b4ca07896c lualint 2019-11-21 15:23:43 -08:00
Ashkan Kiani
bcae04f6c6 Updates
- Use correct implementation of text_edits.
- Send indent options to rangeFormatting and formatting.
- Remove references to vim bindings and filetype from lsp.txt
- Add more examples to docs.
- Add before_init to allow changing initialize_params.
2019-11-21 15:19:06 -08:00
Ashkan Kiani
6a51401378 Merge remote-tracking branch 'origin/master' into lsp-followup 2019-11-21 10:04:32 -08:00
Björn Linse
76e0a8bd93 lsp: transmit "\n" after last line when 'eol' is set
Otherwise some servers like clangd will emit spurious
"no newline at end of file" warnings.
2019-11-21 11:12:57 +01:00
Ashkan Kiani
b984f613c1 Extend list_extend to take start/finish. 2019-11-20 17:09:21 -08:00
Joe Hermaszewski
1ff5b60cb9 vim-patch:8.1.0251: support full paths for 'backupdir' #11269
Problem:    Using a full path is supported for 'directory' but not for
            'backupdir'. (Mikolaj Machowski)
Solution:   Support 'backupdir' as well. (Christian Brabandt, closes vim/vim#179)
b782ba475a
2019-11-17 23:38:27 -08:00
Björn Linse
dab40f43b1 Add v:lua.func() vimL syntax for calling lua
Also simplify error messages when calling lua from vimL.
2019-11-16 22:33:21 +01:00
Björn Linse
ebdf90e7d7 extmark: don't crash in RO buffer. 2019-11-16 11:58:32 +01:00
Ashkan Kiani
00dc12c5d8 lua LSP client: initial implementation (#11336)
Mainly configuration and RPC infrastructure can be considered "done". Specific requests and their callbacks will be improved later (and also served by plugins). There are also some TODO:s for the client itself, like incremental updates.

Co-authored by at-tjdevries and at-h-michael, with many review/suggestion contributions.
2019-11-13 21:55:26 +01:00
Justin M. Keyes
0190de9aab
Merge #11307 'Lua: vim.validate()' 2019-11-11 21:25:16 -08:00
Björn Linse
18a8b702c0 extmark: review changes 2019-11-11 20:18:15 +01:00
timeyyy
a9065a5051 nsmarks: initial commit 2019-11-11 19:43:15 +01:00
Justin M. Keyes
a0d992785f Lua: Use vim.validate() instead of assert() 2019-11-10 23:43:49 -08:00
Justin M. Keyes
7aa4042d3b Lua: vim.validate() 2019-11-10 23:43:49 -08:00
Hirokazu Hata
678a51b1da Lua: vim.validate()
We often want to do type checking of public function arguments.

- test: Rename utility_function_spec.lua to vim_spec.lua
- .luacov: Map lua module names
2019-11-10 22:50:24 -08:00
Björn Linse
d200a818a7 tests: vim.rpcnotify test is flaky 2019-11-10 17:13:53 +01:00
Marco Hinz
1cb4674547
api: add nvim_buf_get_virtual_text() (#11354)
This adds the missing partner function of nvim_buf_set_virtual_text().
2019-11-10 16:38:04 +01:00
Björn Linse
3a075ce3dc
Merge pull request #11310 from bfredl/luarpc
lua: add vim.rpcrequest, vim.rpcnotify and vim.NIL
2019-11-10 14:46:14 +01:00
Björn Linse
474d0bcbf7 lua: vim.rpcrequest, vim.rpcnotify, vim.NIL 2019-11-10 13:08:05 +01:00
Justin M. Keyes
4abb67c027 test/Screen:expect: replace "{IGNORE}" with "{MATCH:…}"
ref #11004
2019-11-09 22:26:01 -08:00
Daniel Hahler
c0abaf9ca6 tests: Screen:expect: support "{MATCH:…}" 2019-11-09 21:58:28 -08:00
Justin M. Keyes
7a23b67d35
paste: Select-mode, Visual-mode #11360
fix #11344
2019-11-09 21:18:51 -08:00
Justin M. Keyes
9ef16a1628 doc: vim.fn, vim.call(), vim.api [ci skip] 2019-11-06 01:37:50 -08:00
Justin M. Keyes
3e21d49836 Merge #11319 'inccommand: fix issues with modifiers and prompting' 2019-11-05 17:34:21 -08:00
Björn Linse
f707a7ef68 terminal: add tests for palette color forwarding 2019-11-03 10:14:58 +01:00
Björn Linse
33cdff1b5c test/screen: make snapshot_util() work properly in rgb_cterm mode 2019-11-02 11:01:58 +01:00
Rob Pilling
d04ab11f24 Prevent prompts during inccommand previews
For example, "Backwards range given, OK to swap (y/n)?" on each keypress.
2019-10-31 19:22:22 +00:00
Rob Pilling
d52d782389 Prevent :topleft, etc modifying the inccommand preview window 2019-10-31 19:16:52 +00:00
Rob Pilling
1c7aa11312 Allow multiple leading colons before and after modifiers for 'inccommand' 2019-10-31 19:16:52 +00:00
Rob Pilling
d4384cbbf3 Remove unnecessary expr in 'icm' test 2019-10-31 18:55:43 +00:00
Björn Linse
e085cacba4
Merge pull request #11302 from bfredl/luacall
lua: add vim.fn.{func} for direct access to vimL function
2019-10-27 19:49:30 +01:00
Björn Linse
8ee7c94a92 lua: add vim.fn.{func} for direct access to vimL function
compared to vim.api.|nvim_call_function|, this fixes some typing issues
due to the indirect conversion via the API. float values are preserved
as such (fixes #9389) as well as empty dicts/arrays.

Ref https://github.com/norcalli/nvim.lua for the call syntax
2019-10-27 17:23:17 +01:00
Daniel Hahler
4b5e2f7a0b tests: remove some redundant legacy tests #11028
These were turned into new-style Vim tests in cbecae46f.
2019-10-26 12:43:38 -07:00
Justin M. Keyes
316c29bbf3 test/pcall_err(): truncate full paths, omit linenr
ref #11271
2019-10-26 02:00:58 -07:00
Hirokazu Hata
996a057fb9 lua/stdlib: adjust some validation messages #11271
close #11271
2019-10-26 00:27:01 -07:00
Justin M. Keyes
019c8d13dd
build/doc/CI: remove/update quickbuild references #11258 2019-10-19 18:04:08 -07:00
Daniel Hahler
93fe30593b ex_echo: fix check for got_int #11225
It needs to return to not output any remaining parts.

Followup to https://github.com/neovim/neovim/pull/10926
Ref: https://github.com/neovim/neovim/issues/10923
2019-10-19 14:45:27 -07:00
Daniel Hahler
d89ec55c45 test/functional: retry/Screen: failure instead of error #11173
- Running out of retries, or unexpected screen state should make the
  test FAIL, not ERROR.
- Uses levels to report the location of the caller.
- Improve message with retry-failure (formatting).

Before:

    [ RUN      ] test: 103.53 ms ERR
    test/functional/helpers.lua:388:
    retry() attempts: 1
    test/functional/ui/screen.lua:587: Row 1 did not match.
    Expected:
      |*X^                         |
      |{0:~                        }|
      |{0:~                        }|
      |                         |
    Actual:
      |*^                         |
      |{0:~                        }|
      |{0:~                        }|
      |                         |

    To print the expect() call that would assert the current screen state, use
    screen:snapshot_util(). In case of non-deterministic failures, use
    screen:redraw_debug() to show all intermediate screen states.

    stack traceback:
            test/functional/helpers.lua:388: in function 'retry'
            test/functional/test_spec.lua:24: in function <test/functional/test_spec.lua:23>

After:

    [ RUN      ] test: 105.22 ms FAIL
    test/functional/test_spec.lua:24: stopping after 1 retry() attempts.
    test/functional/test_spec.lua:25: Row 1 did not match.
    Expected:
      |*X^                         |
      |{0:~                        }|
      |{0:~                        }|
      |                         |
    Actual:
      |*^                         |
      |{0:~                        }|
      |{0:~                        }|
      |                         |

    To print the expect() call that would assert the current screen state, use
    screen:snapshot_util(). In case of non-deterministic failures, use
    screen:redraw_debug() to show all intermediate screen states.

    stack traceback:
            test/functional/helpers.lua:389: in function 'retry'
            test/functional/test_spec.lua:24: in function <test/functional/test_spec.lua:23>
2019-10-19 14:15:07 -07:00
Daniel Hahler
175ca82ca7
tests: let_spec: enable "multibyte env var to child process" (#11233) 2019-10-18 20:41:24 +02:00
Daniel Hahler
84aa86afb7
build: do not build test fixtures by default (#11230)
- tty-test is also used on Windows
- FUNCTIONALTEST_PREREQS: add printenv-test
2019-10-18 16:32:56 +02:00
Daniel Hahler
4bbad54817
tests: fix non-controversial misuse of pending (#11247)
Ref: https://github.com/neovim/neovim/pull/11184
2019-10-18 04:46:30 +02:00
Daniel Hahler
932edf4f33
tests: tui_spec: fix waiting for terminal to be ready (#11232)
The screen would have '-- TERMINAL --' already initially.

Related to flakiness of "TUI FocusGained/FocusLost in terminal-mode".
2019-10-15 20:50:51 +02:00
Björn Linse
cc0d725230 tests/ui: completely delete "attr_ignore" feature
All existing usages are ad-hoc/random/lazyness. Generating attribute
specifications is not hard since four years, just do it always.
2019-10-13 22:10:42 +02:00
Björn Linse
4987311fb5 tests/ui: remove unnecessary screen:detach()
It is perfectly fine and expected to detach from the screen just by
the UI disconnecting from nvim or exiting nvim. Just keep detach() in
screen_basic_spec, to get some coverage of the detach method itself.

This avoids hang on failure in many situations (though one could argue
that detach() should be "fast", or at least "as fast as resize",
which works in press-return already).

Never use detach() just to change the size of the screen, try_resize()
method exists for that specifically.
2019-10-13 22:10:42 +02:00
Björn Linse
a330129a28 tests/ui: cleanup illegitimate usages of "attr_ignore"
"attr_ignore" is an anti-pattern, with snapshot_util()
just include all the highlights already.
2019-10-13 22:10:42 +02:00
Björn Linse
5a85699425 tests/ui: make screen.lua use "linegrid" representation internally
PR #8221 took a short-cut when implementing the tests: screen.lua would
translate the linegrid highlight ids back into the old per-cell
attribute description.

Apart from cleaning up technical debt, this enables to check both rgb
and cterm colors in the same expect(), which previously was needlessly
restricted to ext_hlstate tests only.
2019-10-13 22:10:42 +02:00
Rob Pilling
5f60861f5a fnamemodify: fix handling of :r after :e #11165
- Test fnamemodify()
- Test handling of `expand("%:e:e:r")`.
- Fix :e:e:r on filenames with insufficiently many extensions

During `fnamemodify()`, ensuring that we don't go before the filename's
tail is insufficient in cases where we've already handled a ":e"
modifier, for example:

```
"path/to/this.file.ext" :e:e:r:r
         ^    ^-------- *fnamep
         +------------- tail
```

This means for a ":r", we'll go before `*fnamep`, and outside the bounds
of the filename. This is both incorrect and causes neovim to exit with
an allocation error.

We exit because we attempt to calculate `s - *fnamep` (line 23948).
Since `s` is before `*fnamep`, we caluclate a negative length, which
ends up being interpreted as an amount to allocate, causing neovim to
exit with ENOMEM (`memory.c:xmalloc`).

We must instead ensure we don't go before `*fnamep` nor `tail`.
The check for `tail` is still relevant, for example:

```
"path/to/this.file.ext" :r:r:r
 ^       ^------------- tail
 +--------------------- *fnamep
```
Here we don't want to go before `tail`.

close #11165
2019-10-10 22:33:42 -07:00
Jan Edmund Lazo
a7fc2f3f64 test: "!:&" works with powershell #11201
Removed 'echo' alias because it does not behave like POSIX echo.
2019-10-10 21:30:20 -07:00
Jan Edmund Lazo
51f2826f61 doc: update shellquote for powershell #11122
shellquote is not treated like shellxquote for non-quote values.
2019-10-10 01:16:02 -07:00
Daniel Hahler
2b08dd8f06
tests: retry: "wait() evaluates the condition on given interval" (#11155)
Ref: https://github.com/neovim/neovim/issues/11137
2019-10-06 22:47:40 +02:00
Daniel Hahler
e452988960
tests/functional: keep $TMPDIR in env (#11163) 2019-10-06 22:26:54 +02:00
Daniel Hahler
a341eb6087 win_line: update w_last_cursorline always
Vim patch 8.1.0856 (54d9ea6) caused a performance regression in Neovim,
when `set conceallevel=1 nocursorline` was used, since then due to
refactoring in 23c71d5 `w_last_cursorline` would never get updated
anymore.

Adds/uses `redrawdebug+=nodelta` for testing this.

Fixes https://github.com/neovim/neovim/issues/11100.
Closes https://github.com/neovim/neovim/pull/11101.
2019-10-04 08:48:57 +02:00
Daniel Hahler
cd73a0342a tests: tui_spec: improve/merge OptionSet/deferred
Closes https://github.com/neovim/neovim/pull/11129.
2019-10-04 08:39:16 +02:00
Justin M. Keyes
30479417e8
Merge #11087 from janlazo/vim-8.1.0010
vim-patch:8.1.{10,230,315,330,514,517,518,1327,1347,1758,2072,2074,2091,2095,2103}
2019-10-02 22:43:59 -07:00
Daniel Hahler
333dc3d138
Fix flaky test: tui_spec: increase timeout (#11134)
Meant to fix:

    [  ERROR   ] test/functional/terminal/tui_spec.lua @ 925: TUI FocusGained/FocusLost in terminal-mode
    test/functional/ui/screen.lua:587: Row 6 did not match.
    Expected:
      |{1:r}eady $                                           |
      |[Process exited 0]                                |
      |                                                  |
      |                                                  |
      |                                                  |
      |*gained                                            |
      |{3:-- TERMINAL --}                                    |
    Actual:
      |{1:r}eady $                                           |
      |[Process exited 0]                                |
      |                                                  |
      |                                                  |
      |                                                  |
      |*:terminal                                         |
      |{3:-- TERMINAL --}                                    |

    To print the expect() call that would assert the current screen state, use
    screen:snapshot_util(). In case of non-deterministic failures, use
    screen:redraw_debug() to show all intermediate screen states.

    stack traceback:
    	test/functional/ui/screen.lua:587: in function '_wait'
    	test/functional/ui/screen.lua:370: in function 'expect'
    	test/functional/terminal/tui_spec.lua:934: in function <test/functional/terminal/tui_spec.lua:925>

I've thought about adding this, but it might not be really relevant, and
slows down the tests a bit (and a warning "warning: Screen test
succeeded immediately" with another test):

```diff
diff --git i/test/functional/terminal/tui_spec.lua w/test/functional/terminal/tui_spec.lua
index ada073c4e..4bc2ab4e0 100644
--- i/test/functional/terminal/tui_spec.lua
+++ w/test/functional/terminal/tui_spec.lua
@@ -818,6 +818,11 @@ describe('TUI FocusGained/FocusLost', function()
       ..'", "-u", "NONE", "-i", "NONE", "--cmd", "set noswapfile noshowcmd noruler"]')
     feed_data(":autocmd FocusGained * echo 'gained'\n")
     feed_data(":autocmd FocusLost * echo 'lost'\n")
+    -- Wait for autocommand to be registered.
+    retry(nil, nil, function()
+      feed_data(":autocmd FocusLost\n")
+      screen:expect{any="         echo 'lost'"}
+    end)
     feed_data("\034\016")  -- CTRL-\ CTRL-N
   end)
```
2019-10-02 04:56:22 +02:00
Jan Edmund Lazo
1f4c9da9c6
test: fix screen assertions 2019-10-01 22:27:44 -04:00
Daniel Hahler
b7d6caaa03 Fix redraw regression with w_p_cole in visual mode
Fixes https://github.com/neovim/neovim/issues/11024, regressed in 23c71d51.
Closes https://github.com/neovim/neovim/pull/11120.
2019-10-02 03:51:46 +02:00
Daniel Hahler
8a4ae3d664
tui: improve handle_background_color: short-circuit (#11067)
* handle_background_color: short-circuit if handled already

* Unit tests for handle_background_color

* set waiting_for_bg_response to false in tui_terminal_after_startup
  By then it should have been received.
2019-09-30 22:00:55 +02:00
Björn Linse
dd26bd5974 screen: don't crash on invalid grid cells being recomposed 2019-09-30 19:05:54 +02:00
Björn Linse
0636b25f28 cmdline: wildmenumode() should be true with wildoptions+=pum 2019-09-28 21:00:27 +02:00
Björn Linse
9fa850991d tree-sitter: improve and cleanup tests 2019-09-28 17:46:25 +02:00
Björn Linse
d5a69eb076 tree-sitter: handle node equality 2019-09-28 17:46:25 +02:00
Björn Linse
e0d6228978 tree-sitter: use "range" instead of "point_range" consistently in lua API 2019-09-28 17:46:25 +02:00
Björn Linse
06ee45b9b1 tree-sitter: fix lint, delete "demo" plugin (replaced by functional tests) 2019-09-28 17:46:25 +02:00
Björn Linse
167a1cfdef tree-sitter: improve parser API (shared parser between plugins) 2019-09-28 14:55:43 +02:00
Björn Linse
c8f861b739 tree-sitter: rename tree_sitter => treesitter for consistency 2019-09-28 14:55:43 +02:00
Björn Linse
4ea5e63aa8 tree-sitter: add basic testing on ci
build tree-sitter c parser on ci for testing purposes
2019-09-28 14:55:43 +02:00
Daniel Hahler
54c66e636a
Fix two more flaky tests (#11095)
* mode_spec: retry with increasing matchtime

`matchtime=2` might still be too low (with luacov on AppVeyor).

    [  ERROR   ] test/functional\ui\mode_spec.lua @ 47: ui mode_change event works in insert mode
    test\functional\ui\screen.lua:587: mode
    Expected objects to be the same.
    Passed in:
    (string) 'insert'
    Expected:
    (string) 'showmatch'
    Hint: full state of "mode":
      "insert"

Followup to fe60013fb.
ref #10941
Initially regressed in 7ed2122622

``

* ui/screen_basic_spec: set timeoutlen=10000

This fixes the test on slow CI.

Ref: https://ci.appveyor.com/project/neovim/neovim/builds/27600387/job/t468h2b3w9lwtlm5#L10930
2019-09-26 07:37:51 +02:00
Daniel Hahler
cb25207171 vim-patch:8.0.0914: highlight attributes are always combined (#10256)
Problem:    Highlight attributes are always combined.
Solution:   Add the 'nocombine' value to replace attributes instead of
            combining them. (scauligi, closes vim/vim#1963)
0cd2a94a40

Closes https://github.com/neovim/neovim/pull/10256.
2019-09-26 00:50:54 +02:00
Daniel Hahler
2621f4455d
Merge pull request #10978 from blueyed/update-libuv
third-party: update libuv to v1.32.0
2019-09-25 11:52:41 +02:00
Daniel Hahler
0571145c40
paste: fix handling of "<" in cmdline (#11094)
Fixes https://github.com/neovim/neovim/issues/11088.
2019-09-25 09:15:33 +02:00
Daniel Hahler
70827ea1fa test/functional/preload.lua: _set_fmode for Windows 2019-09-25 05:47:15 +02:00
Daniel Hahler
bb6b1267e7 Revert "win/os_env_exists(): workaround libuv bug #10734"
This reverts commit 278c5d452c.
2019-09-25 05:47:12 +02:00
Daniel Hahler
0ab7da8561
timer_spec: fix/harden flaky tests (#11080)
Those are flaky when using luacov (which causes reproducible slowness).

E.g.:

    [  ERROR   ] test/functional\eval\timer_spec.lua @ 105: timers can invoke redraw in blocking getchar() call
    test\functional\ui\screen.lua:587: Row 3 did not match.
    Expected:
      |ITEM 1                                  |
      |ITEM 2                                  |
      |*{1:~                                       }|
      |{1:~                                       }|
      |{1:~                                       }|
      |^                                        |
    Actual:
      |ITEM 1                                  |
      |ITEM 2                                  |
      |*ITEM 3                                  |
      |{1:~                                       }|
      |{1:~                                       }|
      |^                                        |
2019-09-24 08:55:27 +02:00
Daniel Hahler
2476a97ced
tui_spec: improve "TUI paste: exactly 64 bytes" (#11086)
Doing the screen test first might give insights about a possible
(flaky?) failure, where it looks like "feed_data" is processed out of
order:

    [  ERROR   ] test/functional/terminal/tui_spec.lua @ 561: TUI paste: exactly 64 bytes #10311
    test/functional/helpers.lua:388:
    retry() attempts: 490
    test/functional/terminal/tui_spec.lua:66: Expected objects to be the same.
    Passed in:
    (table: 0x44042de8) {
     *[1] = ' endzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz' }
    Expected:
    (table: 0x41d6e568) {
     *[1] = 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz end' }
    stack traceback:
            test/functional/helpers.lua:388: in function 'retry'
            test/functional/terminal/tui_spec.lua:63: in function 'expect_child_buf_lines'
            test/functional/terminal/tui_spec.lua:569: in function <test/functional/terminal/tui_spec.lua:561>

Ref: https://github.com/neovim/neovim/pull/11083#issuecomment-534375201
Build log: https://travis-ci.org/neovim/neovim/jobs/588749739#L5597
2019-09-24 08:35:29 +02:00
Daniel Hahler
6807779c68
tests: make 'win_update redraws lines properly' more readable (#11068) 2019-09-22 14:58:38 +02:00
Björn Linse
f316916758 screen: missing redraw/highlight for ruler in message area 2019-09-22 09:38:52 +02:00
Zach Wegner
18e5869f56 Fix "precedes" listchar behavior in wrap mode
Previously, the "precedes" character would be rendered on every row
when w_skipcol > 0 (i.e., when viewing a single line longer than the
entire screen), instead of just on the first row. Make sure to only
render it on the first row in this case.

Add a test for this behavior.

Fix documentation for the "precedes" character, which erroneously
stated that it was only active when wrap mode was off.
2019-09-21 22:09:52 -07:00
Jan Edmund Lazo
b3e56957f8 vim-patch:8.1.0460: assert_fails() message argument #11051
Problem:    assert_fails() does not take a message argument
Solution:   Add the argument.
1307d1c003
2019-09-21 14:03:46 -07:00
Björn Linse
828a6e7568 screen: fix vcol counting with virtual text. Fixes #9941 2019-09-21 09:39:10 +02:00
Daniel Hahler
1070c092c7
win_update: fix redraw regression (#11027)
Before 6e9ea5adc `win_ins_lines` would return `FAIL` for `i/line_count == 0`.

Handle this by checking it in the outer `if`.

Ref: https://github.com/neovim/neovim/commit/6e9ea5ad#commitcomment-35084669
2019-09-18 18:22:38 +02:00
Jan Edmund Lazo
8db9e82e3e
vim-patch:8.0.1770: assert functions don't return anything
Problem:    Assert functions don't return anything.
Solution:   Return non-zero when the assertion fails.
65a5464985
2019-09-16 23:42:44 -04:00
Daniel Hahler
4b2d7bb5ea
tests: fix flaky 'scrollback' option deletes lines (only) if necessary (#11003)
Using `screen:expect` with the complete grid appears to fix its
flakiness.

Fixes https://github.com/neovim/neovim/issues/10723.
2019-09-16 19:17:07 +02:00
Daniel Hahler
4df38ec9df
server_requests_spec: fix assertion, pass Lua paths via args (#10875)
This makes it pick up the nvim Luarocks module properly when not
installed via third-party.
2019-09-16 19:16:39 +02:00
Justin M. Keyes
c410440edc fix api_level_6.mpack
This was generated incorrectly in the 0.4.1 release, fixed in the 0.4.1
release.
2019-09-15 17:28:42 -07:00
Justin M. Keyes
e2cc5fe09d NVIM v0.4.0
This release represents ~2700 commits since v0.3.4, the previous
non-maintenance release.  Besides the highlights listed below, this
release features vast improvements to documentation, internal subsystems
and test/CI infrastructure, and 700+ patches merged from Vim.

FEATURES:

New API functions:
  nvim_create_buf: create various kinds of buffers
  nvim_get_context, nvim_load_context
    8e6b0a73c9 #10619 API: Context: save/restore/inspect editor state
  nvim_input_mouse: perform mouse actions
  nvim_open_win: create floating windows (and external, for supporting UIs)
  nvim_paste: paste text at cursor
  nvim_put: put text at cursor
  nvim_select_popupmenu_item: perform popupmenu actions
  nvim_set_keymap: create/delete mappings
  nvim_set_vvar: set v: variables
  nvim_ui_pum_set_height
  nvim_ui_try_resize_grid
  nvim_win_close: close windows
  nvim_win_get_config: get window configuration
  nvim_win_set_config: reconfigure windows

New UI events:
  redraw.grid_destroy
  redraw.hl_group_set
    8a3f8589a3 #10504 UI/highlight: expose builtin highlight groups using hl_group_set event
  redraw.msg_clear
  redraw.msg_history_show
  redraw.msg_ruler
  redraw.msg_set_pos
  redraw.msg_show
  redraw.msg_showcmd
  redraw.msg_showmode
  redraw.win_close
  redraw.win_external_pos
  redraw.win_float_pos
  redraw.win_hide
  redraw.win_pos

API
f5c56f03bb #9170 API/Lua: nvim_buf_attach: support Lua callback
82d48c0dab #9896 API: emit nvim_error_event on failed async request
b9ad12e6c2 #9992 UI/nvim_ui_attach(): add `override` option
3d1ed7c959 #9993 UI/ext_messages: learn more message kinds
8ed54bbec3 #9547 proper multiline error message for rpcrequest, API wrappers

Lua
This release introduces "Nvim-Lua standard library". See ":help lua-stdlib".
89d7e24891 #9463 Lua stdlib: vim.inspect, string functions
8e941c59ec #9740 Lua: generate documentation from docstrings
1cbe014569 #9301 lua/stdlib: Introduce vim.shared
c83926cd0a #10123 Lua: introduce vim.loop (expose libuv event-loop)
81e1dbca99 #10120 Lua: vim.schedule(cb)
1f54f68732 #10688 Lua: minimal UTF-16 support needed for LSP
6fb0020df4 #10513 Lua encoding support
    c0993ed343 Lua: support getting UTF-32 and UTF-16 sizes of replaced text
    b0e26199ec Lua: add {old_byte_size} to on_lines buffer change event

UI:
- The Nvim 0.3.4 UI protocol introduced line-based updates instead of
  legacy char-based updates. Nvim 0.4 continues to evolve the UI
  protocol. See ":help ui". Legacy UI clients are supported. See
  ":help api-contract".
9a1675b065 #6619 Floating windows
  - Can be (re)positioned, anchored, external.
  - Are real windows showing real buffers. No shortcuts, hacks, or compromises.
  - Support all features and API of normal windows, plus more.
6427894d89 #8455 Multigrid: "windows drawn on separate grids"
  - Windows are logically isolated internally.
  - Windows are sent to UIs as distinct objects, so that UIs can control
    layout instead of being stuck with the classic TUI layout.
  - Per-window font-size, dimenions, line-spacing.
  - Compositor: Internal subsystem for composing grids.
3855204f58 #6917 UIEnter, UILeave
788bcbba24 #9923 ui: ":syn blend=", 'winblend'
7cf7c0a0b8 #9575 ui: 'redrawdebug' option for flexible debugging of redrawing
5c836d2ef8 #9607 wildoptions=pum (enabled by default)
37f8df8824 #9571 UI: 'pumblend' option for semi-transparent popupmenu
c403a95a52 #9446 Visual: highlight char-at-cursor
  - Traditionally Vim's visual selection does "reverse mode", which
    perhaps conflicts with the non-blinking block cursor. But
    'guicursor' defaults to a vertical bar for selection=exclusive, and
    this confuses users who expect to see the text highlighted.

:terminal
fc27dc98d7 #8550 autocmds: TermEnter, TermLeave
d13803f64f #9810 keymap, terminal: more keycodes
3b56f59532 #9535 :terminal : Fix F1-F4 key codes
2d4a37ebab #10370 :ls : show "R", "F" for terminal-jobs
fd0fd752c8 #9966 terminal: swap priority of terminal, editor highlights
7bb858c39c #9494 libvterm 0.1

TUI
3afb397407 syntax, TUI: support "strikethrough"
ccbcd390d4 #9408 TUI: "title stacking" unconditionally
298608f88c #9509 TUI: detect background color, set bg=dark/light
42f492ac99 #9097 TUI: handle Smulx extension capability (extended underline)
424ddd01f5 #10205 TUI: support rgba background detection
9b4383261a #9601 TUI: italics in tmux, Terminal.app
f6fb370b1b #9793 keymap: support more (keypad) keycodes
3340e08bec #9423 TUI: Konsole DECSCUSR fixup

:checkhealth
d0fd66ba82 health/provider.vim: check curl HTTPS support
c38862acea #10490 checkhealth: try yarn if npm is missing
43356a43d0 #9929 health: check if tmux enabled true colors
ec5a4d862d #9548 checkhealth: validate locale

providers (clipboard, python, etc.):
96be8a2c4d #10161 Allow reloading providers (useful for UIs/clients)
db3c797c6b #9487 provider: improve error message if provider is missing

Various:
36762a00a8 #9295 signs: support multiple columns
801fe799ff #10382 eval: wait() (wait for any condition)
9df3a676e7 #10400 MsgArea highlight; message grid
a9bea8c104 #10790 keymap: allow modifiers to multibyte chars, like <m-ä>
25e0a449bb #10878 #4448 paste: redesign (10x+ faster pasting; extensible vim.paste Lua hook)
ef5037e7f6 #9706 autocmd: introduce "++once" feature
175398f216 #9616 add CompleteChanged autocmd
7fcf2f926f #9717 TextYankPost: add v:event["inclusive"]
3a699a790c #8364 termdebug.vim plugin
ca1ce59025 #9709 performance: use os_copy to create backups
ed0e96cd28 man.vim: set 'linebreak'
70f6939fd4 #9564 events: add "Signal" event
f89d0d8230 #9568 inccommand: auto-disable if folding is slow

FIXES:

41bb68b8e8 #10584 process_stop: uv: do not close stdin first/explicitly
e50aa2a6c6 #10117 normal: Don't exit CTRL-O mode after processing K_EVENT
95fa71c6d2 #9504 :recover : Fix crash on non-existent *.swp
5a836d4767 #9507 screen: don't unconditionally clear messages on window scroll
149dcbf2c7 #10021 channel: refactor events, prevent recursive invocation of events
d19ff73b39 #10107 Fix multiple c_CTRL-D showing statusline
b65a7b7f66 #10103 Fix wildmode=list,full and display+=msgsep interaction
0be6d3c86f #9634 fsync: Ignore ENOTSUP. Fix writing to SMB.
b247c6fd22 #10025 kbtree: pointer UB and unitialized value fixes
018e0d5a19 #9643 API/buffer-updates: always detach on buf-reload
400ee59247 #9961 API: fix cursor position when lines are added
769f44e918 #9911 win/defaults: Use "…/nvim-data/site" in 'runtimepath'
83d571653b #9911 spellfile.vim: store files in stdpath('data')
8dbf23181a #9887 RPC: conform message-id type to msgpack-RPC spec
5f996e36d1 #9894 options: properly reset directories on 'autochdir'
4c4a570156 #9807 various CursorMoved fixes
943bedfc86 #9853 event-loop: do not set CA_COMMAND_BUSY
9d207fd876 #9693 dictwatcheradd(): support b:changedtick
2d50bf3498 #9789 mac: fix locale detection
c5631338b1 #9754 :mksession : restore tab-local working directories
092e7e6c60 #9703 #9703 executable(): return false if user is not owner
11a481f711 #9686 env var fixes/improvements
8e54847fdf #9666 #7920 os/env: Fix completion of multibyte env var names
519382646b #10468 Fix is_executable_in_path() on Windows
8eaa452073 #9516 win: exepath(), executable() fixes
f55c1e4233 #10544 reltimefloat(): allow negative result
b08dc3ec19 #10561 win: jobstart(), system(): $PATHEXT-resolve exe
7cc2b723d4 #10392 TextYankPost: spurious/too-early dispatch during delete
6e01ed6a4c OpenBSD: stop jobs/processes properly
58dd5fcc01 #10522 jobstop(): close channel before process_stop()
83632022f8 #10959 improved resize behavior (all UIs)
c6eb1f42be #10830 API: fix nvim_command_output buffer overflow
cbfd18c85a #10763 startup: handle 'guicursor' after user config
b8f2436feb #10915 jobwait(): fix race if job exits quickly
2fafed6bb8 #10765 clipboard: handle/avoid SIGTERM with previous owner
8aca932aa0 #9954 clipboard: setreg("*") with clipboard=unnamed
3f10c5b533 #9480 performance: clipboard/macOS: assume that pbcopy works
48efafc81c #10398 screen: disable redrawing inside VimResized
5e4b93a38f #10389 API/Lua: make nvim_execute_lua use native lua floats, not special tables
8c6f5b7f92 #9934 Spurious quote mark in command line when typing <C-R>
a8a38f3465 Lua 5.2/5.3 compat

:terminal
47b7b471fa #10700 :terminal : update buffer when switching tabpage
5225c1ec30 #9605 terminal: Fix potential invalid local 'scrollback'
894f6bee54 #8325 :terminal : set topline based on window height
8171e96b96 #9551 Improve :terminal resize
d928b036dc #9856 :stopinsert should leave terminal-mode
3f71218505 #9926 :terminal : fix: Using `:stopinsert` while in normal mode
5020daa6e5 #9883 ui/terminal: make terminal state redraw like any other state

TUI:
9f19e8d29d #9443 TUI: Do not disable BCE for builtin terminfos
a4076e5dcf #9474 win/TUI: fix text overrides line numbers
533d4a36ec #9645 TUI: do not resize host-terminal on startup
b51e5d8b8d #9688 tui_tk_ti_getstr: handle weird value
1f5eac1115 #10785 TUI: fix data-race during resize

CHANGES:

9697c7f56a #8194 fix menu_get()
7f2e43c637 #9520 improve Lua error messages
c2343180d7 #9526 Remove jemalloc
baf93d9606 #9581 UI: always use concrete colors for default_colors_set
91688b4883 #9563 defaults: set 'scrollback' to -1 by default
bb24fec333 #10136 defaults: exclude "S" from 'shortmess'
ddd0eb6f51 #8540 startup: -es/-Es (silent/batch mode): skip swapfile
35362495c9 #9805 jumplist: avoid extra tail entry
939d9053bd #10573 channels: reflect exit due to signals in exit status code
45c34bd84a #10689 :doautocmd : Never show "No matching autocommands"
fb19aeeb33 #9110 API: make nvim_win_set_option() set window-global, not buffer-local
abfc8b3257 #10778 emsg_multiline: log Vim errors
06d9cc734b #10657 exists("$FOO"): return false for empty env var
6616d1d3e5 #10743 win/env: Vim-compat: Empty string deletes env var
7d664837e1 #10662 win: expand nested env var in $HOME
2816bc8620 #8349 edit.c: Disable indent during completion
58f505dc74 #9829 startup: remove TUI init special-case
    Historically Vim/Nvim does backflips to handle input and show messages
    before a UI is available. This logical contradiction was already fixed
    for remote UIs (#9024 c236e80cf3). Fixing it also for the TUI avoids
    problems on Windows, simplifies the logic, and avoids races like #9959.
2019-09-15 12:38:40 -07:00
Justin M. Keyes
ffdf8c4c12 Context: rename "buflist" => "bufs"
Given the other type names "jumps", "vars", etc., the name "buflist"
is somewhat unintuitive.
2019-09-14 18:57:35 -07:00
Justin M. Keyes
f2c75ef9b4 API: nvim_get_context: "opts" param
Since the parameter is already non-primitive, make it an `opts` map
instead of just a list, in case we want to extend it later.
2019-09-14 18:57:35 -07:00
Usama Hameed
fc27dc98d7 autocmds: TermEnter, TermLeave #8550
fix #8428
2019-09-14 15:54:19 -07:00
Justin M. Keyes
3344cffe7b getdigits: introduce strict, def parameters
Problem:
During a refactor long ago, we changed the `getdigits_*` familiy of
functions to abort on overflow.  But this is often wrong, because many
of these codepaths are handling user input.

Solution:
Decide at each call-site whether to use "strict" mode.

fix #5555
2019-09-13 19:29:25 -07:00
Justin M. Keyes
5a3c86205f test: fix failure on Windows (allow ".exe")
ref 77594d55f7
2019-09-13 16:31:21 -07:00
glacambre
77594d55f7 startup: fail if --embed with -es/-Es #10753
Closes https://github.com/neovim/neovim/issues/10031
2019-09-13 15:15:59 -07:00
Jaskaran Singh
3afb397407 syntax, TUI: support "strikethrough"
fix #3436

Includes:
vim-patch:8.0.1038: strike-through text not supported
2019-09-13 14:46:19 -07:00
Justin M. Keyes
492ac04f7e UIEnter/UILeave: fire for embedder UI, builtin TUI
Before this, --embed UIs (without --headless) would not trigger UIEnter.

For TUI, maybe UIEnter isn't useful, but:
- It is less "surprising"/special.
- Makes documentation simpler.
- When TUI becomes a coprocess, it will happen anyway.
2019-09-12 17:04:05 -07:00
Justin M. Keyes
589f612adf rename: UIAttach/UIDetach => UIEnter/UILeave
"enter"/"leave" is more conventional for Vim events, and
"attach"/"detach" distinction does not gain much.
2019-09-12 17:04:05 -07:00
Justin M. Keyes
44d45e29ea API/nvim_list_uis(): include "chan" field for TUI
Even though it's always zero currently, it's less confusing if all UIs
have the same fields.
2019-09-12 17:04:05 -07:00
Justin M. Keyes
6dd56d0902 UIAttach, UIDetach
doc: ginit.vim, gvimrc
fix #3656
2019-09-12 17:04:05 -07:00
Rui Abreu Ferreira
e9cf515888 UIAttach, UIDetach 2019-09-12 15:52:54 -07:00
Daniel Hahler
11fe132dd9
tests: fix system_spec when run with clipboard manager (#10956)
* tests: move os_kill to functional helpers

* tests: fix system_spec when run with clipboard manager

Replaces "xclip" with a dedicated helper program.

Fixes: https://github.com/neovim/neovim/issues/4900#issuecomment-501866842
2019-09-12 03:26:35 +02:00
Justin M. Keyes
7652904f79
eval: wait(): always spin up dummy-timer #10990
This avoids getting "stuck".  If user actually _wants_ to get stuck
forever, they could use `:sleep` or specify a really big `interval`.
2019-09-11 12:56:46 -07:00
Björn Linse
ffa029ad1c paste: fix paste in terminal mode 2019-09-11 20:12:29 +02:00
Justin M. Keyes
06bfb07e35 doc
fix #10127
fix #5972
2019-09-11 00:10:27 -07:00
Björn Linse
e11dd1110f terminal: fix rgb rendering of palette colors
simplify handling of default colors

nvim is always true color internally, remove ui_rgb_attached() check.

Fix "runtime termguicolors" test. The test actually reflected broken behavior
in (parent) nvim: nvim_ui_set_option("rgb", true) was not respected by existing
:terminal instances, so all 16-palette colors became dark blue.
2019-09-10 20:12:01 +02:00
Justin M. Keyes
853683e72a
provider: has("python3_dynamic") et al. #10980
Vim added more flags for testing yet more dimensions of its Python
situation.  Handle those in eval_has_provider().

vim-patch:8.0.1436: not enough information about what Python version may work
Problem:    Not enough information about what Python version may work.
Solution:   Add "python_compiled", "python3_compiled", "python_dynamic" and
            "python3_dynamic" values for has().

ref: https://github.com/neovim/neovim/pull/10942#issuecomment-529479500
2019-09-09 10:54:07 -07:00
Justin M. Keyes
05c668f684
paste: fix normal-mode paste by different approach #10976
Forcing insert-mode after the first paste-chunk seems to work, as an
alternative to a9e2bae0eb (insert-before-cursor).

NB: Dot-repeat needs to match the original action.  Since a9e2bae0eb
changed paste to insert-before-cursor, dot-repeat must also. But that
makes dot-repeat unpleasant/unusual.
2019-09-09 08:29:49 -07:00
Justin M. Keyes
9e0ce1a158 Merge #10973 'vim-patch:8.1.1197' 2019-09-08 20:58:36 -07:00
Jan Edmund Lazo
8dde9b58e5
vim-patch:8.1.1197: when starting with multiple tabs file messages is confusing
Problem:    When starting with multiple tabs file messages is confusing.
Solution:   Set 'shortmess' when loading the other tabs. (Christian Brabandt)
c75e812623
2019-09-08 23:16:54 -04:00
Justin M. Keyes
a9e2bae0eb paste: insert before cursor always
Inserting "after" the cursor in Normal-mode, for big paste-streams, is
not reliable: sometimes the text "after" the cursor ends up in the
middle of the pasted text.  Maybe the cursor position is not updated?

To avoid weird behavior, always paste "before".  Maybe nvim_put() or
vim.paste() can be fixed more properly later.
2019-09-08 16:42:11 -07:00
Justin M. Keyes
acd2729573 paste: do not clobber msg area for small pastes 2019-09-08 15:37:32 -07:00
Justin M. Keyes
0dea44f93c paste/cmdline: discard all chunks after first line
Problem:  If multiple paste "chunks" are streamed, chunks after the
          first line are pasted into the buffer.
Solution: Check for cmdline-mode for all chunks in a paste-stream.
2019-09-08 15:37:32 -07:00
Justin M. Keyes
d91f4cd7d0
paste: reset 'paste' option immediately #10974
- Workaround #10966: 'paste' option is not always reset.
- In any case there's not much reason to wait until phase=3, because
  pasting in cmdline-mode skips lines after the first line (thus the
  `:set paste .. :set nopaste` dance happens only ~once).
2019-09-08 14:58:47 -07:00
glacambre
958ca938b4 ex_getln.c: fix <S-Tab> not triggering pum when wildoptions=pum (#10042)
Some of the logic that was present for <Tab> was missing from <S-Tab>.

Closes https://github.com/neovim/neovim/issues/10042.
2019-09-08 20:47:22 +02:00
Björn Linse
288526ae73
Merge pull request #10475 from erw7/fix-ext-popupmenu
Fix some keys not working in ext_popupmenu
2019-09-08 20:42:32 +02:00
Björn Linse
c705e3fb0b update tests for new resize behavior (resize at pager, but not at :!cmd) 2019-09-08 15:24:14 +02:00
Daniel Hahler
fa90f6cdaa tests: fix flaky "TUI FocusGained/FocusLost in terminal-mode" #10754
* longer timeout with first expect
* Wait for :term to be ready

Failure seen on quickbuild (note the "retry() attempts: 1"):

    09:41:07,627  INFO  - # test/functional/terminal/tui_spec.lua @ 437: TUI FocusGained/FocusLost in terminal-mode
    09:41:07,627  INFO  - not ok 2976 - TUI FocusGained/FocusLost in terminal-mode
    09:41:07,627  INFO  - # test/functional/terminal/tui_spec.lua @ 437
    09:41:07,627  INFO  - # Failure message: ./test/functional/helpers.lua:403:
    09:41:07,627  INFO  - # retry() attempts: 1
    09:41:07,627  INFO  - # ./test/functional/ui/screen.lua:579: Row 1 did not match.
    09:41:07,627  INFO  - # Expected:
    09:41:07,627  INFO  - # |*{1:r}eady $ |
    09:41:07,627  INFO  - # |[Process exited 0] |
    09:41:07,627  INFO  - # | |
    09:41:07,627  INFO  - # | |
    09:41:07,627  INFO  - # | |
    09:41:07,627  INFO  - # |gained |
    09:41:07,628  INFO  - # |{3:-- TERMINAL --} |
    09:41:07,628  INFO  - # Actual:
    09:41:07,628  INFO  - # |*{1: } |
    09:41:07,628  INFO  - # |{4:~ }|
    09:41:07,628  INFO  - # |{4:~ }|
    09:41:07,628  INFO  - # |{4:~ }|
    09:41:07,628  INFO  - # |{5:[No Name] }|
    09:41:07,628  INFO  - # | |
    09:41:07,628  INFO  - # |{3:-- TERMINAL --} |
    09:41:07,628  INFO  - #
    09:41:07,628  INFO  - # To print the expect() call that would assert the current screen state, use
    09:41:07,628  INFO  - # screen:snapshot_util(). In case of non-deterministic failures, use
    09:41:07,628  INFO  - # screen:redraw_debug() to show all intermediate screen states.
    09:41:07,628  INFO  - # stack traceback:
    09:41:07,628  INFO  - #     ./test/functional/helpers.lua:403: in function 'retry'
    09:41:07,628  INFO  - #     test/functional/terminal/tui_spec.lua:441: in function <test/functional/terminal/tui_spec.lua:437>
2019-09-07 22:40:38 -07:00
erw7
55b1126a22 Add nvim_ui_pum_set_height to api 2019-09-08 12:25:49 +09:00
Abdelhakeem Osama
6692c0958f shada: initialize jumplist before search pattern (#10964)
Since 8b8ecf4, the shada module loads files in the jumplist to properly
clear duplicates. This can trigger some autocommands, which in turn
saves and restores search and substitute patterns, freeing the previous
strings in "spats" which are held in "wms" as well (heap-use-after-free).
To avoid this, initialize the jumplist in "wms" before search patterns.
2019-09-07 18:02:29 -07:00
Justin M. Keyes
7e1c959861 test: Eliminate expect_err
Eliminate `expect_err` in favor of `pcall_err` + `eq` or `matches`.
2019-09-06 17:19:07 -07:00
Justin M. Keyes
af946046b9 test: Rename meth_pcall to pcall_err
- Rename `meth_pcall`.
- Make `pcall_err` raise an error if the function does not fail.
- Add `vim.pesc()` to treat a string as literal where a Lua pattern is
  expected.
2019-09-06 17:19:07 -07:00
Björn Linse
fd4636f1b9
Merge pull request #10930 from bfredl/pagerthrottle
fixes for pager glitches and crashes
2019-09-06 20:28:26 +02:00
Björn Linse
837f31c0b4 test: properly test missing clears after scroll
NB: happened to be irrelevant to the present failure, which
only occured with the compositor and not exteral UI for some reason
2019-09-06 19:39:26 +02:00
Björn Linse
1fc6489f30 test: add tests for pager glitches and crashes 2019-09-06 19:38:27 +02:00
Daniel Hahler
fd8b00bacd tests: do_rmdir(): improve error handling #10955 2019-09-06 09:19:57 -07:00
Justin M. Keyes
8b06231612 Merge #10869 'vim-patch:8.1.{0309,0362,0365,0515,1946}' 2019-09-05 14:10:32 -07:00
Justin M. Keyes
096212d52c
test/wildmode_spec: fix flaky test (#10947)
* test/wildmode_spec: fix flaky test

a00eb23c27 fixed one race, but not this one:

    [  ERROR   ] test/functional/ui/wildmode_spec.lua @ 84: 'wildmenu' is preserved during :terminal activity
    test/functional/ui/screen.lua:587: Row 1 did not match.
    Expected:
      |*                         |
      |                         |
      |                         |
      |define  jump  list  >    |
      |:sign define^             |
    Actual:
      |*0: !terminal_output!     |
      |                         |
      |                         |
      |define  jump  list  >    |
      |:sign define^             |
    To print the expect() call that would assert the current screen state, use
    screen:snapshot_util(). In case of non-deterministic failures, use
    screen:redraw_debug() to show all intermediate screen states.
    stack traceback:
            test/functional/ui/screen.lua:587: in function '_wait'
            test/functional/ui/screen.lua:370: in function 'expect'
            test/functional/ui/wildmode_spec.lua:22: in function 'expect_stay_unchanged'
            test/functional/ui/wildmode_spec.lua:92: in function <test/functional/ui/wildmode_spec.lua:84>

* fixup! test/wildmode_spec: fix flaky test
2019-09-05 10:22:27 -07:00
Justin M. Keyes
607d610d06
test/shada_spec: avoid exit_event race #10951
Doing clear() multiple times in quick succession provokes the
`exit_event` race described in #8813.

- Avoid it by removing unnecessary reset() call.
- Replace unnecessary nested describe() blocks with it() blocks.

ref d4a0b6c4e1
2019-09-05 09:48:34 -07:00
Justin M. Keyes
dd18cc4b40 fixup! test/wildmode_spec: fix flaky test 2019-09-04 19:03:01 -07:00
Justin M. Keyes
93deb1a062 test/wildmode_spec: fix flaky test
a00eb23c27 fixed one race, but not this one:

    [  ERROR   ] test/functional/ui/wildmode_spec.lua @ 84: 'wildmenu' is preserved during :terminal activity
    test/functional/ui/screen.lua:587: Row 1 did not match.
    Expected:
      |*                         |
      |                         |
      |                         |
      |define  jump  list  >    |
      |:sign define^             |
    Actual:
      |*0: !terminal_output!     |
      |                         |
      |                         |
      |define  jump  list  >    |
      |:sign define^             |
    To print the expect() call that would assert the current screen state, use
    screen:snapshot_util(). In case of non-deterministic failures, use
    screen:redraw_debug() to show all intermediate screen states.
    stack traceback:
            test/functional/ui/screen.lua:587: in function '_wait'
            test/functional/ui/screen.lua:370: in function 'expect'
            test/functional/ui/wildmode_spec.lua:22: in function 'expect_stay_unchanged'
            test/functional/ui/wildmode_spec.lua:92: in function <test/functional/ui/wildmode_spec.lua:84>
2019-09-04 17:26:40 -07:00
Björn Linse
d5162afa2a anchor float to buffer position
vim-patch:8.1.1645: cannot use a popup window for a balloon
2019-09-04 23:57:02 +02:00
Daniel Hahler
d7aea13fee
tests: scrollback_spec: use shell-test instead of awk (#10914)
Ref: #10804
Ref: b64af88
2019-09-04 20:01:38 +02:00
Justin M. Keyes
fe60013fb9 test/mode_spec: increase 'matchtime' to fix flaky
fix #10941
regressed by 7ed2122622
2019-09-04 07:06:12 -07:00
Justin M. Keyes
540360a775
test: is_os() #10933
- Move os_name() up to "global helpers".
- Rename it to is_os().
- Make it depend on uname() instead of a running Nvim instance.
2019-09-04 06:58:04 -07:00
Björn Linse
e7e2c8d7ff
Merge pull request #10926 from blueyed/fix-echon-q
Check got_int in msg_multiline_attr with ex_echo
2019-09-04 15:31:56 +02:00
Daniel Hahler
4556bb90fa move test 2019-09-04 13:13:39 +02:00
Daniel Hahler
e867ac3e52 Check got_int in msg_multiline_attr
Fixes quitting the pager using `q`.

Fixes https://github.com/neovim/neovim/issues/10923.
2019-09-04 10:50:26 +02:00
erw7
4f6df65f02 Change test because maparg was changed to also return lnum 2019-09-04 13:40:04 +09:00
Justin M. Keyes
38806f23ed
test: enable "exit event follows stdout, stderr" [ci skip] #10929
- Update the test to work with changes since it was originally written.
- Keep the test pending() because it still fails:

      Expected objects to be the same.
      Passed in:
      (table: 0x50ce9e38) {
        [1] = {
          [1] = 'notification'
          [2] = 'stderr'
          [3] = {
            [1] = 0
            [2] = {
              [1] = '' } } }
       *[2] = {
          [1] = 'notification'
          [2] = 'stdout'
         *[3] = {
            [1] = 0
           *[2] = {
             *[1] = '' } } }
        [3] = {
          [1] = 'notification'
          [2] = 'exit'
          [3] = {
            [1] = 0
            [2] = 143 } } }
      Expected:
      (table: 0x50ce9870) {
        [1] = {
          [1] = 'notification'
          [2] = 'stderr'
          [3] = {
            [1] = 0
            [2] = {
              [1] = '' } } }
       *[2] = {
          [1] = 'notification'
          [2] = 'stdout'
         *[3] = {
            [1] = 0
           *[2] = {
             *[1] = 'abcdef' } } }
        [3] = {
          [1] = 'notification'
          [2] = 'stdout'
          [3] = {
            [1] = 0
            [2] = {
              [1] = '' } } } }
2019-09-03 10:25:27 -07:00
Abdelhakeem Osama
8b8ecf44f2 shada/context: fully remove jumplist duplicates #10898
- Always load files when cleaning up jumplist.
  - For Shada: avoids writing duplicate entries, which happens when you read
    from a shada file with duplicate entries (merging the jumplist while
    writing sometimes produces duplicate entries, bug?) and then write right
    away (i.e.: without any `:jumps`, `getjumplist()`, or any jump movement,
    that is: nothing that calls `cleanup_jumplist` with `loadfiles == true`).
  - For Context: avoids non-idempotent behavior for the same reason (i.e.:
    first call to `shada_encode_jumps` does not remove duplicate entries).

- Do not set pcmark when dumping jumplist for Context.
  - Retrieving current Context shouldn't add an entry to the jumplist
    (which will be removed by a subsequent `cleanup_jumplist` anyway, i.e.:
    tail entry matching current position), just act like `getjumplist` for
    instance.
2019-09-03 10:18:24 -07:00
Justin M. Keyes
58318af718 jobwait(): fix race if job exits before waiting on it
Problem:  If a job exits while waiting on another job, the on_exit
          handler is queued but f_jobwait() skips it.
Solution: Always do process_wait(), so that handlers are run during
          f_jobwait().

fix #8302

Test case:
    $ BUSTED_ARGS="--repeat=2000 --no-keep-going" TEST_FILE=test/functional/core/job_spec.lua TEST_FILTER=waiting make functionaltest

Failure example (macOS CI):
    FAILED  test/functional/core/job_spec.lua: jobs jobwait will run callbacks while waiting
    test/functional/core/job_spec.lua:606: Expected objects to be the same.
    Passed in:
    (table: 0x1be77c80) {
      [1] = 'notification'
      [2] = 'wait'
     *[3] = {
       *[1] = 3 } }
    Expected:
    (table: 0x1be77d10) {
      [1] = 'notification'
      [2] = 'wait'
     *[3] = {
       *[1] = 4 } }
    stack traceback:
      test/functional/core/job_spec.lua:606: in function <test/functional/core/job_spec.lua:583
2019-09-03 16:14:29 +02:00
Justin M. Keyes
a00eb23c27 test/wildmode_spec: fix flaky test
[  ERROR   ] test/functional\ui\wildmode_spec.lua @ 84: 'wildmenu' is preserved during :terminal activity
    test\functional\ui\screen.lua:587: Row 1 did not match.
    Expected:
      |*:sign                    |
      |*define    place          |
      |*jump      undefine       |
      |*list      unplace        |
      |*:sign ^                   |
    Actual:
      |*0: !terminal             |
      |*                         |
      |*^                         |
      |*~                        |
      |*                         |
    stack traceback:
        test\functional\ui\screen.lua:587: in function '_wait'
        test\functional\ui\screen.lua:370: in function 'expect'
        test/functional\ui\wildmode_spec.lua:22: in function 'expect_stay_unchanged'
        test/functional\ui\wildmode_spec.lua:103: in function <test/functional\ui\wildmode_spec.lua:84>
2019-09-03 16:14:29 +02:00
Justin M. Keyes
7233433f65 test/job_spec: improve visibility of flaky test
Test sometimes fails on macOS CI:

    FAILED  test/functional/core/job_spec.lua: jobs jobwait will run callbacks while waiting
    test/functional/core/job_spec.lua:606: Expected objects to be the same.
    Passed in:
    (table: 0x1be77c80) {
      [1] = 'notification'
      [2] = 'wait'
     *[3] = {
       *[1] = 3 } }
    Expected:
    (table: 0x1be77d10) {
      [1] = 'notification'
      [2] = 'wait'
     *[3] = {
       *[1] = 4 } }
    stack traceback:
      test/functional/core/job_spec.lua:606: in function <test/functional/core/job_spec.lua:583

Change the test to check if all jobs are starting, not only exiting.
2019-09-03 16:14:29 +02:00
Daniel Hahler
dcc8fcf0b9 tests: assert:set_parameter('TableFormatLevel', 100) #10925
luassert uses 3 by default, which is often not enough.

Instead of documenting how to increase it, let's use a more fitting
(sane) default of 100 levels.
2019-09-03 04:29:49 -07:00
Björn Linse
6434a0bf99
Merge pull request #10920 from bfredl/asyncfail
api: make try_end clean-up after an exception properly.
2019-09-02 23:02:58 +02:00
Björn Linse
7e07efaff4 api: make try_end clean-up after an exception properly. Fixes #10809
Otherwise `force_abort` will cause an emsg() higher on the stack
to be converted to an exception, even though it is outside any
try/catch.
2019-09-02 23:01:16 +02:00
Björn Linse
66f4e8aee0 screen: initialize screen properly with early set display-=msgsep
Currently `nvim -u NORC --cmd "set display-=msgsep"` will still allocate the
message grid and remove it just afterwards. While inefficient, we must
make sure update_screen() re-validates the default_grid completely when
this happens.

Fix some invalid logic: don't reallocate msg_grid on resize when the grid is not
used.

Elide a too early ui_flush() on startup, which caused an invalid cursor
position to be used.
2019-09-02 12:39:03 +02:00
Justin M. Keyes
099445cc07
Merge #10804 'CI/OpenBSD: functional tests' 2019-09-01 22:56:41 -07:00
Justin M. Keyes
ead39d6ce6 test/uname(): always lowercase 2019-09-01 22:49:33 -07:00