comparison src/testdir/test_termcodes.vim @ 23774:646ca2893d85 v8.2.2428

patch 8.2.2428: FocusGained does not work when 'ttymouse' is empty Commit: https://github.com/vim/vim/commit/92e5df804719d2e6cb8145c2b098aa8d6f3dd252 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jan 30 15:39:47 2021 +0100 patch 8.2.2428: FocusGained does not work when 'ttymouse' is empty Problem: FocusGained does not work when 'ttymouse' is empty. Solution: Don't use the short mouse code if there is a longer matching code. (closes #7755) Add a test.
author Bram Moolenaar <Bram@vim.org>
date Sat, 30 Jan 2021 15:45:06 +0100
parents 93f90f2ff4e9
children ec71c859e94c
comparison
equal deleted inserted replaced
23773:6421ad10789a 23774:646ca2893d85
1866 1866
1867 set t_RV= 1867 set t_RV=
1868 call test_override('term_props', 0) 1868 call test_override('term_props', 0)
1869 endfunc 1869 endfunc
1870 1870
1871 func Test_focus_events()
1872 let save_term = &term
1873 let save_ttymouse = &ttymouse
1874 set term=xterm ttymouse=xterm2
1875
1876 au FocusGained * let g:focus_gained += 1
1877 au FocusLost * let g:focus_lost += 1
1878 let g:focus_gained = 0
1879 let g:focus_lost = 0
1880
1881 call feedkeys("\<Esc>[O", "Lx!")
1882 call assert_equal(1, g:focus_lost)
1883 call feedkeys("\<Esc>[I", "Lx!")
1884 call assert_equal(1, g:focus_gained)
1885
1886 " still works when 'ttymouse' is empty
1887 set ttymouse=
1888 call feedkeys("\<Esc>[O", "Lx!")
1889 call assert_equal(2, g:focus_lost)
1890 call feedkeys("\<Esc>[I", "Lx!")
1891 call assert_equal(2, g:focus_gained)
1892
1893 au! FocusGained
1894 au! FocusLost
1895 let &term = save_term
1896 let &ttymouse = save_ttymouse
1897 endfunc
1898
1871 func Test_get_termcode() 1899 func Test_get_termcode()
1872 try 1900 try
1873 let k1 = &t_k1 1901 let k1 = &t_k1
1874 catch /E113/ 1902 catch /E113/
1875 throw 'Skipped: Unable to query termcodes' 1903 throw 'Skipped: Unable to query termcodes'
2259 2287
2260 set timeoutlen& 2288 set timeoutlen&
2261 endfunc 2289 endfunc
2262 2290
2263 " Test for translation of special key codes (<xF1>, <xF2>, etc.) 2291 " Test for translation of special key codes (<xF1>, <xF2>, etc.)
2264 func Test_Keycode_Tranlsation() 2292 func Test_Keycode_Translation()
2265 let keycodes = [ 2293 let keycodes = [
2266 \ ["<xUp>", "<Up>"], 2294 \ ["<xUp>", "<Up>"],
2267 \ ["<xDown>", "<Down>"], 2295 \ ["<xDown>", "<Down>"],
2268 \ ["<xLeft>", "<Left>"], 2296 \ ["<xLeft>", "<Left>"],
2269 \ ["<xRight>", "<Right>"], 2297 \ ["<xRight>", "<Right>"],