comparison src/testdir/test_window_cmd.vim @ 17746:a4e488a6655c v8.1.1870

patch 8.1.1870: using :pedit from a help file sets help filetype commit https://github.com/vim/vim/commit/026587b35c42301bcc2214207346b62ef2efed41 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 17 15:08:00 2019 +0200 patch 8.1.1870: using :pedit from a help file sets help filetype Problem: Using :pedit from a help file sets the preview window to help filetype. (Wang Shidong) Solution: Do not set "keep_help_flag". (closes #3536)
author Bram Moolenaar <Bram@vim.org>
date Sat, 17 Aug 2019 15:15:03 +0200
parents 711db62c8aca
children 8a2fb21c23c0
comparison
equal deleted inserted replaced
17745:de48c18b7d1b 17746:a4e488a6655c
186 wincmd z 186 wincmd z
187 call assert_equal(1, winnr('$')) 187 call assert_equal(1, winnr('$'))
188 call assert_equal(0, &previewwindow) 188 call assert_equal(0, &previewwindow)
189 189
190 call assert_fails('wincmd P', 'E441:') 190 call assert_fails('wincmd P', 'E441:')
191 endfunc
192
193 func Test_window_preview_from_help()
194 filetype on
195 call writefile(['/* some C code */'], 'Xpreview.c')
196 help
197 pedit Xpreview.c
198 wincmd P
199 call assert_equal(1, &previewwindow)
200 call assert_equal('c', &filetype)
201 wincmd z
202
203 filetype off
204 close
205 call delete('Xpreview.c')
191 endfunc 206 endfunc
192 207
193 func Test_window_exchange() 208 func Test_window_exchange()
194 e Xa 209 e Xa
195 210
580 call assert_equal(3, winwidth(0)) 595 call assert_equal(3, winwidth(0))
581 only 596 only
582 endfunc 597 endfunc
583 598
584 func Fun_RenewFile() 599 func Fun_RenewFile()
600 " Need to wait a bit for the timestamp to be older.
585 sleep 2 601 sleep 2
586 silent execute '!echo "1" > tmp.txt' 602 silent execute '!echo "1" > tmp.txt'
587 sp 603 sp
588 wincmd p 604 wincmd p
589 edit! tmp.txt 605 edit! tmp.txt
597 613
598 set hidden autoread 614 set hidden autoread
599 call writefile(['2'], 'tmp.txt') 615 call writefile(['2'], 'tmp.txt')
600 new tmp.txt 616 new tmp.txt
601 q 617 q
602 " Need to wait a bit for the timestamp to be older.
603 call Fun_RenewFile() 618 call Fun_RenewFile()
604 call assert_equal(2, winnr()) 619 call assert_equal(2, winnr())
605 wincmd p 620 wincmd p
606 call assert_equal(1, winnr()) 621 call assert_equal(1, winnr())
607 wincmd p 622 wincmd p