Mercurial > vim
comparison src/testdir/test_autocmd.vim @ 29867:6eaef7375f17 v9.0.0272
patch 9.0.0272: BufReadCmd not triggered when loading a "nofile" buffer
Commit: https://github.com/vim/vim/commit/b1d2c8116cb5577961ea109651fb888b5e58265f
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Aug 26 11:55:01 2022 +0100
patch 9.0.0272: BufReadCmd not triggered when loading a "nofile" buffer
Problem: BufReadCmd not triggered when loading a "nofile" buffer. (Maxim
Kim)
Solution: Call readfile() but bail out before reading a file.
(closes #10983)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 26 Aug 2022 13:00:04 +0200 |
parents | 33983b2f030f |
children | adc2dec6d27d |
comparison
equal
deleted
inserted
replaced
29866:607385b95bf7 | 29867:6eaef7375f17 |
---|---|
572 au BufReadCmd * e +h{ | 572 au BufReadCmd * e +h{ |
573 " } to fix highlighting | 573 " } to fix highlighting |
574 call assert_fails('help', 'E434:') | 574 call assert_fails('help', 'E434:') |
575 | 575 |
576 au! BufReadCmd | 576 au! BufReadCmd |
577 endfunc | |
578 | |
579 " BufReadCmd is triggered for a "nofile" buffer | |
580 func Test_BufReadCmdNofile() | |
581 new somefile | |
582 set buftype=nofile | |
583 au BufReadCmd somefile call setline(1, 'triggered') | |
584 edit | |
585 call assert_equal('triggered', getline(1)) | |
586 | |
587 au! BufReadCmd | |
588 bwipe! | |
577 endfunc | 589 endfunc |
578 | 590 |
579 func Test_augroup_deleted() | 591 func Test_augroup_deleted() |
580 " This caused a crash before E936 was introduced | 592 " This caused a crash before E936 was introduced |
581 augroup x | 593 augroup x |