Commit Graph

2486 Commits

Author SHA1 Message Date
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
Justin M. Keyes
7d20907724 test/OpenBSD: skip some tests
Temporary workaround to unblock CI for OpenBSD.
2019-09-01 22:49:33 -07:00
Justin M. Keyes
605f05f635 test: shell-test.c: flush all streams 2019-09-01 22:49:33 -07:00
Justin M. Keyes
78ec7981c8 screen.lua: dump payload on handler failure
For debugging failures like:

    test/functional/helpers.lua:240: test/functional/ui/screen.lua:898:
    bad argument #1 to 'unpack' (table expected, got number)

    test/functional/helpers.lua:240: test/functional/ui/screen.lua:708:
    attempt to index local 'item' (a number value)

ref #10804
2019-09-01 22:49:33 -07:00
Justin M. Keyes
c062149d5b test: "can have two timers": retry()
ref #10768
2019-09-01 22:49:33 -07:00
Edd Barrett
b64af88c84 CI/OpenBSD: run functional tests
Adapt some tests for OpenBSD:

- scrollback_spec:
  - seq(1) is not available on OpenBSD: we'd use jot(1).
  - Instead use a (hopefully) portable awk(1) snippet.
- channels_spec
- job_spec
- tui_spec
2019-09-01 22:49:33 -07:00
Justin M. Keyes
299331490e
API: nvim_buf_set_lines: handle 'nomodifiable' #10910 2019-09-01 22:04:20 -07:00
Björn Linse
fb19aeeb33 API: make nvim_win_set_option() set window-global, not buffer-local #9110
NB: the `!(flags & SOPT_GLOBAL)` exception is for 'statusline'.
Because `:set statusline=...` sets the global value for _all_ windows,
`:setlocal` is the best we can do there. This is a one-of-a-kind option
that doesn't work like any other option.
2019-09-01 19:38:50 -07:00
Justin M. Keyes
976c6667e1 paste: one undo-block per stream
- All "chunks" in a paste-stream should form a single undo-block. Side
  effect of 7a85792884 was to create an undo-block for each chunk.
- Also: remove old :redraw force logic, irrelevant after 7a85792884.
2019-09-02 02:27:13 +02:00
Abdelhakeem
b447bdb68c fixup! eval: add wait() test 2019-09-01 21:17:14 +02:00