Commit Graph
140 Commits
Author SHA1 Message Date
zeertzjq 61d5bd561a refactor: remove E5500, adjust tests
Now with try_end() including more exception info, E5500 looks like
redundant information.
Adjust tests for more exception information.
2023-01-16 18:03:08 +08:00
erw7 ce66f158b5 feat(api): show more exception info 2023-01-16 17:58:57 +08:00
bfredl 43e8ec92de fix(tui): more work in the TUI 2022-12-31 13:25:26 +01:00
zeertzjqandBram Moolenaar 3dadd3aca5 vim-patch:8.2.2870: CmdlineChange event triggered twice for CTRL-R (#21361)
Problem:    CmdlineChange event triggered twice for CTRL-R.
Solution:   Return CMDLINE_NOT_CHANGED from cmdline_insert_reg().
            (closes vim/vim#8219)

https://github.com/vim/vim/commit/796139ae3ac89e27ee96dce3c7fdb87d8c839f53

Cherry-pick Test_cmdline_map_cmdlineChanged() from patch 8.2.2851.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2022-12-11 08:48:00 +08:00
zeertzjq 7faf8a45e8 fix(events): skip WinScrolled for newly-created float windows (#21333)
Unlike split windows, creating a new floating window does not cause
other windows to resize, so it doesn't make much sense to trigger
WinScrolled or WinResized when creating a new floating window.
2022-12-10 06:50:03 +08:00
zeertzjq f92aab5f70 vim-patch:9.0.1025: WinScrolled is not triggered when filler lines change (#21325)
Problem:    WinScrolled is not triggered when filler lines change.
Solution:   Add "topfill" to the values that WinScrolled triggers on.
            (closes vim/vim#11668)

https://github.com/vim/vim/commit/3fc84dc2c7efecd7c14ce341cd777475058936fd

Cherry-pick StopVimInTerminal() from patch 9.0.1010.
2022-12-07 18:34:39 +08:00
zeertzjq ad244a865b fix(events): save v:event for cmdline autocommands separately (#21316) 2022-12-07 08:57:29 +08:00
zeertzjqandBram Moolenaar 4571ba4d0a vim-patch:partial:9.0.0917: the WinScrolled autocommand event is not enough (#21161)
Problem:    The WinScrolled autocommand event is not enough.
Solution:   Add WinResized and provide information about what changed.
            (closes vim/vim#11576)

https://github.com/vim/vim/commit/35fc61cb5b5eba8bbb9d8f0700332fbab38f40ca

Omit "func_name" comment in tv_dict_extend(): Vim9 script only.
Skip layout locking and E1312.
Skip list_alloc_with_items() and list_set_item().

Since this overrides remaining changes in patch 9.0.0913, that patch can
now be marked as fully ported:

vim-patch:9.0.0913: only change in current window triggers the WinScrolled event

N/A patches for version.c:

vim-patch:9.0.0919: build failure with tiny features

Problem:    Build failure with tiny features.
Solution:   Adjust #ifdef's.

https://github.com/vim/vim/commit/9c5b7cb4cf67c64648a324e9dfd1e17d793335a4

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2022-11-23 09:54:48 +08:00
dundargoc 5eb5f49488 test: simplify platform detection (#21020)
Extend the capabilities of is_os to detect more platforms such as
freebsd and openbsd. Also remove `iswin()` helper function as it can be
replaced by `is_os("win")`.
2022-11-22 08:13:30 +08:00
zeertzjq d6bd9c7733 test: add a test for #18222 2022-11-20 21:38:29 +08:00
zeertzjqandBram Moolenaar 91c192922d vim-patch:9.0.0915: WinScrolled may trigger immediately when defined
Problem:    WinScrolled may trigger immediately when defined.
Solution:   Initialize the fields in all windows. (closes vim/vim#11582)

https://github.com/vim/vim/commit/29967732761d1ffb5592db5f5aa7036f5b52abf1

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2022-11-20 21:24:22 +08:00
zeertzjqandBram Moolenaar 035d41ac5e vim-patch:partial:9.0.0913: only change in current window triggers the WinScrolled event
Problem:    Only a change in the current window triggers the WinScrolled
            event.
Solution:   Trigger WinScrolled if any window scrolled or changed size.
            (issue vim/vim#11576)

https://github.com/vim/vim/commit/0a60f79fd0c328b47b36279a95282e9f8d9e7512

Skip locking of window layout and E1312.
Copy the latest version of all WinScrolled tests from Vim.
Note: patch 9.0.0915 is needed for the Lua tests to pass.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2022-11-20 21:11:37 +08:00
dundargoc 736c36c02f test: introduce skip() #21010
This is essentially a convenience wrapper around the `pending()`
function, similar to `skip_fragile()` but more general-purpose.

Also remove `pending_win32` function as it can be replaced by
`skip(iswin())`.
2022-11-13 05:52:19 -08:00
zeertzjq 6bc2d6b66b vim-patch:9.0.0614: SpellFileMissing autocmd may delete buffer
Problem:    SpellFileMissing autocmd may delete buffer.
Solution:   Disallow deleting the current buffer to avoid using freed memory.
https://github.com/vim/vim/commit/ef976323e770315b5fca544efb6b2faa25674d15
2022-10-15 16:28:36 +08:00
zeertzjq 647da34bbd fix: assert failure when changing 'ut' while waiting for CursorHold (#20241) 2022-09-18 22:55:30 +08:00
zeertzjq 644a3f48b1 fix(events): make CursorHold behave as documented 2022-09-17 21:48:44 +08:00
zeertzjq 1dcaa75a65 fix(events): triggered WinScrolled when only skipcol changed (#19972)
fix(events): trigger WinScrolled when only skipcol changed

vim-patch:9.0.0304: WinScrolled is not triggered when only skipcol changes

Problem:    WinScrolled is not triggered when only skipcol changes.
Solution:   Add w_last_skipcol and use it. (closes vim/vim#10998)
https://github.com/vim/vim/commit/670ab0334b536e12d84810de88e73b7bcb01346d
2022-08-29 06:16:20 +08:00
Justin M. Keyes d0835617fa fix(terminal): crash if TermClose deletes own buffer #19222
- Partially fixes #10386 except for the case where the alternate buffer
  is the default, empty, first buffer created on startup. #vimlife
- TODO: port patches related to `can_unload_buffer`, maybe that fully
  fixes #10386?

vim-patch:8.0.1732: crash when terminal API call deletes the buffer
2022-07-05 02:31:49 -07:00
Justin M. Keyes f977f9445f refactor(tests): introduce testprg()
Also:
- Add a describe('shell :!') section to system_spec.
- Make the test for #16271 work on systems without powershell.
2022-06-25 08:27:17 -07:00
Charlie Groves e69cb86750 test: add a Lua functional test for NoName buffer event order 2022-04-21 19:07:50 +08:00
zeertzjq 9b10b4cc64 vim-patch:8.1.1756: autocommand that splits window messes up window layout
Problem:    Autocommand that splits window messes up window layout.
Solution:   Disallow splitting a window while closing one.  In ":all" give an
            error when moving a window will not work.
https://github.com/vim/vim/commit/1417c766f55e5959b31da488417b7d9b141404af

Expected error number was changed to E242 in Vim in patch 8.2.1183, and
patch 8.2.2420 (which has already been ported) made the test no longer
throw E249 in Vim, so just use E242 in the test.
2022-04-21 19:06:50 +08:00
zeertzjq bc19ae4e11 test: unskip tests skipped in #14661 2022-04-13 05:04:14 +08:00
zeertzjq 7e1e906738 vim-patch:8.2.4739: accessing freed memory after WinScrolled autocmd event (#18090)
Problem:    Accessing freed memory after WinScrolled autocmd event.
Solution:   Check the window pointer is still valid. (closes vim/vim#10156)
            Remove the argument from may_trigger_winscrolled().
https://github.com/vim/vim/commit/d58862d18f091d3c14fa3647e724ef7eea1ecefa
2022-04-12 19:16:47 +08:00
zeertzjq 6be4fd888c test: properly test WinScrolled event 2022-04-12 05:02:05 +08:00
zeertzjq f89ca7194f fix(events): make v:event readonly in more events (#18070)
This makes v:event readonly in these four events:
- ChanInfo
- ChanOpen
- RecordingLeave
- TermClose
2022-04-11 11:32:15 +08:00
Loong Wang b2cb05b53e feat(events): support SIGWINCH for Signal event #18029
closes #15411
2022-04-10 15:56:08 -07:00
zeertzjq 74a27748e6 fix(autocmd): restore autocmd showing behavior 2022-04-06 05:44:30 +08:00
zeertzjq 89712dcbf8 fix(aucmd_win): always make aucmd_win the last window 2022-03-23 09:07:21 +08:00
TJ DeVries 991e472881 feat(lua): add api and lua autocmds 2022-02-27 22:04:55 +01:00
Sean Dewar 2deffb5ea8 fix(aucmd_win): ensure aucmd_win stays floating
Nvim uses a floating window for the autocmd window, but in certain situations,
it can be made non-floating (`:wincmd J`), which can cause issues due to the
previous setup and cleanup logic for a non-floating aucmd_win being removed from
aucmd_prepbuf and aucmd_restbuf.

This can cause glitchiness and crashes due to the aucmd_win's frame being
invalid after closing its tabpage, for example.

Ensure aucmd_win cannot be made non-floating. The only place this happens is in
win_split_ins if new_wp != NULL.
2022-02-23 00:09:27 +00:00
zeertzjq 059d36e326 feat(events): add DirChangedPre
In Nvim, like DirChanged, this also triggers when switching windows.

This marks Vim patch 8.2.4335 as ported.

vim-patch:8.2.4335: no autocommand event triggered before changing directory

Problem:    No autocommand event triggered before changing directory. (Ronnie
            Magatti)
Solution:   Add DirChangedPre. (closes vim/vim#9721)
https://github.com/vim/vim/commit/28e8f73ae2d90009fd62cd60f97c2643ba44de68
2022-02-11 12:55:58 +08:00
zeertzjq 9b0363d365 vim-patch:8.2.1128: the write message mentions characters, but it's bytes
Problem:    The write message mentions characters, but it's actually bytes.
Solution:   Change "C" to "B" and "characters" to "bytes".
https://github.com/vim/vim/commit/3f40ce78f5c178d15871bd784ed878c78f0b8a44
2022-02-04 22:17:25 +08:00
Axel Dahlberg f65b0d4236 feat(autocmd): populate v:event in RecordingLeave (#16828) 2022-01-04 18:55:29 -07:00
Michael Lingelbach b42e0c40c8 fix: update last cursor on first CursorMoved (#16698)
Closes https://github.com/neovim/neovim/issues/16625 https://github.com/neovim/neovim/issues/12923

The first defined CursorMoved autocommand will immediately
fire if the cursor has previously moved upon definition
of the autocommand.

Plugins add dummy autocommands such as:

```lua
autocmd CursorMoved * execute ''
```

to avoid this behavior.

Instead, when defining a new CursorHold autocommand, force
update the last cursor position.

See https://github.com/vim/vim/issues/2053
2021-12-18 19:18:47 -08:00
Thomas Vigouroux 8a4e26c6fe feat(autocmd): add Recording autocmds
feat(eval): add reg_recorded()

This function is used the get the last recorded register.

style(Recording): rename handler to match suggestions

fix(RecordingLeave): send autocommand earlier

This makes the autocommand fire just before setting reg_recorded to
reg_recording, this way we clearly show that we are actually just before
actually quitting the recording mode.
2021-12-18 10:54:26 +01:00
Alejandro Exojo 8ad6015409 feat: add autocommand event when search wraps around (#8487) 2021-12-10 12:28:25 -07:00
Magnus Groß fdfd1eda43 feat: trigger ModeChanged for terminal modes 2021-11-18 11:23:18 +01:00
zeertzjq 38821cc50e test(dirchanged): add tests for DirChanged pattern "auto" 2021-10-17 22:04:53 +08:00
zeertzjq 6004f9137a refactor(dirchanged): tab -> tabpage
Match Vim's behavior.
2021-10-17 22:04:53 +08:00
zeertzjq 57651df9c1 vim-patch:8.1.0604: autocommand test fails on MS-Windows
Problem:    Autocommand test fails on MS-Windows.
Solution:   Use pathcmp() instead of strcmp() to check if a directory differs.
https://github.com/vim/vim/commit/9eb76af451ddd8eaad0cd5dd629f18c4f4035171
2021-10-17 22:04:53 +08:00
zeertzjq e91dee5c21 vim-patch:8.1.0602: DirChanged is also triggered when directory didn't change
Problem:    DirChanged is also triggered when the directory didn't change.
            (Daniel Hahler)
Solution:   Compare the current with the new directory. (closes vim/vim#3697)
https://github.com/vim/vim/commit/2caad3fbbdbf1486a176c9f6bfbc3d9be90e09f7
2021-10-17 22:04:53 +08:00
Justin M. Keyes 2afbce7651 refactor(tests): remove redir_exec #15718
Problem
- `redir_exec` is obsolete, but it keeps getting used in new tests
  because people copy existing tests.
- Disadvantages of `redir_exec`:
  - Captures extra junk before the actual error/message that we _want_ to test.
  - Does not fail on error, unlike e.g. `command()`.

Solution
- Use new functions like `nvim_exec` and `pcall_err`.
2021-09-19 02:29:37 -07:00
Justin M. Keyes d8de4eb685 test: reorg #15698
Problem:
Subdirectories like "visual", "insert", "normal" encourage people to
separate *related* tests for no good reason.  Typically the _mode_ is
not the relevant topic of a test (and when it is, _then_ create
an appropriate describe() or it()).

Solution:
- Delete the various `test/functional/<mode>/` subdirectories, move
  their tests to more meaningful topics.
- Rename `…/normal/` to `…/editor/`.
  - Move or merge `…/visual/*` and `…/insert/*` tests into here where
    appropriate.
- Rename `…/eval/` to `…/vimscript/`.
  - Move `…/viml/*` into here also.

* test(reorg): insert/* => editor/mode_insert_spec.lua
* test(reorg): cmdline/* => editor/mode_cmdline_spec.lua
* test(reorg): eval core tests => eval_spec.lua
2021-09-17 09:16:40 -07:00
Gregory Anders 50b30de200 feat(terminal): TermClose: set exit code in v:event.status #15406
Closes #4713
2021-08-20 10:45:28 -07:00
Ghjuvan Lacambre ad9c2c069a Fix <afile> getting prepended with a slash on WinClosed (#14515)
It is wrong to assume that you can't shorten a path if it's in `/`: you
can always shorten it by removing the forward slash.

Closes #14512
2021-06-26 10:18:36 -04:00
Björn Linse 42ffa2d62e Merge pull request #13205 from romgrk/add-bufmodified-autocmd
Implement BufModifiedSet autocmd
2020-11-09 12:23:14 +01:00
Rom Grk 11326761c7 test: update BufModifiedSet to be paranoid 2020-11-09 04:06:53 -05:00
Rom Grk 45d9f4fe6f test: fix BufModifiedSet 2020-11-07 22:17:18 -05:00
Rom Grk 3628d1ef72 tests: add functional test for BufModifiedSet 2020-11-07 19:18:00 -05:00
Andrea Cedraro 4c7ad9527d Add v:event flag on DirChanged signaling switching window (#13153)
Closes #9909
2020-11-07 12:02:06 -05:00