Commit Graph

2881 Commits

Author SHA1 Message Date
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
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
Abdelhakeem
2d3f39c729 eval: add wait() test 2019-09-01 21:17:14 +02:00
Björn Linse
9df3a676e7
Merge pull request #10400 from bfredl/msg_grid
Dedicated message grid.
2019-09-01 20:25:36 +02:00
Justin M. Keyes
2c1749ce44 test: assert_alive() 2019-09-01 09:03:46 -07:00
Justin M. Keyes
f63d952ca2 test: use shell-test (avoid system shell) 2019-09-01 09:03:46 -07:00
Justin M. Keyes
641c5b3f08 test/inccommand_spec: avoid indeterminism
- Use shell-test.c to avoid the squishiness of system shells.
- Use screen:expect_unchanged() to avoid hardcoded (brittle) test.

Fails correctly if 5020daa6e5 is reverted (remove terminal_check(),
restore redraw() in refresh_timer_cb()):

    [  ERROR   ] test/functional/ui/inccommand_spec.lua @ 2550: :substitute with inccommand during :terminal activity
    test/functional/helpers.lua:402:
    retry() attempts: 2
    test/functional/ui/screen.lua:579: Row 8 did not match.
    Expected:
      |foo bar baz                   |
      |bar baz fox                   |
      |bar foo baz                   |
      |{15:~                             }|
      |{15:~                             }|
      |{15:~                             }|
      |{11:[No Name] [+]                 }|
      |*26: xxx                       |
      |27: xxx                       |
      |28: xxx                       |
      |29: xxx                       |
      |30: xxx                       |
      |                              |
      |{10:term                          }|
      |:%s/foo/ZZZ^                   |
    Actual:
      |foo bar baz                   |
      |bar baz fox                   |
      |bar foo baz                   |
      |{15:~                             }|
      |{15:~                             }|
      |{15:~                             }|
      |{11:[No Name] [+]                 }|
      |*107: xxx                      |
      |108: xxx                      |
      |109: xxx                      |
      |110: xxx                      |
      |111: xxx                      |
      |                              |
      |{10:term                          }|
      |:%s/foo/ZZZ^                   |
2019-09-01 09:03:46 -07:00
Björn Linse
e04b9e7c78 test/ui: update tests for new msg_grid implementation 2019-09-01 15:55:10 +02:00
Björn Linse
27786df6a3 test/ui: make screen:expect() print full state when height does not match 2019-09-01 13:21:40 +02:00
Björn Linse
dff06a90e4 api: make nvim_put support "\022{NUM}" regtype as returned by getregtype() 2019-08-31 09:20:24 +02:00
Björn Linse
7a85792884 tui/input: defer nvim_paste properly.
Otherwise cursor and redraw code for normal and insert mode will not run. The
"tickle" workaround was used for this instead, and can now be removed.

The builtin vim.lua got the name
[string "-- Nvim-Lua stdlib: thevimmodule (:help l..."]
in error messages. Fix it to something reasonable.
2019-08-31 09:20:24 +02:00
Justin M. Keyes
f5fd699c52 test: vim.paste() cancel 2019-08-30 08:33:14 +02:00
Justin M. Keyes
b6192a9920 API: nvim_paste: add crlf parameter 2019-08-30 08:33:14 +02:00
Daniel Hahler
4b8a16153e
tests: check_logs: improve error message (#10887)
Before:

    [  ERROR   ] test/functional/helpers.lua @ 812: after_each
    test/helpers.lua:156: assertion failed!
    stack traceback:
            test/helpers.lua:156: in function 'check_logs'
            test/functional/helpers.lua:816: in function <test/functional/helpers.lua:812>
2019-08-30 08:26:55 +02:00
Daniel Hahler
bf85023005 shell-test: remove REP_NODELAY, less delay with REP
REP_NODELAY was added because REP delayed too much.  This changes REP to
only add a delay on every 100th line instead.

This helps to cover the additional pulse steps with
out_data_decide_throttle, which would have required to change
REP_NODELAY anyway.
2019-08-30 07:12:46 +02:00
Justin M. Keyes
9f81acc076
paste: break lines at CR, CRLF #10877
Some terminals helpfully translate \n to \r.

fix #10872
ref #10223
2019-08-29 23:45:02 +02:00
Daniel Hahler
00d46f6328
Fix test/busted/outputHandlers/TAP.lua (#10881)
Extending the original TAP handler was not working as expected.
This adds a new function for displaying the log.

Ref: https://github.com/neovim/neovim/pull/10876
2019-08-29 22:11:51 +02:00
Daniel Hahler
6cc76194b2
tests: use runtime from build for doc/tags with :help (#10479)
This is better practice in general, and allows to remove the "helptags
ALL" hacks.

Ref: https://github.com/neovim/neovim/issues/8824
Ref: https://github.com/neovim/neovim/commit/f1b67c3453c

* Makefile: fix dependencies with regard to helptags

- use the file as the main target to avoid unnecessary triggering
- use "make oldtest" on Travis to ensure it gets built
2019-08-28 22:47:54 +02:00
Justin M. Keyes
3157baed83 API: TRY_WRAP() for "abort-causing non-exception errors"
- Introduce TRY_WRAP() until we have an *architectural* solution.
  - TODO: bfredl idea: prepare error-handling at "top level" (nv_event).
- nvim_paste(): Revert luaeval() hack (see parent commit).
  - With TRY_WRAP() in nvim_put(), 'nomodifiable' error now correctly
    "bubbles up".
2019-08-28 00:55:13 +02:00
Justin M. Keyes
46aa254bf3 paste: handle 'nomodifiable'
- nvim_paste(): Marshal through luaeval() instead of nvim_execute_lua()
  because the latter seems to hide some errors.
- Handle 'nomodifiable' in `nvim_put()` explicitly.
- Require explicit `false` from `vim.paste()` in order to "cancel",
  otherwise assume true ("continue").
2019-08-27 23:37:15 +02:00
Justin M. Keyes
87389c6a57 paste: make vim.paste() "public" 2019-08-27 22:14:52 +02:00
Justin M. Keyes
ed60015266 paste: handle vim.paste() failure
- Show error only once per "paste stream".
- Drain remaining chunks until phase=3.
- Lay groundwork for "cancel".
- Constrain semantics of "cancel" to mean "client must stop"; it is
  unrelated to presence of error(s).
2019-08-27 22:13:45 +02:00
Justin M. Keyes
5b41070c63 paste: implement redo (AKA dot-repeat)
- Normal-mode redo idiom(?): prepend "i" and append ESC.
- Insert-mode only needs AppendToRedobuffLit().
- Cmdline-mode: only paste the first line.
2019-08-27 22:13:45 +02:00
Justin M. Keyes
bfc5a18f4b paste: insert text "before" cursor in Insert-mode 2019-08-27 22:13:45 +02:00
Justin M. Keyes
eacc70fb3e API: nvim_paste 2019-08-27 22:13:45 +02:00
Justin M. Keyes
c95f5d166f paste: workaround typeahead race
Workaround this failure:

    [  ERROR   ] test/functional/terminal/tui_spec.lua @ 192: TUI paste: exactly 64 bytes
    test/functional/helpers.lua:403:
    retry() attempts: 478
    test/functional/terminal/tui_spec.lua:201: Expected objects to be the same.
    Passed in:
    (table: 0x47cd77e8) {
     *[1] = 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz endz' }
    Expected:
    (table: 0x47cd7830) {
     *[1] = 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz end' }

This happens because `curwin->w_cursor.col` is sometimes decremented at
the end of `do_put`... because the editor is in Normal-mode instead of
the expected Insert-mode.

Caused by "typeahead race" (#10826): there may be queued input in the
main thread not yet processed, thus the editor mode (`State` global)
will be "wrong" during paste. Example: input "i" followed immediately by
a paste sequence:

    i<start-paste>...<stop-paste>
    ^
     "i" does not get processed in time, so the editor is in
     Normal-mode instead of Insert-mode while handling the paste.

Attempted workarounds:
- vim.api.nvim_feedkeys('','x',false) in vim._paste()
- exec_normal() in tinput_wait_enqueue()
- LOOP_PROCESS_EVENTS(&main_loop,…,0) in tinput_wait_enqueue()

ref #10826
2019-08-27 21:19:10 +02:00
Justin M. Keyes
93e5f0235b API: nvim_put: "follow" parameter 2019-08-27 21:19:10 +02:00
Justin M. Keyes
613296936b API: nvim_put: always PUT_CURSEND
Fixes strange behavior where sometimes the buffer contents of a series
of paste chunks (vim._paste) would be out-of-order.

Now the tui_spec.lua screen-tests are much more reliable. But they still
sometimes fail because of off-by-one cursor (caused by "typeahead race"
resulting in wrong mode; fixed later in this patch-series).
2019-08-27 21:19:10 +02:00
Justin M. Keyes
1fdae25b2b test/tui_spec: connect to child session 2019-08-27 21:19:10 +02:00
Justin M. Keyes
0221a9220a paste: edge-case: handle EOL at end-of-buffer
This is "readfile()-style", see also ":help channel-lines".
2019-08-27 21:19:10 +02:00
Justin M. Keyes
d303790ee7 paste: test 2019-08-27 21:19:10 +02:00
Justin M. Keyes
5a2894d677 paste: use nvim_put() 2019-08-27 21:19:10 +02:00
Justin M. Keyes
e1177be363 API: nvim_put #6819 2019-08-27 21:19:10 +02:00
Justin M. Keyes
abd55be19a paste: fixup tests 2019-08-27 21:19:10 +02:00
Justin M. Keyes
68ea9a7c8a TUI/paste: always flush on paste mode-change
Flush input before entering, not only when leaving, paste mode. Else
there could be pending input which will erroneously be sent to the paste
handler.
2019-08-27 21:19:10 +02:00
Justin M. Keyes
21f0f7bca5 paste: WIP #4448 2019-08-27 21:19:10 +02:00