Commit Graph

12 Commits

Author SHA1 Message Date
Justin M. Keyes
a9d7ec4587 refactor: introduce XFREE_CLEAR()
Unfortunately we cannot indiscriminately replace xfree() with
XFREE_CLEAR(), because comparing pointers after freeing them is a common
pattern. Example in `tv_list_remove_items()`:

    xfree(li);
    if (li == item2) {
      break;
    }

Instead we can do it selectively/explicitly.

ref #1375
2019-05-25 10:01:17 +02:00
Björn Linse
74751117eb autocmd: fixes and tests for autocmd window issues
- redraw! in an invisible buffer rendered the screen unusable.
- storing the autocmd window handle and using it in API function could lead
  to crashes. Unregister the handle when the window is not active.
2019-05-13 20:32:04 +02:00
Justin M. Keyes
b1f25ea187 autocmd: do not show empty section after ++once handlers expire
Problem: If autocmd pattern only contained `++once` handlers, and
         all of them completed, then there would be an empty group
         displayed by `:autocmd Foo`.
Solution: Delete the pattern if all of its commands were deleted.
2019-03-14 01:30:11 +01:00
Justin M. Keyes
3259e45f92 autocmd: rename: "++nested", "++once"
Based on feedback from upstream:
https://github.com/vim/vim/pull/4100
2019-03-14 01:30:11 +01:00
Justin M. Keyes
9312e2d06a
autocmd: rename "once" => "-once" #9713
- Rename "nested" to "-nested", but continue to support "nested" for
  backwards-compatibility.
- Allow any order: "-once -nested" or "-nested -once".

ref https://github.com/neovim/neovim/pull/9706#issuecomment-471295747
2019-03-11 21:01:47 +01:00
Justin M. Keyes
c12cf5bde7 autocmd: introduce "once" feature
Adds a new feature to :autocmd which sets the handler to be executed at
most one times.

Before:

    augroup FooGroup
      autocmd!
      autocmd FileType foo call Foo() | autocmd! FooGroup * <buffer>
    augroup END

After:

    autocmd FileType foo once call Foo()
2019-03-10 04:58:30 +01:00
ZyX
f5be643205 functests: Fix linter errors 2017-04-09 03:31:13 +03:00
ZyX
b0731290e8 functests: Move test from legacy/009 to autocmd/autocmd 2017-04-08 21:50:14 +03:00
lonerover
2b56cf099a fix test failure 2017-01-09 13:06:24 +08:00
James McCoy
9d2985ecba vim-patch:7.4.1658
Problem:    A plugin does not know when VimEnter autocommands were already
            triggered.
Solution:   Add the v:vim_did_enter variable.

1473551a44
2016-11-14 14:16:40 -05:00
ZyX
ff470bb853 functests: Check logs in lua code
It is otherwise impossible to determine which test failed sanitizer/valgrind
check. test/functional/helpers.lua module return was changed so that tests which
do not provide after_each function to get new check will automatically fail.
2016-06-10 21:50:49 +03:00
Marco Hinz
a528d56ba0 Tests: add autocmd_spec.lua 2016-03-02 12:37:50 +01:00