aboutsummaryrefslogtreecommitdiff
path: root/test/functional/terminal
Commit message (Collapse)AuthorAge
* refactor(tests): use assert_alive() #15546Justin M. Keyes2021-09-01
|
* fix(jobwait): always drain process event queues #15402Gregory Anders2021-08-31
| | | | | | | | | | | | | | Problem: jobwait() returns early if the job was stopped, but the job might have pending callbacks on its event queue which are required to complete its teardown. State such as term->closed might not be updated yet (by the pending callbacks), so codepaths such as :bdelete think the job is still running. Solution: Always flush the job's event queue before returning from jobwait(). ref #15349
* fix(terminal): close without ! if the job is stoppedGregory Anders2021-08-31
| | | | | | - If the terminal job is still running then ! is still required. Closes #4683
* chore: revert unrelated changes in testDylan Armstrong2021-02-27
|
* test: use assert_alive helper rather than eqDylan Armstrong2021-02-27
|
* test: segfault test for empty buffer paste on termDylan Armstrong2021-02-26
|
* tests: Take into account magic hyphen. (#13518)Edwin Pujols2020-12-11
| | | | | | | | | | | | | In Lua patterns the hyphen works like a non-greedy version of Vim's `*`. - Use `%-` when you need a literal hyphen. - If you don't need a regular expression at all, use something like ``` string.find(text, pattern, 1, true) ``` so that the pattern is regarded as a plain, non-magical string. See [1] and [2] in the Lua manual. [1]: https://www.lua.org/manual/5.1/manual.html#pdf-Patterns [2]: https://www.lua.org/manual/5.1/manual.html#pdf-string.find
* test/wildmode_spec: override $PS1Jan Edmund Lazo2020-12-01
| | | | | User config may set $PS1 for a colored prompt. It breaks the screen tests.
* vim-patch:8.0.1525: using :wqa exits even if a job runs in a terminal windowJan Edmund Lazo2020-12-01
| | | | | | | Problem: Using :wqa exits even if a job runs in a terminal window. (Jason Felice) Solution: Check if a terminal has a running job. (closes vim/vim#2654) https://github.com/vim/vim/commit/7a76092a51fc5446426a4bfd9eb6503ec61bf9e9
* test: add functional test for segmented response from terminalerw72020-11-20
|
* GHA: Skip tests that fail due to actions/runner#241James McCoy2020-11-13
|
* A Mudholland Dr. RecastBjörn Linse2020-10-19
| | | | | The commit summary maybe does not make sense, but calling a function that does not wait on anything `wait()` makes even less sense.
* tests/terminal/tui: wait 1ms to avoid data race in FreeBSDJan Edmund Lazo2020-08-02
|
* terminal: fix terminal attribute overflowerw72020-07-29
| | | | fixes #11548
* terminal: preserve mode when using <Cmd>wincmd in terminal mode (#12254)Ghjuvan Lacambre2020-06-22
|
* terminal: disable 'scrolloff' (fixes flicker)Justin M. Keyes2020-05-04
| | | | | | | | | | 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
* terminal: Fix mouse coordinates issue (#12158)erw72020-04-21
| | | | | | 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.
* terminal: absolute CWD in term:// URI #11289Chris LaRose2020-01-26
| | | | | | | | | 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>
* edit.c: Ensure undo sync when emulating <Esc>x #11706Matthew Malcomson2020-01-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* tests: ex_terminal_spec: retry ":terminal (with fake shell)" (#11588)Daniel Hahler2019-12-22
| | | | | | | | | | | | | | | | | | | | | | | 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>
* API: rename nvim_execute_lua => nvim_exec_luaJustin M. Keyes2019-12-02
| | | | | | - 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`.
* API: deprecate nvim_command_outputJustin M. Keyes2019-12-02
|
* win_line: Fix crash with 'rightleft' in :terminal #11460erw72019-11-28
| | | | | | | | | | | | | | | | 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
* test/Screen:expect: replace "{IGNORE}" with "{MATCH:…}"Justin M. Keyes2019-11-09
| | | | ref #11004
* paste: Select-mode, Visual-mode #11360Justin M. Keyes2019-11-09
| | | fix #11344
* doc: vim.fn, vim.call(), vim.api [ci skip]Justin M. Keyes2019-11-06
|
* terminal: add tests for palette color forwardingBjörn Linse2019-11-03
|
* tests: fix non-controversial misuse of `pending` (#11247)Daniel Hahler2019-10-18
| | | Ref: https://github.com/neovim/neovim/pull/11184
* tests: tui_spec: fix waiting for terminal to be ready (#11232)Daniel Hahler2019-10-15
| | | | | The screen would have '-- TERMINAL --' already initially. Related to flakiness of "TUI FocusGained/FocusLost in terminal-mode".
* tests/ui: remove unnecessary screen:detach()Björn Linse2019-10-13
| | | | | | | | | | | | | 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.
* tests/ui: cleanup illegitimate usages of "attr_ignore"Björn Linse2019-10-13
| | | | | "attr_ignore" is an anti-pattern, with snapshot_util() just include all the highlights already.
* tests/ui: make screen.lua use "linegrid" representation internallyBjörn Linse2019-10-13
| | | | | | | | | | 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.
* tests: tui_spec: improve/merge OptionSet/deferredDaniel Hahler2019-10-04
| | | | Closes https://github.com/neovim/neovim/pull/11129.
* Fix flaky test: tui_spec: increase timeout (#11134)Daniel Hahler2019-10-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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) ```
* tui: improve handle_background_color: short-circuit (#11067)Daniel Hahler2019-09-30
| | | | | | | | * 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.
* paste: fix handling of "<" in cmdline (#11094)Daniel Hahler2019-09-25
| | | Fixes https://github.com/neovim/neovim/issues/11088.
* tui_spec: improve "TUI paste: exactly 64 bytes" (#11086)Daniel Hahler2019-09-24
| | | | | | | | | | | | | | | | | | | | | | | 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
* tests: fix flaky 'scrollback' option deletes lines (only) if necessary (#11003)Daniel Hahler2019-09-16
| | | | | | Using `screen:expect` with the complete grid appears to fix its flakiness. Fixes https://github.com/neovim/neovim/issues/10723.
* syntax, TUI: support "strikethrough"Jaskaran Singh2019-09-13
| | | | | | fix #3436 Includes: vim-patch:8.0.1038: strike-through text not supported
* UIEnter/UILeave: fire for embedder UI, builtin TUIJustin M. Keyes2019-09-12
| | | | | | | | | 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.
* API/nvim_list_uis(): include "chan" field for TUIJustin M. Keyes2019-09-12
| | | | | Even though it's always zero currently, it's less confusing if all UIs have the same fields.
* paste: fix paste in terminal modeBjörn Linse2019-09-11
|
* terminal: fix rgb rendering of palette colorsBjörn Linse2019-09-10
| | | | | | | | | | 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.
* paste: fix normal-mode paste by different approach #10976Justin M. Keyes2019-09-09
| | | | | | | | Forcing insert-mode after the first paste-chunk seems to work, as an alternative to a9e2bae0eb69 (insert-before-cursor). NB: Dot-repeat needs to match the original action. Since a9e2bae0eb69 changed paste to insert-before-cursor, dot-repeat must also. But that makes dot-repeat unpleasant/unusual.
* paste: insert before cursor alwaysJustin M. Keyes2019-09-08
| | | | | | | | | 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.
* paste: do not clobber msg area for small pastesJustin M. Keyes2019-09-08
|
* paste/cmdline: discard all chunks after first lineJustin M. Keyes2019-09-08
| | | | | | 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.
* paste: reset 'paste' option immediately #10974Justin M. Keyes2019-09-08
| | | | | | - 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).
* update tests for new resize behavior (resize at pager, but not at :!cmd)Björn Linse2019-09-08
|
* tests: fix flaky "TUI FocusGained/FocusLost in terminal-mode" #10754Daniel Hahler2019-09-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>