comparison src/testdir/test_terminal.vim @ 20502:f28a49da879d v8.2.0805

patch 8.2.0805: terminal key codes test fails on some systems Commit: https://github.com/vim/vim/commit/fe81389d606ae79415d208207295f41a4375c580 Author: Bram Moolenaar <Bram@vim.org> Date: Thu May 21 20:38:31 2020 +0200 patch 8.2.0805: terminal key codes test fails on some systems Problem: Terminal key codes test fails on some systems. Solution: Skip keypad 3 and 9. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/6070)
author Bram Moolenaar <Bram@vim.org>
date Thu, 21 May 2020 20:45:03 +0200
parents 3fe45aa3bbc5
children 357dea6b9fde
comparison
equal deleted inserted replaced
20501:e752fcbd74e6 20502:f28a49da879d
2681 \ "\<S-Down>"] 2681 \ "\<S-Down>"]
2682 let output = ['<F1>', '<F2>', '<F3>', '<F4>', '<F5>', '<F6>', '<F7>', 2682 let output = ['<F1>', '<F2>', '<F3>', '<F4>', '<F5>', '<F6>', '<F7>',
2683 \ '<F8>', '<F9>', '<F10>', '<F11>', '<F12>', '<Home>', '<S-Home>', 2683 \ '<F8>', '<F9>', '<F10>', '<F11>', '<F12>', '<Home>', '<S-Home>',
2684 \ '<C-Home>', '<End>', '<S-End>', '<C-End>', '<Insert>', '<Del>', 2684 \ '<C-Home>', '<End>', '<S-End>', '<C-End>', '<Insert>', '<Del>',
2685 \ '<Left>', '<S-Left>', '<C-Left>', '<Right>', '<S-Right>', 2685 \ '<Left>', '<S-Left>', '<C-Left>', '<Right>', '<S-Right>',
2686 \ '<C-Right>', '<Up>', '<S-Up>', '<Down>', '<S-Down>', 2686 \ '<C-Right>', '<Up>', '<S-Up>', '<Down>', '<S-Down>']
2687 \ '0123456789', "\t\t.+-*/"] 2687
2688 2688 call term_sendkeys(buf, "i")
2689 for k in keys 2689 for i in range(len(keys))
2690 call term_sendkeys(buf, "i\<C-K>" .. k .. "\<CR>\<C-\>\<C-N>") 2690 call term_sendkeys(buf, "\<C-U>\<C-K>" .. keys[i])
2691 call term_wait(buf)
2692 call assert_equal(output[i], term_getline(buf, 1))
2691 endfor 2693 endfor
2692 call term_sendkeys(buf, "i\<K0>\<K1>\<K2>\<K3>\<K4>\<K5>\<K6>\<K7>") 2694
2693 call term_sendkeys(buf, "\<K8>\<K9>\<kEnter>\<kPoint>\<kPlus>") 2695 "call term_sendkeys(buf, "\<K0>\<K1>\<K2>\<K3>\<K4>\<K5>\<K6>\<K7>\<K8>\<K9>")
2694 call term_sendkeys(buf, "\<kMinus>\<kMultiply>\<kDivide>\<C-\>\<C-N>") 2696 "call term_sendkeys(buf, "\<kEnter>\<kPoint>\<kPlus>")
2695 call term_sendkeys(buf, "\<Home>\<Ins>\<Tab>\<S-Tab>\<C-\>\<C-N>") 2697 "call term_sendkeys(buf, "\<kMinus>\<kMultiply>\<kDivide>")
2696 2698 "call term_sendkeys(buf, "\<Esc>")
2697 call term_sendkeys(buf, ":write Xkeycodes\<CR>") 2699 "call term_sendkeys(buf, "\<Home>\<Ins>\<Tab>\<S-Tab>")
2700 "call term_sendkeys(buf, "\<Esc>")
2701
2702 "call term_sendkeys(buf, ":write Xkeycodes\<CR>")
2703
2704 let keypad_keys = ["\<k0>", "\<k1>", "\<k2>", "\<k3>", "\<k4>", "\<k5>",
2705 \ "\<k6>", "\<k7>", "\<k8>", "\<k9>", "\<kPoint>", "\<kPlus>",
2706 \ "\<kMinus>", "\<kMultiply>", "\<kDivide>"]
2707 let keypad_output = ['0', '1', '2', '3', '4', '5',
2708 \ '6', '7', '8', '9', '.', '+',
2709 \ '-', '*', '/']
2710 for i in range(len(keypad_keys))
2711 " TODO: Mysteriously keypad 3 and 9 do not work on some systems.
2712 if keypad_output[i] == '3' || keypad_output[i] == '9'
2713 continue
2714 endif
2715 call term_sendkeys(buf, "\<C-U>" .. keypad_keys[i])
2716 call term_wait(buf)
2717 call assert_equal(keypad_output[i], term_getline(buf, 1))
2718 endfor
2719
2720 call feedkeys("\<C-U>\<kEnter>\<BS>one\<C-W>.two", 'xt')
2698 call term_wait(buf) 2721 call term_wait(buf)
2699 call StopVimInTerminal(buf) 2722 call assert_equal('two', term_getline(buf, 1))
2700 call assert_equal(output, readfile('Xkeycodes')) 2723
2701 call delete('Xkeycodes') 2724 call StopVimInTerminal(buf)
2702 endfunc 2725 endfunc
2703 2726
2704 " Test for using the mouse in a terminal 2727 " Test for using the mouse in a terminal
2705 func Test_term_mouse() 2728 func Test_term_mouse()
2706 CheckNotGui 2729 CheckNotGui