Commit Graph

3344 Commits

Author SHA1 Message Date
erw7
7acdc9da1d vim-patch:8.1.1033: memory usage test may still fail on some systems
Problem:    Memory usage test may still fail on some systems. (Elimar
            Riesebieter)
Solution:   Increase tolerance from 1% to 3%.
ba64ba0935
2020-05-07 16:48:08 +09:00
erw7
6175d974c2 vim-patch:8.1.1031: memory usage test may still fail
Problem:    Memory usage test may still fail.
Solution:   Drop the unused min value. (Christian Brabandt)
f7e47af776
2020-05-07 16:48:08 +09:00
erw7
9ad2ba1c5c vim-patch:8.1.1027: memory usage test sometimes fails
Problem:    Memory usage test sometimes fails.
Solution:   Use 80% of before.last as the lower limit. (Christian Brabandt)
08cda65ddf
2020-05-07 16:48:08 +09:00
erw7
1212390254 vim-patch:8.1.1007: using closure may consume a lot of memory
Problem:    Using closure may consume a lot of memory.
Solution:   unreference items that are no longer needed. Add a test. (Ozaki
            Kiichi, closes vim/vim#3961)
209b8e3e3b
2020-05-07 16:47:41 +09:00
Jesse
48c2198297
paste: support replace mode (#11945)
* paste: support replace mode
* Clean up

Co-authored-by: Jesse Bakker <git@jessebakker.com>
2020-05-05 13:18:41 +02:00
Justin M. Keyes
7b764bb43d terminal: disable 'scrolloff' (fixes flicker)
Besides the special-case in get_scrolloff_value(), it makes sense for
'scrolloff' and 'sidescrolloff' to reflect the correct values (for
plugins, scripts, …).

ref 53d607af9c53accfd634435908fb79061f1212b9
ref #11915
ref #12230
2020-05-04 21:21:33 -07:00
Mathias Fußenegger
2c40a38b39
LSP: Avoid URI-to-fname conversion for non-file URIs #12243
Fixes https://github.com/neovim/neovim/issues/12210
2020-05-04 20:06:40 -07:00
Matthieu Coudron
496b668ad1
Merge pull request #12237 from h-michael/vim-nil
lsp: text_document.version may be vim.NIL not nil
2020-05-04 09:53:00 +02:00
Hirokazu Hata
67634da714
lsp: add a lsp.util.apply_text_edits test(pending)
We don't handle non-ASCII characters well in UTF-16.
So I add a non-ASCII characters test case.
2020-05-04 09:05:16 +09:00
Hirokazu Hata
0107a194fa
lsp: fix apply_text_document_edit test
lsp.util.buf_versions must be set in advance.
Use helper.insert to create an anonymous buffer,
so create a named buffer for testing without using insert.
2020-05-04 08:10:27 +09:00
Hirokazu Hata
3eae7d52c5
lsp: add lsp.util.symbols_to_items test 2020-05-02 15:16:43 +09:00
ckipp01
6dc8398944 [LSP] check for vim.NIL and add apply_text_document_edit tests 2020-05-01 17:40:03 +02:00
Matthieu Coudron
42b441738d
Merge pull request #12204 from archseer/lsp-user-data
lsp/completion: Expose completion_item under completed_items.user_data + vim-patch:8.2.0084
2020-04-30 15:25:15 +02:00
Ghjuvan Lacambre
f9055c585f
LSP: enable using different highlighting rules for LSP signs (#12176)
This commit creates 4 new highlight groups:
- LspDiagnosticsErrorSign
- LspDiagnosticsWarningSign
- LspDiagnosticsInformationSign
- LspDiagnosticsHintSign

These highlight groups are linked to their corresponding LspDiagnostics
highlight groups by default.

This lets users choose a different color for their sign columns and
virtualtext diagnostics.
2020-04-29 16:53:13 +02:00
Blaž Hrastnik
e4a1be779b lsp/completion: Expose completion_item under completed_items.user_data.
By passing through completion_item it's now possible for snippet plugins
to add LSP snippet support.
2020-04-29 13:26:56 +09:00
Yatao Li
e34684b2ad api/ui: simplify popup menu position get/set logic; fix test 2020-04-28 01:54:16 +08:00
Yatao Li
d372c804aa api/ui: allow set bounds row and col to be less than 0; ui_pum_get_pos: return first extui bounds information instead of reducing 2020-04-28 01:52:01 +08:00
Yatao Li
ed6230434b gen_api_dispatch.lua: allow msgpack int for Float args; test: add ui_pum_set_bounds and tv_dict_add_float tests 2020-04-28 01:53:43 +08:00
Justin M. Keyes
34ad1ea366
Merge #12155 ':ls filter by terminal, lastused' 2020-04-26 23:57:37 -04:00
Mathias Fußenegger
50ff37308a
LSP: Fix show_line_diagnostics #12186
Messed this up in ef0398fe88
2020-04-26 14:56:30 -07:00
Mathias Fußenegger
ef0398fe88
LSP: Expose diagnostics grouped by bufnr (#11932)
Expose `vim.lsp.buf.diagnostics_by_buf`

This makes it easier to customize the diagnostics behavior. For example
to defer the update they can override the
`textDocument/publishDiagnostics` callback to only call
`buf_diagnostics_save_positions` and then defer the other actions to a
autocmd event.
2020-04-25 15:46:58 +02:00
erw7
6854680579
terminal: Fix mouse coordinates issue (#12158)
Offsets of window were not taken into account when sending mouse
coordinates to the terminal. Therefore, when nu or rnu is set, the mouse
coordinates sent to the terminal were not correct. Change it to send the
correct coordinates by subtract window offset from col.
2020-04-21 15:44:39 +02:00
Matthieu Coudron
9678fe4cfb
Merge pull request #11989 from Weypare/textEdit
LSP/completion: add textEdit support
2020-04-20 21:31:19 +02:00
Andrey Avramenko
49045b173e test: add docs for get_completion_word test 2020-04-20 20:20:14 +03:00
Andrey Avramenko
a0d2bfeeb5 test: add get_completion_word test for text_doc...
...ument_completion_list_to_complete_items
2020-04-20 18:35:54 +03:00
Rob Pilling
9d59f066cb vim-patch:8.0.1651: cannot filter :ls output for terminal buffers
Problem:    Cannot filter :ls output for terminal buffers.
Solution:   Add flags for terminal buffers. (Marcin Szamotulski, closes vim/vim#2751)
0751f51a5b
2020-04-19 20:18:41 +01:00
Tristan Konolige
bf0f745861
lua: allow deepcopy of functions (#12136) 2020-04-19 01:04:37 +02:00
Björn Linse
1fe0b329fe api/ui: win_viewport event for visible range and cursor position in window 2020-04-01 19:43:55 +02:00
Hirokazu Hata
4139678f97
vim.uri: fix uri_to_fname (#12059)
fix: #12056
If the colon of the drive letter of windows is URI encoded,
it doesn't match the expected pattern, so decode it first.
2020-03-30 14:30:24 +02:00
Matthieu Coudron
e700a88bb6
Merge pull request #11746 from Billy4195/add_wildmenu_key
[RFC] Wildmenu support C-E and C-Y as popupmenu
2020-03-28 14:25:54 +01:00
Björn Linse
4dabbc19d4 popupmenu: don't use 'rightleft' option in cmdline mode
Cmdline is always drawn from the left to right, so using rightleft
popupmenu is not useful here
2020-03-23 19:14:33 +01:00
erw7
9333f86ab7 TUI: do not use "nvim_get_option" in tui thread
Since "nvim_get_option" is executed on the tui thread as a C function
instead of msgpack-rpc, it accesses global variables that may change on the
main thread.
2020-03-21 18:06:59 +09:00
Will Eccles
87d892afa0
vim-patch:8.1.0864 Make 'scrolloff' and 'sidescrolloff' options window local (#11854)
Problem: cannot have a local value for 'scrolloff' and 'sidescrolloff'

Author: Bram Moolenar

375e339007
2020-03-17 20:05:34 +01:00
Matthieu Coudron
d22fd58629
Merge pull request #11716 from teto/folds_auto_backup
[RFC] foldcolumn autowidth
2020-03-02 13:56:27 +01:00
Hirokazu Hata
e35ff7371f
lua: add vim.tbl_len() #11889 2020-03-01 23:38:43 -08:00
Jan Edmund Lazo
eba8a9ca1d
vim-patch:8.1.1510: a plugin cannot easily expand a command like done internally
Problem:    A plugin cannot easily expand a command like done internally.
Solution:   Add the expandcmd() function. (Yegappan Lakshmanan, closes vim/vim#4514)
80dad48c50
2020-03-01 03:57:58 -05:00
Justin M. Keyes
1b0a770340 Merge #11805 'vim-patch:8.1.0619' 2020-02-29 17:37:15 -08:00
Hirokazu Hata
16262472cd
lsp: add 'textDocument/documentSymbol’ callback
Spec: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_documentSymbol
2020-03-01 09:10:02 +09:00
Jan Edmund Lazo
3c12ee333a
vim-patch:8.1.0619: :echomsg and :echoerr do not handle List and Dict
Problem:    :echomsg and :echoerr do not handle List and Dict like :echo does.
            (Daniel Hahler)
Solution:   Be more tolerant about the expression result type.
461a7fcfce

Add lua functional tests for :echo,:echon,:echomsg,:echoerr
because nvim did not port "test_" functions from Vim
that modify internal state.

Testing :echoerr via try/catch is sufficient.
2020-02-29 17:40:00 -05:00
Matthieu Coudron
1a2be57da3 foldcolumn: allow auto:X
Similar to signcolumn, allow foldcolumn to adapt itself to the number of
folds.

Regression:
vim supports a maximum fdc of 12, this limits it to 9.
2020-02-29 20:27:22 +01:00
Björn Linse
9c00fea585 lua: add regex support, and @match support in treesitter queries 2020-02-26 19:39:02 +01:00
Björn Linse
a380526c0f test: always use "set more" with :digraph test
otherwise we risk the same issue as with ex_cmds/digraphs_spec.lua
2020-02-19 13:08:12 +01:00
Hirokazu Hata
e2ed8053bf
lua: move test helper function, map and filter, to vim.shared module 2020-02-18 17:43:10 +09:00
Justin M. Keyes
b353a5c05f
test: always dump logs on failure #11886
Whenever `eq()`, `ok()`, etc. fails, include log tail in the failure
message. This helps to correlate log messages with a particular test
failure.
2020-02-16 23:30:24 -08:00
Justin M. Keyes
6e13b9d261 test/LSP: assert contents of log file 2020-02-16 22:09:28 -08:00
Justin M. Keyes
a446fbc8fa lsp/rpc.lua: fix env application function
Env vars must be merged with the current env.
2020-02-16 22:09:28 -08:00
Justin M. Keyes
4cf48dc329 test/LSP: dump logs on error
This will help debug CI flakey failures.

TODO: helpers.assert_log()  -- Explicitly check contents of the logfile.
2020-02-16 19:04:40 -08:00
Justin M. Keyes
1eb0f5371a LSP: fix validate_client_config
- `cmd_env` is a table not a function.
- tests: Set $NVIM_LOG_FILE for fake LSP server.
2020-02-16 17:53:33 -08:00
Justin M. Keyes
c15bd6cd27 test/LSP: use less-generic exit code
- os.exit(1) is too generic, since code 1 may be caused by Nvim exiting
  for some other reason.  Change it to os.exit(101).
- style: de-architect json_encode/json_decode calls.

Failure seen in travis macOS job:
https://travis-ci.org/neovim/neovim/jobs/647849133

    [  FAILED  ] test/functional/plugin/lsp_spec.lua@ 266 SP basic_init test should not send didOpen if the buffer closes before init
    test/functional/plugin/lsp_spec.lua:297: exit code
    Expected objects to be the same.
    Passed in:
    (number) 1
    Expected:
    (number) 0
    stack traceback:
      test/functional/plugin/lsp_spec.lua:297: in function 'on_exit'
      test/functional/plugin/lsp_spec.lua💯 in function 'test_rpc_server'
      test/functional/plugin/lsp_spec.lua:272: in function <test/functional/plugin/lsp_spec.lua:266>
2020-02-16 17:52:48 -08:00
Justin M. Keyes
b04165859d test: style 2020-02-16 17:24:21 -08:00
Björn Linse
dc0e534a91
Merge pull request #11864 from h-michael/deepcopy
lua: vim.deepcopy() and vim.tbl_extend() should preserve vim.empty_dict()
2020-02-15 18:10:48 +01:00
Matthieu Coudron
bb331a9b31
mouse.c: can click on multibyte foldopen/foldclose (#11863)
would previously only work with ascii fillchars.

Added a test.
2020-02-14 16:42:00 +01:00
Hirokazu Hata
cdb729b746
lua: add vim.tbl_extend and vim.deepcopy test 2020-02-14 22:36:21 +09:00
Hirokazu Hata
417fc6ccf7
lua: vim.deepcopy uses empty_dict() instead of {} for empty_dict()
fix: https://github.com/neovim/nvim-lsp/issues/94
2020-02-13 11:55:43 +09:00
Hirokazu Hata
032ede0203
test: add json_encode test for vim.empty_dict() 2020-02-12 21:08:12 +09:00
erw7
3557757a3c vim-patch:8.1.0092: prompt buffer test fails
Problem:    Prompt buffer test fails.
Solution:   Set 'nomodified' before closing the window. (Ozaki Kiichi,
            closes vim/vim#3051
71ef1ba5e9
2020-02-12 16:03:54 +09:00
erw7
783aecd501 vim-patch:8.1.0036: not restoring Insert mode if leaving prompt buffer with mouse
Problem:    Not restoring Insert mode if leaving a prompt buffer by using a
            mouse click.
Solution:   Set b_prompt_insert appropriately. Also correct cursor position
            when moving cursor to last line.
891e1fd894
2020-02-12 15:16:32 +09:00
erw7
3ca0343fb9 vim-patch:8.1.0032: BS in prompt buffer starts new line
Problem:    BS in prompt buffer starts new line.
Solution:   Do not allows BS over the prompt.  Make term_sendkeys() handle
            special keys. Add a test.
6b810d92a9
2020-02-12 15:16:32 +09:00
erw7
4813ad48cd vim-patch:8.1.0027: difficult to make a plugin that feeds a line to a job
Problem:    Difficult to make a plugin that feeds a line to a job.
Solution:   Add the nitial code for the "prompt" buftype.
f273245f64
2020-02-12 15:16:32 +09:00
Björn Linse
70c212e480 vim-patch:8.2.0235: draw error when an empty group is removed from 'statusline'
Problem:    Draw error when an empty group is removed from 'statusline'.
Solution:   Do not use highlighting from a removed group.
dbe5d361fe
2020-02-09 09:42:26 +01:00
Björn Linse
ef2e6522c5 tests: bail out on libdir just like $VIMRUNTIME, it cannot be calculated 2020-02-07 09:32:25 +01:00
Björn Linse
00c57c98df treesitter: add standard &rtp/parser/ search path for parsers 2020-02-07 09:22:55 +01:00
Björn Linse
c5b812c9ea env: try find library dir (like /usr[/local]/lib/nvim) and add it to &rtp 2020-02-07 09:22:55 +01:00
Björn Linse
7ce9a5c7da api: add nvim_get_runtime_file for finding runtime files 2020-02-07 09:22:55 +01:00
Björn Linse
459a362cc1 extmarks: fix crash due to invalid column values in inccommand preview
This used to use -1 and MAXCOL values. Make sure in range values are
used.
2020-02-02 10:50:48 +01:00
Hye Sung Jung
14a8b3b98c
doc: fix typos [ci skip] #11787 2020-01-30 22:56:34 -08:00
Axel Forsman
2538e61513
Fix shift change callbacks reading bad cursor (#11782)
Sloppy code inherited from Vim caused user scripts to be able
to observe the cursor line in an invalid intermediary state,
due to Neovim change callbacks being unbuffered unlike Vim listeners.

Manifested in Vimscript executed from the callback possibly erroring
when `:call`:ing any function,
due to the implicit range `curwin->w_cursor.lnum,curwin->w_cursor.lnum`
failing validation.

Fixed by deferring the call to `changed_lines()` until after
`curwin->w_cursor.lnum` gets its correct value.
2020-01-30 07:34:34 +01:00
Björn Linse
bfe84adb5a options: winhighlight: fix incorrect string equality test 2020-01-28 19:10:41 +01:00
Justin M. Keyes
1c3ca4f18f mksession: always unix slashes "/" for filepaths 2020-01-26 17:30:47 -08:00
Justin M. Keyes
1e103b3c12 mksession: simplify generated commands
Doing ":file …" immediately after is enough to fixup the :terminal
buffer name.

ref #5250
2020-01-26 17:13:00 -08:00
Alexandre Dubray
cf67f19ac2 mksession: restore same :term buf in split windows
Problem: When session-restore creates a terminal buffer with command
         like `:edit term://.//16450:/bin/bash`, the buffer gets
         a different name (depends on PID). Thus the later call to
         `bufexists('term://.//16450:/bin/bash)` will return false.
Solution: Force the buffer name with :file. This as least ensures
         the same buffer will show in multiple windows correctly, as
         expected when saving the session.  But it still has problems:
           1. the PID in the buffer name is bogus
           2. redundant :terminal buffers still hang around

fix #5250
2020-01-26 17:13:00 -08:00
Jan Edmund Lazo
08c5a874ab
vim-patch:8.1.1143: may pass weird strings to file name expansion
Problem:    May pass weird strings to file name expansion.
Solution:   Check for matching characters.  Disallow control characters.
8f130eda47
2020-01-26 17:38:30 -05:00
Björn Linse
6f073ccbf4
Merge pull request #11755 from bfredl/qf_msg
screen: add missing redraws after a message
2020-01-26 15:38:04 +01:00
Björn Linse
687fc527de screen: add missing redraws after a message 2020-01-26 13:45:20 +01:00
Chris LaRose
c6ff23d7a0 terminal: absolute CWD in term:// URI #11289
This makes it possible to restore the working directory of :terminal
buffers when reading those buffers from a session file.

Fixes #11288

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2020-01-26 00:24:42 -08:00
Billy Su
961c528afc ex_getln.c: wildmenu add cancel and apply ops 2020-01-23 12:12:42 +08:00
Björn Linse
91bd1ddf3b
Merge pull request #11740 from Billy4195/fix_jobstop
make jobstop() return 0 instead of throw error for already stopped job
2020-01-22 19:23:29 +01:00
Billy Su
041ec8997a Fix f_jobstop() failed loudly
The return value of jobstop()
@return 1 for valid job id
        0 for invalid id, including jobs have exited or stopped
2020-01-22 17:30:43 +08:00
akovaski
97dcc48c99 wildmode: fix wildmode=longest,full with pum #11690
With "wildmode=longest,full" + wildoptions=pum, wildmode should show
popupmenu after Tab-Tab, not the horizontal wildmenu.

Fixes #11622
2020-01-21 00:35:01 -08:00
Jan Edmund Lazo
7853b61786
provider/perl: test older versions 2020-01-20 19:44:00 -05:00
Jan Edmund Lazo
ff9f70a6bf
provider/perl: skip tests on Windows
It worked for MINGW builds at one point
but it keeps failing now because of perl dependencies
or nvim session issues for tests (named pipes as sockets on Windows?).
2020-01-20 19:43:59 -05:00
Jan Edmund Lazo
3420bd21e1
provider/perl: add basic tests 2020-01-20 19:43:59 -05:00
butwerenotthereyet
f245c0218a tabpage: "tabnext #" switches to previous tab #11734 2020-01-20 15:14:51 -08:00
Björn Linse
48a869dc6d shed biking: it's always extmarks, never marks extended 2020-01-20 19:36:35 +01:00
Justin M. Keyes
270cd623ef
Merge #11735 ':tabs : show # for previous tabpage' 2020-01-19 22:25:53 -08:00
We're Yet
8e385eb46a tabpage: :tabs indicates previous tabpage's curwin 2020-01-19 14:30:12 -08:00
Justin M. Keyes
156c25e498 WinClosed: sort auevents.lua; improve tests
- test: reduce verbosity, condense redundancy, improve readability
- auevents.lua: keep events sorted by name. ref afd1d412fa
2020-01-18 21:32:14 -08:00
notomo
2b8e66c6ce autocmd: WinClosed exposes window id as <afile> 2020-01-18 17:06:03 -08:00
Marcos ALMEIDA
757aad92e8 autocmd: add WinClosed event
- only fire once, just before freeing mem
- trigger when on a different buffer
- avoid recursive calls in another tab
2020-01-18 17:06:03 -08:00
Björn Linse
b4a92aadd2 messages: echo "line1\r\nline2" should not clear line1 2020-01-16 19:35:45 +01:00
Björn Linse
ca1a00edd6 extmarks/bufhl: reimplement using new marktree data structure
Add new "splice" interface for tracking buffer changes at the byte
level. This will later be reused for byte-resolution buffer updates.
(Implementation has been started, but using undocumented "_on_bytes"
option now as interface hasn't been finalized).

Use this interface to improve many edge cases of extmark adjustment.
Changed tests indicate previously incorrect behavior. Adding tests for
more edge cases will be follow-up work (overlaps on_bytes tests)

Don't consider creation/deletion of marks an undoable event by itself.
This behavior was never documented, and imposes  complexity for little gain.

Add nvim__buf_add_decoration temporary API for direct access to the new
implementation. This should be refactored into a proper API for
decorations, probably involving a huge dict.

fixes #11598
2020-01-16 12:36:10 +01:00
Björn Linse
55677ddc46 Add new marktree data structure for storing marks
This is inspired by Atom's "marker index" data structure to efficiently
adjust marks to text insertions deletions, but uses a wide B-tree
(derived from kbtree) to keep the nesting level down.
2020-01-14 12:57:31 +01:00
Daniel Hahler
3d1531aee5
API: include invalid buffer/window/tabpage in error message (#11712) 2020-01-14 09:21:10 +01:00
Matthew Malcomson
dfb676fe0d edit.c: Ensure undo sync when emulating <Esc>x #11706
After PR #8226 an unmapped META key in insert mode behaves like
ESC-<key> (:help i_META).

The behaviour does not fully match, since if <Esc>-<key> is pressed
manually then since it were pressed manually `gotchars` would be called
on the second <key> after insert-mode had already been left.

This would mean that `may_sync_undo` (called from `gotchars`) would
call `u_sync(FALSE)` on the second key (since we would be in normal
mode).

This overall means that <Meta-[something]> behaves differently with
respect to undo than <Esc>[something] when the [something] makes a
change.

As an example, under `nvim -u NONE`:
ihello<M-.>u

leaves the buffer empty, while
ihello<Esc>.u

leaves the buffer with one instance of `hello`.

- Fix by calling u_sync() manually in the new clause under
  `normalchar:` in `insert_handle_key`.
- Update test in tui_spec.lua that accidentally relied on the old behaviour.
2020-01-12 17:09:39 -08:00
butwerenotthereyet
29b1a4761a tabpage: disallow go-to-previous in cmdline-win #11692
After cbc8d72fde when editing
the command in the command editing window (q:, q/, q?) it was possible
to switch to the previous tab.  Doing so put Nvim in a bad state.
Moreover, switching tabs via the other available mechanisms (gt, gT,
<C-W>gt, <C-W>gT) is not possible when in the command editing window.

Here, the behavior is prevented.  It is no longer possible to switch to
the previous tab when editing the command in the command editing window.
The solution is to share code between gt, gT, and g<Tab>.  Specifically,
goto_tabpage_lastused now calls through goto_tabpage rather than
directly calling goto_tabpage_tp.  Doing so works well because all the
validation enjoyed by gt and gT is present in goto_tabpage.
2020-01-09 07:31:16 -08:00
Justin M. Keyes
0a1c6d9a37 LSP: highlight groups test, doc 2020-01-08 22:18:18 -08:00
Justin M. Keyes
8c8681d594 test: hoist buf_lines() 2020-01-08 09:41:41 -08:00
Justin M. Keyes
844cd9cef1 test: just say no to hyper-granularity
- Move plugin/lsp/* to plugin/*
- Merge lsp/util_spec.lua into lsp_spec.lua
2020-01-08 09:30:59 -08:00
kevinhwang91
831fa45ad8 API: nvim_get_hl_by_id: omit hl instead of returning -1 #11685
Problem: When Normal highlight group defines ctermfg/bg, but other
         highlight group lacks ctermfg/bg, nvim_get_hl_by_id(hl_id,
         v:false) returns -1 for the missing ctermfg/bg instead of just
         omitting it.
Solution: checking for -1 in hlattrs2dict()

fix #11680
2020-01-08 06:19:23 -08:00
Jan Edmund Lazo
3c764aabb5
vim-patch:8.1.1308: the Normal highlight is not defined when compiled with GUI
Problem:    The Normal highlight is not defined when compiled with GUI.
Solution:   Always define Normal. (Christian Brabandt, closes vim/vim#4072)
f90b6e03a9
2020-01-06 00:18:02 -05:00
Jan Edmund Lazo
1aacab49ea
vim-patch:8.1.1579: dict and list could be GC'ed while displaying error
Problem:    Dict and list could be GC'ed while displaying error in a timer.
            (Yasuhiro Matsumoto)
Solution:   Block garbage collection when executing a timer.  Add
            test_garbagecollect_soon(). Add "no_wait_return" to
            test_override(). (closes vim/vim#4571)
adc6714aac
2020-01-05 10:40:53 -05:00
We're Yet
a7b6b37519 vim-patch:8.1.0974: cannot switch from terminal window to previous tabpage
Problem:    Cannot switch from terminal window to previous tabpage.
Solution:   Make CTRL-W gT move to previous tabpage.
882d02eeb5
2020-01-03 06:02:10 -08:00
We're Yet
42aa876488 vim-patch:8.1.0972: cannot switch from terminal window to next tabpage
Problem:    Cannot switch from terminal window to next tabpage.
Solution:   Make CTRL-W gt move to next tabpage.
72e83c1ae5
2020-01-03 06:01:47 -08:00
butwerenotthereyet
cbc8d72fde tabpage: track last-used tabpage #11626
In a multi-window scenario, it is possible to return focus to the last
accessed window via n_CTRL-W_p.  However, in the case of a multi-tab
scenario, there was previously no way to return focus to the last
accessed *tab*.  Here, that ability is added via n_g<tab>.

Additionally, the index of the previous tab is exposed via
tabpagenr('#'), mirroring the existing functionality of winnr('#').
2020-01-02 06:06:11 -08:00
Björn Linse
ea4127e9a7 lua: metatable for empty dict value 2020-01-01 19:26:29 +01:00
Justin M. Keyes
a251b588ac
Merge #11642 'CI: test powershell core' 2020-01-01 06:36:10 -08:00
Justin M. Keyes
8b84119650 LSP: eliminate lsp.stop_all_clients()
Reduce API surface.  We don't need so many variations of functions. Too
many functions means verbose, largely redundant documentation, tests,
and cognitive burden.
2019-12-31 15:39:17 -08:00
Jan Edmund Lazo
1836853955
ci: test powershell core on Linux 2019-12-31 15:11:08 -05:00
Justin M. Keyes
93e7c7e3bd doc [ci skip] 2019-12-31 02:25:10 -08:00
Jan Edmund Lazo
ebd5c2cdda
ui: add basic tests for pumheight,pumwidth 2019-12-29 23:16:52 -05:00
Jan Edmund Lazo
1d3d84fe81
vim-patch:8.1.0554: popup menu overlaps with preview window
Problem:    Popup menu overlaps with preview window.
Solution:   Adjust the height computation. (Hirohito Higashi, closes vim/vim#3414)
614ab8aa00

Cherry-picked "row -> pum_win_row" rename changes from patch 8.1.0062.
2019-12-29 18:34:04 -05:00
Jan Edmund Lazo
51c9e3c4d1
vim-patch:8.0.1538: popupmenu is too far left when completion is long
Problem:    Popupmenu is too far left when completion is long. (Linwei)
Solution:   Adjust column computations. (Hirohito Higashi, closes vim/vim#2661)
bb008dd323
2019-12-29 18:34:04 -05:00
Jan Edmund Lazo
703ed11c97
vim-patch:8.0.1491: the minimum width of the popup menu is hard coded
Problem:    The minimum width of the popup menu is hard coded.
Solution:   Add the 'pumwidth' option. (Christian Brabandt, James McCoy,
            closes vim/vim#2314)
a8f04aa275
2019-12-29 18:15:46 -05:00
Ashkan Kiani
34a59242a0 Revert "runtime: Add vim.lsp.get_client_by_name" #11623
reverts 680693e263 #11603
2019-12-29 09:05:32 +01:00
Hirokazu Hata
680693e263 runtime: Add vim.lsp.get_client_by_name (#11603)
Since the client name is more obvious than the client id for the user, add an
API to get the lsp client by the client name.
2019-12-28 09:28:00 -08:00
Ashkan Kiani
52566dd780 LSP: Fix flaky test #11618 2019-12-27 12:20:17 +01:00
Justin M. Keyes
b0196586de
Merge #11568 'fillchars: foldopen, foldsep, foldclose' 2019-12-26 07:06:43 +01:00
Matthieu Coudron
bbad324b17 fillchars: adding foldopen, foldsep, foldclose
You can try it with
set fillchars+=foldopen:▾,foldsep:│,foldclose:▸
2019-12-25 14:28:36 +01:00
Daniel Hahler
b3686b1597 system(), jobstart(): raise error on non-executable #11234
* tv_to_argv: error when cmd is not executable
  Callers always assume that emsg was emitted:
  - https://github.com/neovim/neovim/blob/57fbf288/src/nvim/eval.c#L12509
  - https://github.com/neovim/neovim/blob/57fbf288/src/nvim/eval.c#L17923
  - https://github.com/neovim/neovim/blob/57fbf288/src/nvim/eval.c#L18202
* test/functional/provider: display reason from missing_provider
* provider#node#Detect: skip / handle non-existing node executable
2019-12-24 07:53:56 +01:00
Björn Linse
9e9dcd4bd7
Merge pull request #11113 from bfredl/tree-sitter-query
tree-sitter step 2: query API and  highlighting prototype
2019-12-22 13:47:45 +01:00
Björn Linse
440695c296 tree-sitter: implement query functionality and highlighting prototype [skip.lint] 2019-12-22 12:51:46 +01:00
Daniel Hahler
e1d63c180c
tests: ex_terminal_spec: retry ":terminal (with fake shell)" (#11588)
Flaky failure (Travis CI, macOS):

    [ RUN      ] :terminal (with fake shell) works with gf: 10518.41 ms FAIL
    test/functional/terminal/ex_terminal_spec.lua:248: Row 1 did not match.
    Expected:
      |*^ready $ echo "scripts/shadacat.py"                |
      |*                                                  |
      |*[Process exited 0]                                |
      |:terminal echo "scripts/shadacat.py"              |
    Actual:
      |*^                                                  |
      |*[Process exited 0]                                |
      |*                                                  |
      |:terminal echo "scripts/shadacat.py"              |
    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:579: in function '_wait'
            test/functional/ui/screen.lua:361: in function 'expect'
            test/functional/terminal/ex_terminal_spec.lua:248: in function <test/functional/terminal/ex_terminal_spec.lua:245>
2019-12-22 11:23:39 +01:00
Matthieu Coudron
65aca4d857 TUI: can make the cursor transparent #11519
when setting 'guicursor' highlight blend=100.
2019-12-19 12:27:21 -08:00
Jan Edmund Lazo
ad5049aa60
vim-patch:8.2.0010: test64 is old style
Problem:    Test64 is old style.
Solution:   Convert to new style test. (Yegappan Lakshmanan, closes vim/vim#5363)
f9cb05c147
2019-12-16 19:38:29 -05:00
James McCoy
9f3d483c79
Merge pull request #7202 from teto/jobstart_env
[RFC] override environment for jobstart
2019-12-13 06:52:48 -05:00
James McCoy
91b313a904
Add negative test for type of job's env option 2019-12-12 07:57:27 -05:00
Matthieu Coudron
f3fcaedfad
test: new test for setting environment 2019-12-11 21:06:42 -05:00
butwerenotthereyet
39094b3fae jumplist: browser-style (or 'tagstack') navigation #11530
Traditionally, when navigating to a specific location from the middle of
the jumplist results in shifting the current location to the bottom of
the list and adding the new location after it.  This behavior is not
desireable to all users--see, for example
https://vi.stackexchange.com/questions/18344/how-to-change-jumplist-behavior.

Here, another jumplist behavior is introduced.  When jumpoptions (a new
option set added here) includes stack, the jumplist behaves like the
tagstack or like history in a web browser.  That is, when navigating to
a location from the middle of the jumplist

    2 first
    1 second
    0 third <-- current location
    1 fourth
    2 fifth

to a new location the locations after the current location in the jump
list are discarded

    2 first
    1 second
    0 third
            <-- current location

The result is that when moving forward from that location, the new
location will be appended to the jumplist:

    3 first
    2 second
    1 third
    0 new

If the new location is the same

  new == second

as some previous (but not immediately prior) entry in the jumplist,

    2 first
    1 second
    0 third <-- current location
    1 fourth
    2 fifth

both occurrences preserved

    3 first
    2 second
    1 third
    0 second (new)

when moving forward from that location.

It would be desireable to go farther and, when the new location is the
same as the location that is currently next in the jumplist,

    new == fourth

make the result of navigating to the new location by jumping (e.g. 50gg)
be the same as moving forward in the jumplist

    2 first
    1 second
    0 third
    1 new <-- current location
    2 fifth

and simply increment the jumplist index.  That change is NOT part of
this patch because it would require passing the new cursor location to
the function (setpcmark) from all of its callees.  That in turn would
require those callees to know *before* calling what the new cursor
location is, which do they do not currently.
2019-12-10 00:56:56 -08:00
Ashkan Kiani
0e6c6261e1
Fix access on vim.wo (#11517)
* Add more tests for vim.wo
2019-12-07 03:34:02 -08:00
Justin M. Keyes
3aa95ef27e
defaults: set nostartofline (#11135)
Having the cursor change column can be surprising.

Force startofline in functional and old tests.
Remove the functional breakindent test, as it's a subset of the oldtest one.
2019-12-03 20:58:03 -08:00
Matthieu Coudron
4598e489c7
test: always pass a string to expect_msg_seq
Seems like pcall doesn't always return a string as a 2nd element of the tuple.
2019-12-03 23:51:30 -05:00
Matthieu Coudron
3beef8ee1c defaults: set nostartofline
Having the cursor change column can be surprising.

Force startofline in functional and old tests.
Remove the functional breakindent test, as it's a subset of the oldtest one.
2019-12-03 13:31:17 +01:00
Justin M. Keyes
a3b6c2a3dc API: rename nvim_execute_lua => nvim_exec_lua
- We already find ourselves renaming nvim_execute_lua in tests and
  scripts, which suggests "exec" is the verb we actually want.
- Add "exec" verb to `:help dev-api`.
2019-12-02 22:06:42 -08:00
Justin M. Keyes
c34130d13a API: deprecate nvim_command_output 2019-12-02 20:52:06 -08:00
Daniel Hahler
22b52dd462
log_init: call log_path_init (#11501)
This has to be done after `init_homedir` for XDG default and `set_init_1` for
lookup from env, which could be done earlier likely (to help with
https://github.com/neovim/neovim/issues/10937), but this keeps it in
sync with Vim.

Fixes https://github.com/neovim/neovim/issues/11499.
2019-12-02 22:21:15 +01:00
Daniel Hahler
0b7a7b23cc
oldtest: support for running by filename (#11473)
Follow-up to 8969efca8 (Vim patch 8.1.0723)

NOTE: This changes the main entrypoint for running single oldtest files
to not use/require the ".res" extension anymore.  But it is handled for
B/C.

Adds a phony rule to run oldtest by filename.
Not going through "$(MAKE)" avoids GNUmakefile being used then (which I
use for WIP things), and it seems like SINGLE_MAKE should be used anyway
probably.
2019-12-02 17:18:37 +01:00
erw7
ab860cb5f6 dictwatcher: fix use-after-free #11495
fixes #11494
2019-12-02 02:09:30 -08:00
Justin M. Keyes
b1991f66d5 API: rename nvim_source => nvim_exec
- Eliminate nvim_source_output(): add boolean `output` param to
  nvim_exec() instead.
2019-12-01 22:35:15 -08:00
Vikram Pal
bd43e011b5 API: nvim_source_output
- Similar to nvim_source but will capture the output
- Add meaningful VimL tracebacks for nvim_source
- Handle got_int
- Add error reporting
2019-12-01 19:07:57 -08:00
Justin M. Keyes
276c2da286 API: nvim_source: fix multiline input
- DOCMD_REPEAT is needed to source all lines of input.
- Fix ":verbose set {option}?" by handling SID_STR in get_scriptname().

closes #8722
2019-12-01 16:09:24 -08:00
Siddhant Gupta
6aa03e86da API: nvim_source 2019-12-01 16:09:24 -08:00
Ashkan Kiani
70b6061666
Add vim.startswith and vim.endswith (#11248) 2019-12-01 05:32:55 -08:00
Ashkan Kiani
e6da21d128
Add vim.cmd as an alias for nvim_command (#11446) 2019-12-01 05:28:53 -08:00
Ashkan Kiani
edca84cfc9
Return nil instead of NIL for vim.env (#11486) 2019-12-01 05:04:57 -08:00
Justin M. Keyes
a17ccb0d24
screen.lua: remove screen:_on_event #11488
Tests can redefine the handlers, so we don't need this extra hook.
2019-12-01 01:06:10 -08:00
Justin M. Keyes
f6e7857c54
floatwin: show error if window is closed immediately #11476
Autocmds may close window while it is being entered, then
win_set_minimal_style(wp) operates on an invalid pointer.

We could silently ignore this instead, but it is unlikely to be
intentional, so it is more useful to show an error.

fix #11383
2019-11-29 23:48:14 -08:00
erw7
1bb7ea189e win_line: Fix crash with 'rightleft' in :terminal #11460
fixes #11438

Backtrace:

    0  schar_from_ascii ( p=0x801cc9e112c3 <error: Cannot access memory at address 0x801cc9e112c3>, c=32 ' ') at ../src/nvim/screen.c:5263
    1  0x00007f31460eccc5 in win_line (wp=wp@entry=0x7fffc9df6230, lnum=lnum@entry=11, startrow=startrow@entry=10, endrow=41, nochange=false, number_only=number_only@entry=false) at ../src/nvim/screen.c:4025
    2  0x00007f31460eed8e in win_update (wp=wp@entry=0x7fffc9df6230) at ../src/nvim/screen.c:1403
    3  0x00007f31460f011f in update_screen (type=<optimized out>) at ../src/nvim/screen.c:502
    4  0x00007f3146138ef4 in normal_redraw (s=s@entry=0x7fffd0a5f700) at ../src/nvim/normal.c:1247
    5  0x00007f314613b159 in normal_check (state=0x7fffd0a5f700) at ../src/nvim/normal.c:1324
    6  0x00007f31460accfe in state_enter (s=0x7fffd0a5f700) at ../src/nvim/state.c:28
    7  0x00007f3146143099 in normal_enter (cmdwin=<optimized out>, noexmode=<optimized out>) at ../src/nvim/normal.c:463
    8  0x00007f314618b541 in main (argc=<optimized out>, argv=<optimized out>) at ../src/nvim/main.c:580
2019-11-28 20:09:03 -08:00
Brian Wignall
001e69cd46 doc: fix typos
close #11459
2019-11-27 22:47:25 -08:00
Björn Linse
5f9209389b
Merge pull request #11445 from bfredl/fcslcs
options: make 'fillchars' and 'listchars' global-local instead of local-only
2019-11-26 22:10:13 +01:00
Björn Linse
49a40f425d options: make 'fillchars' and 'listchars' global-local
These options were previously global. A global-local window option
behaves closer to a global option "per default" (i e with :set),
but still supports local behavior via :setl

Also this restores back-compat for nvim_set_option("fcs", ...)
which are currently broken on 0.4.x but worked in earlier versions
2019-11-26 19:14:54 +01:00
Björn Linse
a76a669ac2 lua: make vim.wo and vim.bo used nested indexing for specified handle
Also missing option should be an error. Options are functionality,
not arbitrary variable names (as for vim.g)
2019-11-26 18:44:36 +01:00
Justin M. Keyes
36d1335a66
UI: emit mouse_on/mouse_off on attach #11455
closes #11372
2019-11-25 08:56:42 -08:00
notomo
4a77df2e51 [RFC] extmark: fix E315 in nvim_buf_set_extmark (#11449)
extmark: need to use buf instead of curbuf
2019-11-25 16:50:30 +01:00
Justin M. Keyes
fd5710ae9a
doc + extmarks tweaks #11421
- nvim_buf_get_extmarks: rename "amount" => "limit"
- rename `set_extmark_index_from_obj`
2019-11-25 01:08:02 -08:00
Ashkan Kiani
b78fdd7ce5 Merge branch 'master' into lsp-followup 2019-11-24 02:29:23 -08:00
Ashkan Kiani
d0d38fc36e Lua: vim.env, vim.{g,v,w,bo,wo} #11442
- Add vim variable meta accessors: vim.env, vim.{g,v,w,bo,wo}
- Redo gen_char_blob to generate multiple blobs instead of just one
  so that multiple Lua modules can be inlined.
- Reorder vim.lua inclusion so that it can use previously defined C
  functions and utility functions like vim.shared and vim.inspect things.
- Inline shared.lua into nvim, but also keep it available in runtime.
2019-11-24 02:28:48 -08:00
Ashkan Kiani
42c53d266a Merge remote-tracking branch 'origin/master' into lsp-followup 2019-11-23 14:28:54 -08:00
Björn Linse
7d5988feee tests: remove irrelevant timing info 2019-11-23 21:26:16 +01:00
Björn Linse
ddf509c2ba test was wrong 2019-11-23 16:46:47 +01:00
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