diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-06-16 22:42:04 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-06-16 22:42:04 +0200 |
commit | 0fe937fd8616fcd24b1b1ef2ab9f1657615dd22c (patch) | |
tree | ea589a16e7a487517083f269b4500d6e4cb5d153 /src | |
parent | a1bc6f12936a9f621238b940d5c6e97837809447 (diff) |
patch 8.2.0991: cannot get window type for autocmd and preview windowv8.2.0991
Problem: Cannot get window type for autocmd and preview window.
Solution: Add types to win_gettype(). (Yegappan Lakshmanan, closes #6277)
Diffstat (limited to 'src')
-rw-r--r-- | src/evalwindow.c | 11 | ||||
-rw-r--r-- | src/testdir/test_autocmd.vim | 22 | ||||
-rw-r--r-- | src/testdir/test_preview.vim | 1 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 33 insertions, 3 deletions
diff --git a/src/evalwindow.c b/src/evalwindow.c index 0db45bc9c2..585ff729f3 100644 --- a/src/evalwindow.c +++ b/src/evalwindow.c @@ -858,13 +858,18 @@ f_win_gettype(typval_T *argvars, typval_T *rettv) return; } } + if (wp == aucmd_win) + rettv->vval.v_string = vim_strsave((char_u *)"aucmdwin"); +#if defined(FEAT_QUICKFIX) + else if (wp->w_p_pvw) + rettv->vval.v_string = vim_strsave((char_u *)"preview"); +#endif #ifdef FEAT_PROP_POPUP - if (WIN_IS_POPUP(wp)) + else if (WIN_IS_POPUP(wp)) rettv->vval.v_string = vim_strsave((char_u *)"popup"); - else #endif #ifdef FEAT_CMDWIN - if (wp == curwin && cmdwin_type != 0) + else if (wp == curwin && cmdwin_type != 0) rettv->vval.v_string = vim_strsave((char_u *)"command"); #endif } diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim index ffeaecac00..285d994364 100644 --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -2579,4 +2579,26 @@ func Test_BufDelete_changebuf() close! endfunc +" Test for the temporary internal window used to execute autocmds +func Test_autocmd_window() + %bw! + edit one.txt + tabnew two.txt + let g:blist = [] + augroup aucmd_win_test + au! + au BufEnter * call add(g:blist, [expand('<afile>'), + \ win_gettype(bufwinnr(expand('<afile>')))]) + augroup END + + doautoall BufEnter + call assert_equal([['one.txt', 'aucmdwin'], ['two.txt', '']], g:blist) + + augroup aucmd_win_test + au! + augroup END + augroup! aucmd_win_test + %bw! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_preview.vim b/src/testdir/test_preview.vim index 628ad2bfb4..1bf1d3f8be 100644 --- a/src/testdir/test_preview.vim +++ b/src/testdir/test_preview.vim @@ -25,6 +25,7 @@ func Test_window_preview() " Go to the preview window wincmd P call assert_equal(1, &previewwindow) + call assert_equal('preview', win_gettype()) " Close preview window wincmd z diff --git a/src/version.c b/src/version.c index 57b092a370..9df09d1f90 100644 --- a/src/version.c +++ b/src/version.c @@ -755,6 +755,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 991, +/**/ 990, /**/ 989, |