aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/doc/eval.txt19
-rw-r--r--runtime/filetype.vim8
-rw-r--r--src/nvim/eval.lua1
-rw-r--r--src/nvim/eval/funcs.c25
-rw-r--r--src/nvim/testdir/test_autocmd.vim46
-rw-r--r--src/nvim/testdir/test_cmdline.vim23
-rw-r--r--src/nvim/testdir/test_filetype.vim4
-rw-r--r--src/nvim/testdir/test_popup.vim27
-rw-r--r--src/nvim/testdir/test_preview.vim44
-rw-r--r--src/nvim/testdir/test_visual.vim298
-rw-r--r--src/nvim/testdir/test_window_cmd.vim33
11 files changed, 475 insertions, 53 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 7c6013f1b2..343e35bf66 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -2487,6 +2487,7 @@ wait({timeout}, {condition}[, {interval}])
wildmenumode() Number whether 'wildmenu' mode is active
win_findbuf({bufnr}) List find windows containing {bufnr}
win_getid([{win} [, {tab}]]) Number get |window-ID| for {win} in {tab}
+win_gettype([{nr}]) String type of window {nr}
win_gotoid({expr}) Number go to |window-ID| {expr}
win_id2tabwin({expr}) List get tab and window nr from |window-ID|
win_id2win({expr}) Number get window nr from |window-ID|
@@ -9277,6 +9278,24 @@ win_getid([{win} [, {tab}]]) *win_getid()*
number {tab}. The first tab has number one.
Return zero if the window cannot be found.
+win_gettype([{nr}]) *win_gettype()*
+ Return the type of the window:
+ "autocmd" 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
+
+ When {nr} is omitted return the type of the current window.
+ When {nr} is given return the type of this window by number or
+ |window-ID|.
+
+ Also see the 'buftype' option. When running a terminal in a
+ popup window then 'buftype' is "terminal" and win_gettype()
+ returns "popup".
+
win_gotoid({expr}) *win_gotoid()*
Go to window with ID {expr}. This may also change the current
tabpage.
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index 4e54bcaefd..b9d2a43d5d 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -693,15 +693,9 @@ au BufNewFile,BufRead *.haml setf haml
" Hamster Classic | Playground files
au BufNewFile,BufRead *.hsm setf hamster
-au BufNewFile,BufRead *.hsc
- \ if match(join(getline(1,10), "\n"), '\%(^\|\n\)\s*\%({-#\_s*LANGUAGE\>\|\<module\>\)') != -1 |
- \ setf haskell |
- \ else |
- \ setf hamster |
- \ endif
" Haskell
-au BufNewFile,BufRead *.hs,*.hs-boot setf haskell
+au BufNewFile,BufRead *.hs,*.hsc,*.hs-boot setf haskell
au BufNewFile,BufRead *.lhs setf lhaskell
au BufNewFile,BufRead *.chs setf chaskell
au BufNewFile,BufRead cabal.project setf cabalproject
diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua
index 6c316bb1fe..9f1994e299 100644
--- a/src/nvim/eval.lua
+++ b/src/nvim/eval.lua
@@ -385,6 +385,7 @@ return {
wildmenumode={},
win_findbuf={args=1},
win_getid={args={0,2}},
+ win_gettype={args={0,1}},
win_gotoid={args=1},
win_id2tabwin={args=1},
win_id2win={args=1},
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index 62a8022734..901f20bedf 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -10992,6 +10992,31 @@ static void f_win_getid(typval_T *argvars, typval_T *rettv, FunPtr fptr)
rettv->vval.v_number = win_getid(argvars);
}
+/// "win_gettype(nr)" function
+static void f_win_gettype(typval_T *argvars, typval_T *rettv, FunPtr fptr)
+{
+ win_T *wp = curwin;
+
+ rettv->v_type = VAR_STRING;
+ rettv->vval.v_string = NULL;
+ if (argvars[0].v_type != VAR_UNKNOWN) {
+ wp = find_win_by_nr_or_id(&argvars[0]);
+ if (wp == NULL) {
+ rettv->vval.v_string = vim_strsave((char_u *)"unknown");
+ return;
+ }
+ }
+ if (wp == aucmd_win) {
+ rettv->vval.v_string = vim_strsave((char_u *)"autocmd");
+ } else if (wp->w_p_pvw) {
+ rettv->vval.v_string = vim_strsave((char_u *)"preview");
+ } else if (wp->w_floating) {
+ rettv->vval.v_string = vim_strsave((char_u *)"popup");
+ } else if (wp == curwin && cmdwin_type != 0) {
+ rettv->vval.v_string = vim_strsave((char_u *)"command");
+ }
+}
+
/// "win_gotoid()" function
static void f_win_gotoid(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim
index 04a678eeb8..1fa7eeaea0 100644
--- a/src/nvim/testdir/test_autocmd.vim
+++ b/src/nvim/testdir/test_autocmd.vim
@@ -696,6 +696,7 @@ func Test_OptionSet_diffmode_close()
call setline(1, ['buffer 2', 'line 2', 'line 3', 'line4'])
call assert_fails(':diffthis', 'E788')
call assert_equal(1, &diff)
+ set diffopt-=closeoff
bw!
call assert_fails(':diffoff!', 'E788')
bw!
@@ -1856,6 +1857,29 @@ func Test_FileChangedShell_reload()
call delete('Xchanged')
endfunc
+func LogACmd()
+ call add(g:logged, line('$'))
+endfunc
+
+func Test_TermChanged()
+ throw 'skipped: Nvim does not support TermChanged event'
+ CheckNotGui
+
+ enew!
+ tabnew
+ call setline(1, ['a', 'b', 'c', 'd'])
+ $
+ au TermChanged * call LogACmd()
+ let g:logged = []
+ let term_save = &term
+ set term=xterm
+ call assert_equal([1, 4], g:logged)
+
+ au! TermChanged
+ let &term = term_save
+ bwipe!
+endfunc
+
" Test for FileReadCmd autocmd
func Test_autocmd_FileReadCmd()
func ReadFileCmd()
@@ -1910,4 +1934,26 @@ func Test_autocmd_sigusr1()
unlet g:sigusr1_passed
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', 'autocmd'], ['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/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim
index e3c42a4fe3..81f653c393 100644
--- a/src/nvim/testdir/test_cmdline.vim
+++ b/src/nvim/testdir/test_cmdline.vim
@@ -796,6 +796,29 @@ func Test_cmdwin_feedkeys()
call feedkeys("q:\<CR>", 'x')
endfunc
+" Tests for the issues fixed in 7.4.441.
+" When 'cedit' is set to Ctrl-C, opening the command window hangs Vim
+func Test_cmdwin_cedit()
+ exe "set cedit=\<C-c>"
+ normal! :
+ call assert_equal(1, winnr('$'))
+
+ let g:cmd_wintype = ''
+ func CmdWinType()
+ let g:cmd_wintype = getcmdwintype()
+ let g:wintype = win_gettype()
+ return ''
+ endfunc
+
+ call feedkeys("\<C-c>a\<C-R>=CmdWinType()\<CR>\<CR>")
+ echo input('')
+ call assert_equal('@', g:cmd_wintype)
+ call assert_equal('command', g:wintype)
+
+ set cedit&vim
+ delfunc CmdWinType
+endfunc
+
func Test_buffers_lastused()
" check that buffers are sorted by time when wildmode has lastused
edit bufc " oldest
diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim
index ed75bda7a5..52b5884c8b 100644
--- a/src/nvim/testdir/test_filetype.vim
+++ b/src/nvim/testdir/test_filetype.vim
@@ -200,8 +200,8 @@ let s:filename_checks = {
\ 'gsp': ['file.gsp'],
\ 'gtkrc': ['.gtkrc', 'gtkrc'],
\ 'haml': ['file.haml'],
- \ 'hamster': ['file.hsc', 'file.hsm'],
- \ 'haskell': ['file.hs', 'file.hs-boot'],
+ \ 'hamster': ['file.hsm'],
+ \ 'haskell': ['file.hs', 'file.hsc', 'file.hs-boot'],
\ 'haste': ['file.ht'],
\ 'hastepreproc': ['file.htpp'],
\ 'hb': ['file.hb'],
diff --git a/src/nvim/testdir/test_popup.vim b/src/nvim/testdir/test_popup.vim
index fb464d95ea..4ee16558a0 100644
--- a/src/nvim/testdir/test_popup.vim
+++ b/src/nvim/testdir/test_popup.vim
@@ -735,20 +735,25 @@ func Test_popup_and_preview_autocommand()
endfunc
func Test_popup_and_previewwindow_dump()
- if !CanRunVimInTerminal()
- return
- endif
- call writefile([
- \ 'set previewheight=9',
- \ 'silent! pedit',
- \ 'call setline(1, map(repeat(["ab"], 10), "v:val. v:key"))',
- \ 'exec "norm! G\<C-E>\<C-E>"',
- \ ], 'Xscript')
+ CheckScreendump
+ CheckFeature quickfix
+
+ let lines =<< trim END
+ set previewheight=9
+ silent! pedit
+ call setline(1, map(repeat(["ab"], 10), "v:val .. v:key"))
+ exec "norm! G\<C-E>\<C-E>"
+ END
+ call writefile(lines, 'Xscript')
let buf = RunVimInTerminal('-S Xscript', {})
+ " wait for the script to finish
+ call term_wait(buf)
+
" Test that popup and previewwindow do not overlap.
- call term_sendkeys(buf, "o\<C-X>\<C-N>")
- sleep 100m
+ call term_sendkeys(buf, "o")
+ call term_wait(buf, 100)
+ call term_sendkeys(buf, "\<C-X>\<C-N>")
call VerifyScreenDump(buf, 'Test_popup_and_previewwindow_01', {})
call term_sendkeys(buf, "\<Esc>u")
diff --git a/src/nvim/testdir/test_preview.vim b/src/nvim/testdir/test_preview.vim
index 91923fb1e9..6c4ae414d3 100644
--- a/src/nvim/testdir/test_preview.vim
+++ b/src/nvim/testdir/test_preview.vim
@@ -11,3 +11,47 @@ func Test_Psearch()
call assert_equal(wincount, winnr('$'))
bwipe
endfunc
+
+func Test_window_preview()
+ " Open a preview window
+ pedit Xa
+ call assert_equal(2, winnr('$'))
+ call assert_equal(0, &previewwindow)
+
+ " Go to the preview window
+ wincmd P
+ call assert_equal(1, &previewwindow)
+ call assert_equal('preview', win_gettype())
+
+ " Close preview window
+ wincmd z
+ call assert_equal(1, winnr('$'))
+ call assert_equal(0, &previewwindow)
+
+ call assert_fails('wincmd P', 'E441:')
+endfunc
+
+func Test_window_preview_from_help()
+ filetype on
+ call writefile(['/* some C code */'], 'Xpreview.c')
+ help
+ pedit Xpreview.c
+ wincmd P
+ call assert_equal(1, &previewwindow)
+ call assert_equal('c', &filetype)
+ wincmd z
+
+ filetype off
+ close
+ call delete('Xpreview.c')
+endfunc
+
+func Test_multiple_preview_windows()
+ new
+ set previewwindow
+ new
+ call assert_fails('set previewwindow', 'E590:')
+ %bw!
+endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/nvim/testdir/test_visual.vim b/src/nvim/testdir/test_visual.vim
index 734f264672..7f50894f66 100644
--- a/src/nvim/testdir/test_visual.vim
+++ b/src/nvim/testdir/test_visual.vim
@@ -442,4 +442,302 @@ func Test_visual_put_in_block()
bwipe!
endfunc
+" Visual modes (v V CTRL-V) followed by an operator; count; repeating
+func Test_visual_mode_op()
+ new
+ call append(0, '')
+
+ call setline(1, 'apple banana cherry')
+ call cursor(1, 1)
+ normal lvld.l3vd.
+ call assert_equal('a y', getline(1))
+
+ call setline(1, ['line 1 line 1', 'line 2 line 2', 'line 3 line 3',
+ \ 'line 4 line 4', 'line 5 line 5', 'line 6 line 6'])
+ call cursor(1, 1)
+ exe "normal Vcnewline\<Esc>j.j2Vd."
+ call assert_equal(['newline', 'newline'], getline(1, '$'))
+
+ call deletebufline('', 1, '$')
+ call setline(1, ['xxxxxxxxxxxxx', 'xxxxxxxxxxxxx', 'xxxxxxxxxxxxx',
+ \ 'xxxxxxxxxxxxx'])
+ exe "normal \<C-V>jlc \<Esc>l.l2\<C-V>c----\<Esc>l."
+ call assert_equal([' --------x',
+ \ ' --------x',
+ \ 'xxxx--------x',
+ \ 'xxxx--------x'], getline(1, '$'))
+
+ bwipe!
+endfunc
+
+" Visual mode maps (movement and text object)
+" Visual mode maps; count; repeating
+" - Simple
+" - With an Ex command (custom text object)
+func Test_visual_mode_maps()
+ new
+ call append(0, '')
+
+ func SelectInCaps()
+ let [line1, col1] = searchpos('\u', 'bcnW')
+ let [line2, col2] = searchpos('.\u', 'nW')
+ call setpos("'<", [0, line1, col1, 0])
+ call setpos("'>", [0, line2, col2, 0])
+ normal! gv
+ endfunction
+
+ vnoremap W /\u/s-1<CR>
+ vnoremap iW :<C-U>call SelectInCaps()<CR>
+
+ call setline(1, 'KiwiRaspberryDateWatermelonPeach')
+ call cursor(1, 1)
+ exe "normal vWcNo\<Esc>l.fD2vd."
+ call assert_equal('NoNoberryach', getline(1))
+
+ call setline(1, 'JambuRambutanBananaTangerineMango')
+ call cursor(1, 1)
+ exe "normal llviWc-\<Esc>l.l2vdl."
+ call assert_equal('--ago', getline(1))
+
+ vunmap W
+ vunmap iW
+ bwipe!
+ delfunc SelectInCaps
+endfunc
+
+" Operator-pending mode maps (movement and text object)
+" - Simple
+" - With Ex command moving the cursor
+" - With Ex command and Visual selection (custom text object)
+func Test_visual_oper_pending_mode_maps()
+ new
+ call append(0, '')
+
+ func MoveToCap()
+ call search('\u', 'W')
+ endfunction
+
+ func SelectInCaps()
+ let [line1, col1] = searchpos('\u', 'bcnW')
+ let [line2, col2] = searchpos('.\u', 'nW')
+ call setpos("'<", [0, line1, col1, 0])
+ call setpos("'>", [0, line2, col2, 0])
+ normal! gv
+ endfunction
+
+ onoremap W /\u/<CR>
+ onoremap <Leader>W :<C-U>call MoveToCap()<CR>
+ onoremap iW :<C-U>call SelectInCaps()<CR>
+
+ call setline(1, 'PineappleQuinceLoganberryOrangeGrapefruitKiwiZ')
+ call cursor(1, 1)
+ exe "normal cW-\<Esc>l.l2.l."
+ call assert_equal('----Z', getline(1))
+
+ call setline(1, 'JuniperDurianZ')
+ call cursor(1, 1)
+ exe "normal g?\WfD."
+ call assert_equal('WhavcreQhevnaZ', getline(1))
+
+ call setline(1, 'LemonNectarineZ')
+ call cursor(1, 1)
+ exe "normal yiWPlciWNew\<Esc>fr."
+ call assert_equal('LemonNewNewZ', getline(1))
+
+ ounmap W
+ ounmap <Leader>W
+ ounmap iW
+ bwipe!
+ delfunc MoveToCap
+ delfunc SelectInCaps
+endfunc
+
+" Patch 7.3.879: Properly abort Operator-pending mode for "dv:<Esc>" etc.
+func Test_op_pend_mode_abort()
+ new
+ call append(0, '')
+
+ call setline(1, ['zzzz', 'zzzz'])
+ call cursor(1, 1)
+
+ exe "normal dV:\<CR>dv:\<CR>"
+ call assert_equal(['zzz'], getline(1, 2))
+ set nomodifiable
+ call assert_fails('exe "normal d:\<CR>"', 'E21:')
+ set modifiable
+ call feedkeys("dv:\<Esc>dV:\<Esc>", 'xt')
+ call assert_equal(['zzz'], getline(1, 2))
+ set nomodifiable
+ let v:errmsg = ''
+ call feedkeys("d:\<Esc>", 'xt')
+ call assert_true(v:errmsg !~# '^E21:')
+ set modifiable
+
+ bwipe!
+endfunc
+
+func Test_characterwise_visual_mode()
+ new
+
+ " characterwise visual mode: replace last line
+ $put ='a'
+ let @" = 'x'
+ normal v$p
+ call assert_equal('x', getline('$'))
+
+ " characterwise visual mode: delete middle line
+ call deletebufline('', 1, '$')
+ call append('$', ['a', 'b', 'c'])
+ normal G
+ normal kkv$d
+ call assert_equal(['', 'b', 'c'], getline(1, '$'))
+
+ " characterwise visual mode: delete middle two lines
+ call deletebufline('', 1, '$')
+ call append('$', ['a', 'b', 'c'])
+ normal Gkkvj$d
+ call assert_equal(['', 'c'], getline(1, '$'))
+
+ " characterwise visual mode: delete last line
+ call deletebufline('', 1, '$')
+ call append('$', ['a', 'b', 'c'])
+ normal Gv$d
+ call assert_equal(['', 'a', 'b', ''], getline(1, '$'))
+
+ " characterwise visual mode: delete last two lines
+ call deletebufline('', 1, '$')
+ call append('$', ['a', 'b', 'c'])
+ normal Gkvj$d
+ call assert_equal(['', 'a', ''], getline(1, '$'))
+
+ bwipe!
+endfunc
+
+func Test_characterwise_select_mode()
+ new
+
+ " Select mode maps
+ snoremap <lt>End> <End>
+ snoremap <lt>Down> <Down>
+ snoremap <lt>Del> <Del>
+
+ " characterwise select mode: delete middle line
+ call deletebufline('', 1, '$')
+ call append('$', ['a', 'b', 'c'])
+ exe "normal Gkkgh\<End>\<Del>"
+ call assert_equal(['', 'b', 'c'], getline(1, '$'))
+
+ " characterwise select mode: delete middle two lines
+ call deletebufline('', 1, '$')
+ call append('$', ['a', 'b', 'c'])
+ exe "normal Gkkgh\<Down>\<End>\<Del>"
+ call assert_equal(['', 'c'], getline(1, '$'))
+
+ " characterwise select mode: delete last line
+ call deletebufline('', 1, '$')
+ call append('$', ['a', 'b', 'c'])
+ exe "normal Ggh\<End>\<Del>"
+ call assert_equal(['', 'a', 'b', ''], getline(1, '$'))
+
+ " characterwise select mode: delete last two lines
+ call deletebufline('', 1, '$')
+ call append('$', ['a', 'b', 'c'])
+ exe "normal Gkgh\<Down>\<End>\<Del>"
+ call assert_equal(['', 'a', ''], getline(1, '$'))
+
+ sunmap <lt>End>
+ sunmap <lt>Down>
+ sunmap <lt>Del>
+ bwipe!
+endfunc
+
+func Test_linewise_select_mode()
+ new
+
+ " linewise select mode: delete middle line
+ call append('$', ['a', 'b', 'c'])
+ exe "normal GkkgH\<Del>"
+ call assert_equal(['', 'b', 'c'], getline(1, '$'))
+
+
+ " linewise select mode: delete middle two lines
+ call deletebufline('', 1, '$')
+ call append('$', ['a', 'b', 'c'])
+ exe "normal GkkgH\<Down>\<Del>"
+ call assert_equal(['', 'c'], getline(1, '$'))
+
+ " linewise select mode: delete last line
+ call deletebufline('', 1, '$')
+ call append('$', ['a', 'b', 'c'])
+ exe "normal GgH\<Del>"
+ call assert_equal(['', 'a', 'b'], getline(1, '$'))
+
+ " linewise select mode: delete last two lines
+ call deletebufline('', 1, '$')
+ call append('$', ['a', 'b', 'c'])
+ exe "normal GkgH\<Down>\<Del>"
+ call assert_equal(['', 'a'], getline(1, '$'))
+
+ bwipe!
+endfunc
+
+func Test_visual_mode_put()
+ new
+
+ " v_p: replace last character with line register at middle line
+ call append('$', ['aaa', 'bbb', 'ccc'])
+ normal G
+ -2yank
+ normal k$vp
+ call assert_equal(['', 'aaa', 'bb', 'aaa', '', 'ccc'], getline(1, '$'))
+
+ " v_p: replace last character with line register at middle line selecting
+ " newline
+ call deletebufline('', 1, '$')
+ call append('$', ['aaa', 'bbb', 'ccc'])
+ normal G
+ -2yank
+ normal k$v$p
+ call assert_equal(['', 'aaa', 'bb', 'aaa', 'ccc'], getline(1, '$'))
+
+ " v_p: replace last character with line register at last line
+ call deletebufline('', 1, '$')
+ call append('$', ['aaa', 'bbb', 'ccc'])
+ normal G
+ -2yank
+ normal $vp
+ call assert_equal(['', 'aaa', 'bbb', 'cc', 'aaa', ''], getline(1, '$'))
+
+ " v_p: replace last character with line register at last line selecting
+ " newline
+ call deletebufline('', 1, '$')
+ call append('$', ['aaa', 'bbb', 'ccc'])
+ normal G
+ -2yank
+ normal $v$p
+ call assert_equal(['', 'aaa', 'bbb', 'cc', 'aaa', ''], getline(1, '$'))
+
+ bwipe!
+endfunc
+
+func Test_select_mode_gv()
+ new
+
+ " gv in exclusive select mode after operation
+ call append('$', ['zzz ', 'äà '])
+ set selection=exclusive
+ normal Gkv3lyjv3lpgvcxxx
+ call assert_equal(['', 'zzz ', 'xxx '], getline(1, '$'))
+
+ " gv in exclusive select mode without operation
+ call deletebufline('', 1, '$')
+ call append('$', 'zzz ')
+ set selection=exclusive
+ exe "normal G0v3l\<Esc>gvcxxx"
+ call assert_equal(['', 'xxx '], getline(1, '$'))
+
+ set selection&vim
+ bwipe!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/nvim/testdir/test_window_cmd.vim b/src/nvim/testdir/test_window_cmd.vim
index 500e3ff088..c630e678fd 100644
--- a/src/nvim/testdir/test_window_cmd.vim
+++ b/src/nvim/testdir/test_window_cmd.vim
@@ -172,39 +172,6 @@ func Test_window_split_edit_bufnr()
%bw!
endfunc
-func Test_window_preview()
- " Open a preview window
- pedit Xa
- call assert_equal(2, winnr('$'))
- call assert_equal(0, &previewwindow)
-
- " Go to the preview window
- wincmd P
- call assert_equal(1, &previewwindow)
-
- " Close preview window
- wincmd z
- call assert_equal(1, winnr('$'))
- call assert_equal(0, &previewwindow)
-
- call assert_fails('wincmd P', 'E441:')
-endfunc
-
-func Test_window_preview_from_help()
- filetype on
- call writefile(['/* some C code */'], 'Xpreview.c')
- help
- pedit Xpreview.c
- wincmd P
- call assert_equal(1, &previewwindow)
- call assert_equal('c', &filetype)
- wincmd z
-
- filetype off
- close
- call delete('Xpreview.c')
-endfunc
-
func Test_window_exchange()
e Xa