Hi Bram,

On Wed, May 20, 2020 at 2:32 PM Bram Moolenaar <vim-dev-git...@256bit.org>
wrote:

> I don't think any of the codes fail, I think it has to do with the length.
> Try testing with ten times all the function keys and see what gets returned.
>
>
>
I think there is a bug in handling the keypad number keys. I have modified
the Test_term_keycode_translation() function to send each special key
separately and check the output. This fails when handling the keypad
number keys on MacOS. If I modify the test to only send the keypad
keys, then the test passes. I am attaching the updated test function.

- Yegappan

==========================================================
" Test for sending various special keycodes to a terminal
func Test_term_keycode_translation()
  CheckRunVimInTerminal

  let buf = RunVimInTerminal('', {})
  call term_sendkeys(buf, ":set nocp bs=2\<CR>")

  let keys = ["\<F1>", "\<F2>", "\<F3>", "\<F4>", "\<F5>", "\<F6>", "\<F7>",
        \ "\<F8>", "\<F9>", "\<F10>", "\<F11>", "\<F12>", "\<Home>",
        \ "\<S-Home>", "\<C-Home>", "\<End>", "\<S-End>", "\<C-End>",
\ "\<Ins>", "\<Del>", "\<Left>", "\<S-Left>", "\<C-Left>", "\<Right>",
        \ "\<S-Right>", "\<C-Right>", "\<Up>", "\<S-Up>", "\<Down>",
        \ "\<S-Down>"]
  let output = ['<F1>', '<F2>', '<F3>', '<F4>', '<F5>', '<F6>', '<F7>',
        \ '<F8>', '<F9>', '<F10>', '<F11>', '<F12>', '<Home>', '<S-Home>',
        \ '<C-Home>', '<End>', '<S-End>', '<C-End>', '<Insert>', '<Del>',
        \ '<Left>', '<S-Left>', '<C-Left>', '<Right>', '<S-Right>',
        \ '<C-Right>', '<Up>', '<S-Up>', '<Down>', '<S-Down>']

  call term_sendkeys(buf, "i")
  for i in range(len(keys))
    call term_sendkeys(buf, "\<C-U>\<C-K>" .. keys[i])
    call term_wait(buf)
    call assert_equal(output[i], term_getline(buf, 1))
  endfor

  let num_keys = ["\<k0>", "\<k1>", "\<k2>", "\<k3>", "\<k4>", "\<k5>",
        \ "\<k6>", "\<k7>", "\<k8>", "\<k9>", "\<kPoint>", "\<kPlus>",
        \ "\<kMinus>", "\<kMultiply>", "\<kDivide>"]
  let num_output = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.',
        \ '+', '-', '*', '/']
  for i in range(len(num_keys))
    call term_sendkeys(buf, "\<C-U>" .. num_keys[i])
    call term_wait(buf)
    call assert_equal(num_output[i], term_getline(buf, 1))
  endfor

  call feedkeys("\<C-U>\<kEnter>\<bs>one\<C-W>.two", 'xt')
  call term_wait(buf)
  call assert_equal('two', term_getline(buf, 1))

  call term_wait(buf)
  call StopVimInTerminal(buf)
endfunc

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/CAAW7x7mx3o8AjocRUaNw531o5SFb4WUarCFS9P7Chqi3yX5cHg%40mail.gmail.com.

Raspunde prin e-mail lui