Commit Graph

143 Commits

Author SHA1 Message Date
zeertzjq
b7c86e24f7 vim-patch:8.2.0982: insufficient testing for reading/writing files
Problem:    Insufficient testing for reading/writing files.
Solution:   Add more tests. (Yegappan Lakshmanan, closes vim/vim#6257)
            Add "ui_delay" to test_override() and use it for the CTRL-O test.
b340baed9f

Omit test_override().
Reorder test_writefile.vim to match Vim.
2022-08-19 22:05:26 +08:00
zeertzjq
a10a23aae9 vim-patch:8.2.0097: crash with autocommand and spellfile
Problem:    Crash with autocommand and spellfile. (Tim Pope)
Solution:   Do not pop exestack when not pushed. (closes vim/vim#5450)
ce6db0273f
2022-08-14 04:29:44 +08:00
zeertzjq
0134a2cb3e vim-patch:9.0.0094: cursor restored unexpected with nested autocommand
Problem:    Cursor restored unexpected with nested autocommand.
Solution:   Do not restore the cursor when it was moved intentionally.
            (closes vim/vim#10780)
3d6ee8bda0
2022-07-28 11:40:35 +08:00
zeertzjq
394d65494a vim-patch:partial:9.0.0077: wrong restored cursor position when switching window in autocmd
Problem:    When switching window in autocmd the restored cursor position may
            be wrong.
Solution:   Do not restore the cursor if it was not set. (closes vim/vim#10775)
b03950fafa

This patch cannot be fully ported because it depends on patch 8.2.3518.
2022-07-28 11:38:02 +08:00
zeertzjq
8e67af1b20 vim-patch:9.0.0061: ml_get error with nested autocommand
Problem:    ml_get error with nested autocommand.
Solution:   Also check line numbers for a nested autocommand. (closes vim/vim#10761)
5fa9f23a63
2022-07-28 11:38:02 +08:00
zeertzjq
0c0a2e4e52 vim-patch:9.0.0083: ModeChanged event not triggered when leaving cmdline window
Problem:    ModeChanged event not triggered when leaving the cmdline window.
Solution:   Call may_trigger_modechanged(). (closes vim/vim#10791)
c9e8fd6fc7

Code is already present in Nvim. Add some other related missing changes.
2022-07-27 06:23:47 +08:00
zeertzjq
1a07044c1c
revert: "vim-patch:9.0.0061: ml_get error with nested autocommand" (#19509)
This reverts commit 6cee15da72.

Port this again when https://github.com/vim/vim/issues/10780 is fixed.
2022-07-26 11:53:17 +08:00
zeertzjq
6cee15da72 vim-patch:9.0.0061: ml_get error with nested autocommand
Problem:    ml_get error with nested autocommand.
Solution:   Also check line numbers for a nested autocommand. (closes vim/vim#10761)
5fa9f23a63
2022-07-23 17:50:25 +08:00
zeertzjq
01afd43bc9 vim-patch:8.2.0275: some Ex code not covered by tests
Problem:    Some Ex code not covered by tests.
Solution:   Add test cases. (Yegappan Lakshmanan, closes vim/vim#5659)
406cd90f19
2022-07-12 16:23:32 +08:00
zeertzjq
fe2b281292 vim-patch:8.2.1053: insufficient testing for 'statusline' and 'tabline'
Problem:    Insufficient testing for 'statusline' and 'tabline'.
Solution:   Add more tests. (Yegappan Lakshmanan, closes vim/vim#6333)
832adf9bb8
2022-07-10 16:15:17 +08:00
zeertzjq
880de9a489
test(old): align defaults to Vim after every test (#19301)
This can avoid divergences from Vim in some small places.
2022-07-10 06:59:58 +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
zeertzjq
e95f32a717 vim-patch:8.2.5083: autocmd test still fails on MS-Windows
Problem:    Autocmd test still fails on MS-Windows.
Solution:   Change backward to forward slashes.
db77c49401
2022-06-13 16:05:26 +08:00
zeertzjq
1c16e5bb11 vim-patch:8.2.5081: autocmd test fails on MS-Windows
Problem:    Autocmd test fails on MS-Windows.
Solution:   Set shellslash to get forward slashes.
7c0d0c3c75
2022-06-13 16:05:19 +08:00
zeertzjq
254454d0c5 vim-patch:8.2.5079: DirChanged autocommand may use freed memory
Problem:    DirChanged autocommand may use freed memory. (Shane-XB Qian)
Solution:   Free the memory later. (closes vim/vim#10555)
d8c9d32c89

Code change is N/A as Nvim gets the full current directory again before
applying the autocommand, so this just ports the tests.
2022-06-13 16:05:02 +08:00
zeertzjq
5e9afca1c1 vim-patch:8.2.4802: test is not cleaned up
Problem:    Test is not cleaned up.
Solution:   Make test clean up after itself.  Avoid NUL. (closes vim/vim#10233)
7851c69a12

Adapt test_autocmd_vimgrep() to Nvim.
2022-04-21 19:07:50 +08:00
zeertzjq
f531fb97ff vim-patch:8.2.4791: events triggered in different order when reusing buffer
Problem:    Autocmd events triggered in different order when reusing an empty
            buffer.
Solution:   Call buff_freeall() earlier. (Charlie Groves, closes vim/vim#10198)
fef4485ef5

Test failure becomes very strange.
2022-04-21 19:07:50 +08:00
zeertzjq
69fc23ed98 vim-patch:8.2.2477: autocommand tests hang on MS-Windows
Problem:    Autocommand tests hang on MS-Windows.
Solution:   Skip a couple of tests.  Fix file name.
dd07c02232
2022-04-21 19:07:50 +08:00
zeertzjq
1664e3d4bc vim-patch:8.2.2476: using freed memory when splitting window while closing buffer
Problem:    Using freed memory when using an autocommand to split a window
            while a buffer is being closed.
Solution:   Disallow splitting when the buffer has b_locked_split set.
983d83ff1c

Put the error message in window.c.
Cherry-pick a memory leak fix from Vim patch 8.2.0399.
Test still fails.
2022-04-21 19:07:50 +08:00
zeertzjq
407be5975d vim-patch:8.2.2475: autocommand tests hangs on MS-Windows
Problem:    Autocommand tests hangs on MS-Windows.
Solution:   Skip one test.
dfc3db76b9
2022-04-21 19:07:50 +08:00
zeertzjq
69ac382a28 vim-patch:8.2.2474: using freed memory when window is closed by autocommand
Problem:    Using freed memory when window is closed by autocommand.
            (houyunsong)
Solution:   Check the window pointer is still valid.
2c7080bf1c

Add missing comment from Vim patch 8.0.1420.
Test fails.
2022-04-21 19:07:50 +08:00
zeertzjq
fa15f2f938 vim-patch:8.2.2472: crash when using command line window in an autocommand
Problem:    Crash when using command line window in an autocommand.
            (houyunsong)
Solution:   Save and restore au_new_curbuf.
aad5f9d79a

Nvim has removed :open, so use :edit in the test instead.
2022-04-21 19:07:50 +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().
d58862d18f
2022-04-12 19:16:47 +08:00
zeertzjq
53668a5815 vim-patch:8.2.4713: plugins cannot track text scrolling
Problem:    Plugins cannot track text scrolling.
Solution:   Add the WinScrolled event. (closes vim/vim#10102)
0937182d49

Skip User event in autocmd.txt, not needed unless #10689 is reverted.
2022-04-12 05:02:05 +08:00
zeertzjq
381f8f86da vim-patch:8.2.4728: no test that v:event cannot be modified
Problem:    No test that v:event cannot be modified.
Solution:   Add a test. (closes vim/vim#10139)
021996ffaa
2022-04-10 18:45:16 +08:00
zeertzjq
191f009ab7 vim-patch:8.2.4706: buffer remains active with WinClosed and tabpages
Problem:    Buffer remains active if a WinClosed event throws an exception
            when there are multiple tabpages.
Solution:   Ignore aborting() when closing the buffer. (closes vim/vim#10101)
6a06940f8a
2022-04-08 08:54:07 +08:00
zeertzjq
b7bc931f63 vim-patch:8.2.4700: buffer remains active if WinClosed event throws an exception
Problem:    Buffer remains active if a WinClosed event throws an exception.
Solution:   Ignore aborting() when closing the buffer. (closes vim/vim#10097)
c947b9ae41
2022-04-08 08:54:07 +08:00
zeertzjq
f4f18a9833 vim-patch:8.2.4631: crash when switching window in BufWipeout autocommand
Problem:    Crash when switching window in BufWipeout autocommand.
Solution:   Put any buffer in the window to avoid it being NULL.
            (closes vim/vim#10024)
347538fad0

win_init_empty() cannot be made static because it is used in autocmd.c
2022-03-27 10:01:07 +08:00
zeertzjq
c2378be3dd
vim-patch:8.2.3453: autocmd not executed when editing a directory (#17846)
Problem:    Autocmd not executed when editing a directory ending in a path
            separator inside try block.
Solution:   Return NOTDONE instead of FAIL. (closes vim/vim#8885)
40fa12aea3
2022-03-26 08:27:29 +08:00
zeertzjq
726ec7fb17
Merge pull request #17403 from zeertzjq/vim-8.1.1955
vim-patch:8.1.{1846,1955},8.2.0156
2022-02-21 08:02:45 +08:00
zeertzjq
7b048df4dc vim-patch:8.2.4345: <amatch> is expanded like a file name for DirChangedPre
Problem:    <amatch> is expanded like a file name for DirChangedPre.
Solution:   Do not expand <amatch>. (closes vim/vim#9742)  Also for the User event.
f6246f51e3
2022-02-17 06:19:10 +08:00
zeertzjq
8a80ab27bd vim-patch:8.1.1846: inconsistently using GetVimCommand() and v:progpath
Problem:    Inconsistently using GetVimCommand() and v:progpath. (Daniel
            Hahler)
Solution:   Use GetVimCommand(). (closes vim/vim#4806)
93344c2d70

Cherry-pick a change to test_profile.vim from patch 8.1.1544.
Cherry-pick a change to test_vimscript.vim from patch 8.1.1826.

Some of the args are no-op in Nvim, and `-i NONE` and `--headless` are
already added by `GetVimCommand()`. I'll try to match the order of args
in upstream, substituting `--not-a-term` with `--headless`.
2022-02-14 18:56:30 +08: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)
28e8f73ae2
2022-02-11 12:55:58 +08:00
zeertzjq
fe621b4ac0 vim-patch:8.1.0711: test files still use function!
Problem:    Test files still use function!.
Solution:   Remove the exclamation mark.  Fix overwriting a function.
1e1153600c

Some of the changes were already applied previously.
2022-02-07 05:34:20 +08:00
Sean Dewar
6820420d3e
vim-patch:8.2.4028: ml_get error with :doautoall and Visual area
Problem:    ml_get error with :doautoall and Visual area. (Sean Dewar)
Solution:   Disable Visual mode while executing autocommands.
cb1956d6f2

This should also fix #16937 for nvim_buf_call, so test for it.
2022-02-03 15:03:08 +00:00
Sean Dewar
5864edac7b vim-patch:8.1.2302: :lockmarks does not work for '[ and ']
Problem:    :lockmarks does not work for '[ and '].
Solution:   save and restore '[ and '] marks. (James McCoy, closes vim/vim#5222)
f4a1d1c054

Test_diff_maintains_change_mark doesn't actually fail without these changes.
This is fixed in v8.2.3936.
2022-01-27 18:47:52 +08:00
Jan Edmund Lazo
6b8a365465 test: port test_filechanged.vim
I can't port patch 8.1.0820.
Attempt failed in https://github.com/neovim/neovim/pull/12948.
test_filechanged.vim is required for later patches.
2021-12-25 17:55:52 -05:00
Jan Edmund Lazo
afaad8b54e
Merge pull request #16194 from seandewar/vim-8.1.1925
vim-patch:7.4.1777,8.1.{1925,1995,2011,2012,2013,2166},8.2.{0532,0871,1168,1241,3576}
2021-12-07 01:14:21 -05:00
Jan Edmund Lazo
18d81a6724
Merge pull request #16107 from zeertzjq/vim-8.1.1542
vim-patch:8.1.1542,8.2.3549: an OptionSet autocommand does not get enough info
2021-12-06 22:35:05 -05:00
Sean Dewar
6e3e8c51c0
test(oldtest): uncomment method call syntax uses
We should now be equal with Vim in regards to method call support of already ported built-ins.

Enable all relevant commented-out uses of the syntax in tests that I could grep.
2021-11-26 18:53:12 +00:00
Sean Dewar
dac52e6d04
vim-patch:8.2.2465: using freed memory in :psearch
Problem:    Using freed memory in :psearch. (houyunsong)
Solution:   Check the current window is still valid.  Fix flaky test.
92bb83e41c

Test_cursorhold_insert timer's 100ms delay was already LoadAdjusted, but change
to 200ms (still LoadAdjust) to match Vim anyway.
2021-11-24 05:34:20 +00:00
Sean Dewar
c366c944c2
vim-patch:8.1.2136: using freed memory with autocmd from fuzzer
Problem:    using freed memory with autocmd from fuzzer. (Dhiraj Mishra,
            Dominique Pelle)
Solution:   Avoid using "wp" after autocommands. (closes vim/vim#5041)
ec66c41d84

Nvim doesn't use Vim's terminal implementation.
Despite this, Nvim has its own *exclusive* way of crashing here.

Requires 'winwidth' > winwidth() and 'nowinfixwidth' to crash; adjust
the test ('nowfw' is the default, but ensure its disabled anyway).
2021-11-24 03:55:02 +00:00
zeertzjq
419ebd8ec6 vim-patch:8.2.3549: mistakes in test comments
Problem:    Mistakes in test comments.
Solution:   Fix the comments. (closes vim/vim#9029)
b811de5d49
2021-11-22 15:50:14 +08:00
zeertzjq
d40db0edbd vim-patch:8.1.1542: an OptionSet autocommand does not get enough info
Problem:    An OptionSet autocommand does not get enough info.
Solution:   Add v:option_command, v:option_oldlocal and v:option_oldglobal.
            (Latrice Wilgus, closes vim/vim#4118)
d7c9687947
2021-11-22 15:50:14 +08:00
zeertzjq
dba3590a0e
vim-patch:8.2.3591: no event is triggered when closing a window (#16306)
Problem:    No event is triggered when closing a window.
Solution:   Add the WinClosed event. (Naohiro Ono, closes vim/vim#9110)
23beefed73

Nvim has already implemented this feature, so this only changes tests
and docs.
2021-11-17 21:11:09 -05:00
zeertzjq
8a2489d0a4 test: partially port Vim patches 8.1.2278 and 8.2.1432 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)
2caad3fbbd
2021-10-17 22:04:53 +08:00
zeertzjq
eed89d5e0c vim-patch:8.0.1463: test fails without 'autochdir' option
Problem:    Test fails without 'autochdir' option.
Solution:   Skip test if 'autochdir' is not supported.
ec48a9c589
2021-10-17 22:04:53 +08:00
zeertzjq
920473d2f2 vim-patch:8.0.1459: cannot handle change of directory
Problem:    Cannot handle change of directory.
Solution:   Add the DirChanged autocommand event. (Andy Massimino,
            closes vim/vim#888)  Avoid changing directory for 'autochdir' too often.
b7407d3fc9

Only add "auto" pattern. "window" and "global" are already implemented.
Skip `Test_dirchanged_auto` using `CheckFunction test_autochdir`.
Part of PR #15952. More information can be found there.

N/A patches for version.c:

vim-patch:8.0.1460: missing file in patch

Problem:    Missing file in patch.
Solution:   Add changes to missing file.
b5cb65ba2b

vim-patch:8.0.1461: missing another file in patch

Problem:    Missing another file in patch.
Solution:   Add changes to missing file.
15833239a4
2021-10-17 22:04:53 +08:00
Gregory Anders
d8ab8cccd0 test: update tests to work with 'hidden' 2021-08-18 12:17:12 -06:00