Skip to content

Commit 9c4feff

Browse files
committed
patch 8.0.0688: cannot resize the window in a FileType autocommand
Problem: Cannot resize the window in a FileType autocommand. (Ingo Karkat) Solution: Add the CMDWIN flag to :resize. (test by Ingo Karkat, closes #1804)
1 parent 86f100d commit 9c4feff

File tree

3 files changed

+35
-14
lines changed

3 files changed

+35
-14
lines changed

src/ex_cmds.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@
5151
#define BUFUNL 0x20000L /* accepts unlisted buffer too */
5252
#define ARGOPT 0x40000L /* allow "++opt=val" argument */
5353
#define SBOXOK 0x80000L /* allowed in the sandbox */
54-
#define CMDWIN 0x100000L /* allowed in cmdline window */
54+
#define CMDWIN 0x100000L /* allowed in cmdline window; when missing
55+
* disallows editing another buffer when
56+
* curbuf_lock is set */
5557
#define MODIFY 0x200000L /* forbidden in non-'modifiable' buffer */
5658
#define EXFLAGS 0x400000L /* allow flags after count in argument */
5759
#define FILES (XFILE | EXTRA) /* multiple extra files allowed */
@@ -1176,7 +1178,7 @@ EX(CMD_registers, "registers", ex_display,
11761178
EXTRA|NOTRLCOM|TRLBAR|CMDWIN,
11771179
ADDR_LINES),
11781180
EX(CMD_resize, "resize", ex_resize,
1179-
RANGE|NOTADR|TRLBAR|WORD1,
1181+
RANGE|NOTADR|TRLBAR|WORD1|CMDWIN,
11801182
ADDR_LINES),
11811183
EX(CMD_retab, "retab", ex_retab,
11821184
TRLBAR|RANGE|WHOLEFOLD|DFLALL|BANG|WORD1|CMDWIN|MODIFY,

src/testdir/test_quickfix.vim

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2190,18 +2190,6 @@ func Test_bufoverflow()
21902190
set efm&vim
21912191
endfunc
21922192

2193-
func Test_cclose_from_copen()
2194-
augroup QF_Test
2195-
au!
2196-
au FileType qf :call assert_fails(':cclose', 'E788')
2197-
augroup END
2198-
copen
2199-
augroup QF_Test
2200-
au!
2201-
augroup END
2202-
augroup! QF_Test
2203-
endfunc
2204-
22052193
" Tests for getting the quickfix stack size
22062194
func XsizeTests(cchar)
22072195
call s:setup_commands(a:cchar)
@@ -2231,6 +2219,18 @@ func Test_Qf_Size()
22312219
call XsizeTests('l')
22322220
endfunc
22332221

2222+
func Test_cclose_from_copen()
2223+
augroup QF_Test
2224+
au!
2225+
au FileType qf :call assert_fails(':cclose', 'E788')
2226+
augroup END
2227+
copen
2228+
augroup QF_Test
2229+
au!
2230+
augroup END
2231+
augroup! QF_Test
2232+
endfunc
2233+
22342234
func Test_cclose_in_autocmd()
22352235
" Problem is only triggered if "starting" is zero, so that the OptionsSet
22362236
" event will be triggered.
@@ -2246,3 +2246,20 @@ func Test_cclose_in_autocmd()
22462246
augroup! QF_Test
22472247
call test_override('starting', 0)
22482248
endfunc
2249+
2250+
func Test_resize_from_copen()
2251+
augroup QF_Test
2252+
au!
2253+
au FileType qf resize 5
2254+
augroup END
2255+
try
2256+
" This should succeed without any exception. No other buffers are
2257+
" involved in the autocmd.
2258+
copen
2259+
finally
2260+
augroup QF_Test
2261+
au!
2262+
augroup END
2263+
augroup! QF_Test
2264+
endtry
2265+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
688,
767769
/**/
768770
687,
769771
/**/

0 commit comments

Comments
 (0)