Patch 8.2.0991
Problem: Cannot get window type for autocmd and preview window.
Solution: Add types to win_gettype(). (Yegappan Lakshmanan, closes #6277)
Files: runtime/doc/eval.txt, src/evalwindow.c,
src/testdir/test_autocmd.vim, src/testdir/test_preview.vim
*** ../vim-8.2.0990/runtime/doc/eval.txt 2020-06-16 20:03:38.739351068
+0200
--- runtime/doc/eval.txt 2020-06-16 22:38:53.417732660 +0200
***************
*** 10851,10857 ****
--- 10866,10875 ----
win_gettype([{nr}]) *win_gettype()*
Return the type of the window:
+ "aucmdwin" autocommand window. Temporary window
+ used to execute autocommands.
"popup" popup window |popup|
+ "preview" preview window |preview-window|
"command" command-line window |cmdwin|
(empty) normal window
"unknown" window {nr} not found
*** ../vim-8.2.0990/src/evalwindow.c 2020-04-06 22:12:57.137652853 +0200
--- src/evalwindow.c 2020-06-16 22:38:53.417732660 +0200
***************
*** 858,870 ****
return;
}
}
#ifdef FEAT_PROP_POPUP
! 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)
rettv->vval.v_string = vim_strsave((char_u *)"command");
#endif
}
--- 858,875 ----
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
! else if (WIN_IS_POPUP(wp))
rettv->vval.v_string = vim_strsave((char_u *)"popup");
#endif
#ifdef FEAT_CMDWIN
! else if (wp == curwin && cmdwin_type != 0)
rettv->vval.v_string = vim_strsave((char_u *)"command");
#endif
}
*** ../vim-8.2.0990/src/testdir/test_autocmd.vim 2020-06-15
19:51:52.637404472 +0200
--- src/testdir/test_autocmd.vim 2020-06-16 22:38:53.417732660 +0200
***************
*** 2579,2582 ****
--- 2579,2604 ----
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
*** ../vim-8.2.0990/src/testdir/test_preview.vim 2020-04-06
21:35:02.464237765 +0200
--- src/testdir/test_preview.vim 2020-06-16 22:38:53.417732660 +0200
***************
*** 25,30 ****
--- 25,31 ----
" Go to the preview window
wincmd P
call assert_equal(1, &previewwindow)
+ call assert_equal('preview', win_gettype())
" Close preview window
wincmd z
*** ../vim-8.2.0990/src/version.c 2020-06-16 22:27:35.827988257 +0200
--- src/version.c 2020-06-16 22:40:26.609536515 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 991,
/**/
--
MARTHA'S WAY: Don't throw out all that leftover wine. Freeze into ice cubes
for future use in casseroles and sauces.
MY WAY: What leftover wine?
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202006162043.05GKhCtU1451598%40masaka.moolenaar.net.