[vim/vim] Failed test 'test_terminal.vim' after patch 8.2.0738 (#6070)

49 views
Skip to first unread message

Vladimir Lomov

unread,
May 12, 2020, 1:57:09 AM5/12/20
to vim/vim, Subscribed

Describe the bug
test_terminal.vim fails after patch 8.2.0738 (commit 91689ea).

To Reproduce
Detailed steps to reproduce the behavior:

  1. Clone git repository to local host;
  2. configure source
  3. run make
  4. run make -j1 test

Expected behavior
Test should pass.

Environment (please complete the following information):

  • Vim version: 8.2.0740 (git)
  • OS: Archlinux x86_64
  • Terminal: tmux (tests runs with TERM=xterm).

Additional context
Terminal output:

Failures: 
        test86 FAILED
        test87 FAILED
        From test_terminal.vim:
        Found errors in Test_term_keycode_translation():
        Run 1:
        function RunTheTest[39]..Test_term_keycode_translation line 30: Expected ['<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>', '0123456789', '\t\t.+-*/'] but got ['<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>', '', '\t\t.+-*/<S-Left>', '<C-Left>', '<Right>', '<S-Right>', '<C-Right>', '<Up>', '<S-Up>', '<Down>', '<S-Down>', '45678012']
        Run 2:
        function RunTheTest[39]..Test_term_keycode_translation line 30: Expected ['<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>', '0123456789', '\t\t.+-*/'] but got ['<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>', '', '\t\t.+-*/<S-Left>', '<C-Left>', '<Right>', '<S-Right>', '<C-Right>', '<Up>', '<S-Up>', '<Down>', '<S-Down>', '45678012']
        Flaky test failed too often, giving up


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Yegappan Lakshmanan

unread,
May 12, 2020, 2:52:50 AM5/12/20
to vim_dev, reply+ACY5DGD2RUBNHPY4UX...@reply.github.com, vim/vim, Subscribed
Hi,

It looks like there is a problem in properly recognizing the arrow keys in the
terminal window in this test run. Can you manually try creating a terminal
window with Vim using the following command?

  :call term_start('vim')

In the terminal window, can you press each of the following keys preceded by
CTRL-K

<Left>, <S-Left>, <C-Left>, <Right>, <S-Right>, <C-Right>, <Up>, <S-Up>, <Down>, <S-Down>'

and get the text from the terminal window?

Thanks,
Yegappan

vim-dev ML

unread,
May 12, 2020, 2:53:09 AM5/12/20
to vim/vim, vim-dev ML, Your activity

Hi,

On Mon, May 11, 2020 at 10:57 PM Vladimir Lomov <vim-dev...@256bit.org>
wrote:

> *Describe the bug*

> test_terminal.vim fails after patch 8.2.0738 (commit 91689ea
> <https://github.com/vim/vim/commit/91689ea8ae01acb3daf8ba0ee91acd729af7c84c>
> ).
>
> *To Reproduce*

> Detailed steps to reproduce the behavior:
>
> 1. Clone git repository to local host;
> 2. configure source
> 3. run make
> 4. run make -j1 test
>
> *Expected behavior*
> Test should pass.
>
> *Environment (please complete the following information):*
>
> - Vim version: 8.2.0740 (git)
> - OS: Archlinux x86_64
> - Terminal: tmux (tests runs with TERM=xterm).
>
> *Additional context*

> Terminal output:
>
> Failures:
> test86 FAILED
> test87 FAILED
> From test_terminal.vim:
> Found errors in Test_term_keycode_translation():
> Run 1:
> function RunTheTest[39]..Test_term_keycode_translation line 30: Expected ['<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>', '0123456789', '\t\t.+-*/'] but got ['<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>', '', '\t\t.+-*/<S-Left>', '<C-Left>', '<Right>', '<S-Right>', '<C-Right>', '<Up>', '<S-Up>', '<Down>', '<S-Down>', '45678012']
> Run 2:
> function RunTheTest[39]..Test_term_keycode_translation line 30: Expected ['<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>', '0123456789', '\t\t.+-*/'] but got ['<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>', '', '\t\t.+-*/<S-Left>', '<C-Left>', '<Right>', '<S-Right>', '<C-Right>', '<Up>', '<S-Up>', '<Down>', '<S-Down>', '45678012']
> Flaky test failed too often, giving up
>
>
> It looks like there is a problem in properly recognizing the arrow keys in
the
terminal window in this test run. Can you manually try creating a terminal
window with Vim using the following command?

:call term_start('vim')

In the terminal window, can you press each of the following keys preceded by
CTRL-K

<Left>, <S-Left>, <C-Left>, <Right>, <S-Right>, <C-Right>, <Up>, <S-Up>,
<Down>, <S-Down>'

and get the text from the terminal window?

Thanks,
Yegappan

Vladimir Lomov

unread,
May 12, 2020, 4:28:42 AM5/12/20
to vim/vim, vim-dev ML, Comment

Hello Yegappan,

Can you manually try creating a terminal
window with Vim using the following command?

:call term_start('vim')

Sure, I did

.../vim/src $ TERM=xterm ./vim --clean

then ran :call term_start('vim'), switched to the 'terminal' window

In the terminal window, can you press each of the following keys preceded by
CTRL-K

entered to insert mode (iCTRL-K <Left> etc) but I'm not sure about this

and get the text from the terminal window?

Should I simply save the 'terminal' windows in a file, like

:saveas ~/tmp/keycodes.txt

or something else? If this is the way then I got (text)

<Left><S-Left><C-Left><Right><S-Right><C-Right><Up><S-Up><Down><S-Down>

P.S. Just to be clear: all tests above was run in kitty (inside tmux and just in kitty window). Also I have run make -j1 test in alacritty and see the same failure. May it be related with SSH session? The compilation and tests run was on remote host.

P.P.S. I "logged" on remote host "directly" (actually this is NOT a remote host, it is systemd-nspawn container which is used for build purpose) and ran tests this way but still two tests are failed though without details this time.

Executed:  3129 Tests
 Skipped:    35 Tests
  Failed:     0 Tests


Failures: 
	test86 FAILED
	test87 FAILED

TEST FAILURE


You are receiving this because you commented.

Yegappan Lakshmanan

unread,
May 12, 2020, 9:50:56 AM5/12/20
to vim_dev, reply+ACY5DGBJBUCEQZ2MOO...@reply.github.com, vim/vim, vim-dev ML, Comment
Hi,

On Tue, May 12, 2020 at 1:28 AM Vladimir Lomov <vim-dev...@256bit.org> wrote:

Hello Yegappan,

Can you manually try creating a terminal
window with Vim using the following command?

:call term_start('vim')

Sure, I did


Thanks for collecting the information.
 
.../vim/src $ TERM=xterm ./vim --clean

Is the terminal an xterm compatible terminal? In the above command, you are setting TERM
to xterm. Is it supposed to be set to xterm or some other value? According to the kitty FAQ,
TERM is supposed to be set to xterm-kitty. Can you try running the test with TERM set to
xterm-kitty? You can run only this test using the following command:

    $ cd vim/testdir
    $ ../vim -u NONE -S runtest.vim test_terminal.vim Test_term_keycode_translation

After running the above command, look at the contents of the test.log and messages
files. 


then ran :call term_start('vim'), switched to the 'terminal' window

In the terminal window, can you press each of the following keys preceded by
CTRL-K

entered to insert mode (iCTRL-K <Left> etc) but I'm not sure about this

and get the text from the terminal window?

Should I simply save the 'terminal' windows in a file, like


Yes.
 
:saveas ~/tmp/keycodes.txt

or something else? If this is the way then I got (text)

<Left><S-Left><C-Left><Right><S-Right><C-Right><Up><S-Up><Down><S-Down>

P.S. Just to be clear: all tests above was run in kitty (inside tmux and just in kitty window). Also I have run make -j1 test in alacritty and see the same failure. May it be related with SSH session? The compilation and tests run was on remote host.

P.P.S. I "logged" on remote host "directly" (actually this is NOT a remote host, it is systemd-nspawn container which is used for build purpose) and ran tests this way but still two tests are failed though without details this time.


These failures are not related and are fixed in patch 8.2.0741.

Regards,
Yegappan

vim-dev ML

unread,
May 12, 2020, 9:51:16 AM5/12/20
to vim/vim, vim-dev ML, Your activity
> Failures:
> test86 FAILED
> test87 FAILED
>
> TEST FAILURE

Vladimir Lomov

unread,
May 12, 2020, 11:24:31 AM5/12/20
to vim/vim, vim-dev ML, Comment

Hello Yegappan,

Is the terminal an xterm compatible terminal?

Dunno,

In the above command, you are setting TERM to xterm.

This is how make test is run in "build" script (I'm using Archlinux and to run test PKGBUILD uses

TERM=xterm make -j1 test

and I think it is used to be sure that TERM is xterm regardless of used terminal emulator).

Can you try running the test with TERM set to xterm-kitty?

I did even more, I tested several TERM in kitty and alacritty and results a bit strange to me:

terminal \ TERM | xterm | xterm-kitty | alacritty | tmux-256color |
----------------+-------+-------------+-----------+---------------+
 kitty          |   F   |      S      |     F     |       F       |
 alacritty      |   F   |      S      |     F     |       F       |
----------------+-------+-------------+-----------+---------------+

F - fail;
S - success;

These all is SSH session but outside tmux session.

I didn't do

$ cd vim/src/testdir
$ ../vim -u NONE -S runtest.vim test_terminal.vim Test_term_keycode_translation

I simply ran TERM=XXXX make -j1 test.

After running the above command, look at the contents of the test.log and messages files.

I ran the command in kitty with TERM=xterm-kitty (i.e. not setting TERM manually) but it ran very quickly and didn't produce test.log. Is it Ok? Any other TERM gives test.log:


From test_terminal.vim:
Found errors in Test_term_keycode_translation():
Run 1:
function RunTheTest[39]..Test_term_keycode_translation line 30: Expected ['<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>', '0123456789', '\t\t.+-*/'] but got ['<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>', '', '\t\t.+-*/<S-Left>', '<C-Left>', '<Right>', '<S-Right>', '<C-Right>', '<Up>', '<S-Up>', '<Down>', '<S-Down>', '45678012']
Run 2:
function RunTheTest[39]..Test_term_keycode_translation line 30: Expected ['<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>', '0123456789', '\t\t.+-*/'] but got ['<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>', '', '\t\t.+-*/<S-Left>', '<C-Left>', '<Right>', '<S-Right>', '<C-Right>', '<Up>', '<S-Up>', '<Down>', '<S-Down>', '45678012']
Flaky test failed too often, giving up

then ran :call term_start('vim'), switched to the 'terminal' window

Could you give a bit more instruction because I'm totally confused. If I run

$ ./vim --clean -u NONE

and in "terminal" window enter CTRL-K<Left>... I get strange results but if I run

$ ./vim

I get

<Left><S-Left><C-Left><Right><S-Right><C-Right><Up><S-Up><Down><S-Down>

with both TERM=xterm and TERM=xterm-kitty. I thought that --clean -u NONE ensures that vim won't use any user configuration but with them vim gives me weird output.


You are receiving this because you commented.

Yegappan Lakshmanan

unread,
May 12, 2020, 11:42:54 AM5/12/20
to vim_dev, reply+ACY5DGACC5H4HATHE5...@reply.github.com, vim/vim, vim-dev ML, Comment
Hi,

On Tue, May 12, 2020 at 8:24 AM Vladimir Lomov <vim-dev...@256bit.org> wrote:

Hello Yegappan,

Is the terminal an xterm compatible terminal?

Dunno,

In the above command, you are setting TERM to xterm.

This is how make test is run in "build" script (I'm using Archlinux and to run test PKGBUILD uses

TERM=xterm make -j1 test

and I think it is used to be sure that TERM is xterm regardless of used terminal emulator).

Can you try running the test with TERM set to xterm-kitty?

I did even more, I tested several TERM in kitty and alacritty and results a bit strange to me:

terminal \ TERM | xterm | xterm-kitty | alacritty | tmux-256color |
----------------+-------+-------------+-----------+---------------+
 kitty          |   F   |      S      |     F     |       F       |
 alacritty      |   F   |      S      |     F     |       F       |
----------------+-------+-------------+-----------+---------------+

F - fail;
S - success;


This table confirms that when the TERM is set to xterm-kitty (according to the kitty FAQ,
this is the proper value for TERM), the Vim terminal key code translation works correctly.
For all the other TERM settings, the key code translation is not correct.
 

These all is SSH session but outside tmux session.

I didn't do

$ cd vim/src/testdir
$ ../vim -u NONE -S runtest.vim test_terminal.vim Test_term_keycode_translation

I simply ran TERM=XXXX make -j1 test.

After running the above command, look at the contents of the test.log and messages files.

I ran the command in kitty with TERM=xterm-kitty (i.e. not setting TERM manually) but it ran very quickly and didn't produce test.log. Is it Ok? Any other TERM gives test.log:


Yes. If the test succeeds, then the test.log file will be empty. In case of test failures,
the error messages will be added to test.log.
 

From test_terminal.vim:
Found errors in Test_term_keycode_translation():
Run 1:
function RunTheTest[39]..Test_term_keycode_translation line 30: Expected ['<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>', '0123456789', '\t\t.+-*/'] but got ['<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>', '', '\t\t.+-*/<S-Left>', '<C-Left>', '<Right>', '<S-Right>', '<C-Right>', '<Up>', '<S-Up>', '<Down>', '<S-Down>', '45678012']
Run 2:
function RunTheTest[39]..Test_term_keycode_translation line 30: Expected ['<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>', '0123456789', '\t\t.+-*/'] but got ['<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>', '', '\t\t.+-*/<S-Left>', '<C-Left>', '<Right>', '<S-Right>', '<C-Right>', '<Up>', '<S-Up>', '<Down>', '<S-Down>', '45678012']
Flaky test failed too often, giving up

then ran :call term_start('vim'), switched to the 'terminal' window

Could you give a bit more instruction because I'm totally confused. If I run

$ ./vim --clean -u NONE

and in "terminal" window enter CTRL-K<Left>... I get strange results but if I run

$ ./vim

I get

<Left><S-Left><C-Left><Right><S-Right><C-Right><Up><S-Up><Down><S-Down>

with both TERM=xterm and TERM=xterm-kitty. I thought that --clean -u NONE ensures that vim won't use any user configuration but with them vim gives me weird output.


This is expected. When you invoke Vim with "-u NONE", it runs in Vi-compatible
mode. In Vi-compatible mode, the escape sequences for special keys may not
be recognized correctly. When you run in non-compatible mode, the escape
sequences are properly recognized.

Regards,
Yegappan

 

vim-dev ML

unread,
May 12, 2020, 11:43:16 AM5/12/20
to vim/vim, vim-dev ML, Your activity
> From test_terminal.vim:
> Found errors in Test_term_keycode_translation():
> Run 1:
> function RunTheTest[39]..Test_term_keycode_translation line 30: Expected ['<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>', '0123456789', '\t\t.+-*/'] but got ['<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>', '', '\t\t.+-*/<S-Left>', '<C-Left>', '<Right>', '<S-Right>', '<C-Right>', '<Up>', '<S-Up>', '<Down>', '<S-Down>', '45678012']
> Run 2:
> function RunTheTest[39]..Test_term_keycode_translation line 30: Expected ['<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>', '0123456789', '\t\t.+-*/'] but got ['<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>', '', '\t\t.+-*/<S-Left>', '<C-Left>', '<Right>', '<S-Right>', '<C-Right>', '<Up>', '<S-Up>', '<Down>', '<S-Down>', '45678012']
> Flaky test failed too often, giving up
>
> then ran :call term_start('vim'), switched to the 'terminal' window
>
> Could you give a bit more instruction because I'm totally confused. If I
> run
>
> $ ./vim --clean -u NONE
>
> and in "terminal" window enter CTRL-K<Left>... I get strange results but
> if I run
>
> $ ./vim
>
> I get
>
> <Left><S-Left><C-Left><Right><S-Right><C-Right><Up><S-Up><Down><S-Down>
>
> with both TERM=xterm and TERM=xterm-kitty. I thought that --clean -u NONE
> ensures that vim won't use any user configuration but with them vim gives
> me weird output.
>
>
> This is expected. When you invoke Vim with "-u NONE", it runs in
Vi-compatible
mode. In Vi-compatible mode, the escape sequences for special keys may not
be recognized correctly. When you run in non-compatible mode, the escape
sequences are properly recognized.

Regards,
Yegappan

Vladimir Lomov

unread,
May 13, 2020, 2:01:02 AM5/13/20
to vim/vim, vim-dev ML, Comment

Hello Yegappan,

This table confirms that when the TERM is set to xterm-kitty (according to the kitty FAQ,
this is the proper value for TERM), the Vim terminal key code translation works correctly. For all the other TERM settings, the key code translation is not correct.

Do I understand you correctly that test will run successfully only in xterm-kitty terminal? Or vim somehow tries to figure out in what terminal it being run and run terminal test using correct terminal keycodes?

I thought that setting TERM=xterm is enough to run tests successfully on xterm-compatible terminal.

I'm a bit perplexed now. I tried several terminal emulators, VT (virtual console) but either in kitty or termite itself or when I set TERM=xterm-kitty or TERM=xterm-termite this test is passed while other variants fail.


You are receiving this because you commented.

Yegappan Lakshmanan

unread,
May 13, 2020, 2:26:35 AM5/13/20
to vim_dev, reply+ACY5DGF7LCINDVCUEZ...@reply.github.com, vim/vim, vim-dev ML, Comment
Hi,

On Tue, May 12, 2020 at 11:01 PM Vladimir Lomov <vim-dev...@256bit.org> wrote:

Hello Yegappan,

This table confirms that when the TERM is set to xterm-kitty (according to the kitty FAQ,
this is the proper value for TERM), the Vim terminal key code translation works correctly. For all the other TERM settings, the key code translation is not correct.

Do I understand you correctly that test will run successfully only in xterm-kitty terminal?


Yes. The TERM variable should be set to the appropriate value to match the current
terminal. Otherwise the escape sequences sent by Vim will not be properly interpreted
by the terminal.
 

Or vim somehow tries to figure out in what terminal it being run and run terminal test using correct terminal keycodes?

I thought that setting TERM=xterm is enough to run tests successfully on xterm-compatible terminal.


Even though different terminals claim to be xterm compatible, there are still
some differences (i.e. they are not fully compatible with xterm).
 

I'm a bit perplexed now. I tried several terminal emulators, VT (virtual console) but either in kitty or termite itself or when I set TERM=xterm-kitty or TERM=xterm-termite this test is passed while other variants fail.



For the alacritty terminal, you should set the TERM variable to alacritty.

Regards,
Yegappan 

vim-dev ML

unread,
May 13, 2020, 2:26:54 AM5/13/20
to vim/vim, vim-dev ML, Your activity

Vladimir Lomov

unread,
May 13, 2020, 5:24:25 AM5/13/20
to vim/vim, vim-dev ML, Comment

Hello Yegappan,

The TERM variable should be set to the appropriate value to match the current terminal. Otherwise the escape sequences sent by Vim will not be properly interpreted by the terminal.

Of course and manual setting of TERM variable isn't encouraged, e.g.. But speaking of tmux, inside tmux session the terminal is set to tmux-256color even if this session is run in kitty terminal. What should vim do in this case? How test should treat this case?

Even though different terminals claim to be xterm compatible, there are still some differences (i.e. they are not fully compatible with xterm).

Ouch, then the tests must be run with specific TERM only? I checked that both xterm-kitty and xterm-termite work fine (I ran test in kitty and termite using "default" TERM and manually setting TERM to other variant).

I "fixed" build script to use TERM=xterm-kitty because the build process runs in tmux session but I'm still unsure why vim fails the Test_term_keycode_translation test in other terminals except kitty and termite (I checked the test in qterminal, terminology and alacritty terminals with "default" settings).

For the alacritty terminal, you should set the TERM variable to alacritty.

The "default" TERM value is alacritty and that TERM doesn't work, test fails. If I run

TERM=xterm-kitty ../vim -u NONE -S runtest.vim test_terminal.vim Test_term_keycodes_translation

or with TERM=xterm-termite the test passes.


You are receiving this because you commented.

Bram Moolenaar

unread,
May 13, 2020, 7:34:02 AM5/13/20
to vim/vim, vim-dev ML, Comment

The tests should work in any terminal, we can't depend on specific escape codes. For that we use the terminal window, which always supports the same set of escape sequences, and we use the screenshot mechanism of what the terminal emulator sees, not what is actually on the screen (which may be messed up if $TERM is not set properly).
This can be tricky to make fully work...


You are receiving this because you commented.

Bram Moolenaar

unread,
May 13, 2020, 7:36:19 AM5/13/20
to vim/vim, vim-dev ML, Comment

The problem with the test appears to be that it uses "<F1>" which gets the escape code for the current terminal, not the terminal window.


You are receiving this because you commented.

Bram Moolenaar

unread,
May 13, 2020, 7:59:58 AM5/13/20
to vim/vim, vim-dev ML, Comment

I installed kitty and with $TERM set to "xterm" the test passes.
I also tried using ssh and tmux, test still passes.
What is needed to reproduce the problem?


You are receiving this because you commented.

Vladimir Lomov

unread,
May 13, 2020, 11:43:26 AM5/13/20
to vim/vim, vim-dev ML, Comment

Hello,

I installed kitty and with $TERM set to "xterm" the test passes.
I also tried using ssh and tmux, test still passes.
What is needed to reproduce the problem?

As I told I build vim and run tests in systemd container to which I connected by ssh. I tried to "directly" connect to the container using machinectl with the same result.

Now I tried to compile vim locally on host with almost the same environment and I see very bizarre thing (these results I got in bare kitty window):

1. the test alone is passed regardless the TERM: both

../vim -u NONE -S runtest.vim test_terminal.vim Test_term_keycodes_translation

and

TERM=xterm ../vim -u NONE -S runtest.vim test_terminal.vim Test_term_keycodes_translation

pass giving no test.log.

2. The make -j1 test as is in kitty terminal passes but

$ TERM=xterm make -j1 test

fails.

3. The :call term_start('vim') route works with both "default" TERM

$ ./vim

and TERM=xterm

$ TERM=xterm ./vim

Connecting to this host by ssh changes nothing.

I rechecked these points in container connecting to it by ssh in kitty and see the same.

The other terminals I tested behave very different (especially alacritty, terminology and qterminal, the termite works as kitty).

As for tmux session, inside tmux the TERM is

$ echo $TERM
tmux-256color

and repeating all three points inside tmux I see that 1 passes, the 3 doesn't play well:

<Left><S-Left>[1;5D<Right><S-Right>[1;5C<Up>[1;2A<Down>[1;2B

and 2 throws the same error.

To be clear, this is my environment:

$ cat /etc/os-release
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://www.archlinux.org/"
DOCUMENTATION_URL="https://wiki.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://bugs.archlinux.org/"
LOGO=archlinux
$ pacman -Qs gcc
local/gcc 10.1.0-1 (base-devel)
    The GNU Compiler Collection - C and C++ frontends
$ pacman -Qs ncurses
local/ncurses 6.2-1
    System V Release 4.0 curses emulation library
$ pacman -Qs tmux
local/tmux-git 3.1_b_423_g4cb1d3d7-1
    A terminal multiplexer.
$ pacman -Qs ssh
local/openssh 8.2p1-3
    Premier connectivity tool for remote login with the SSH protocol

P.S. Though I found a workaround for build script I don't like just pass by this problem because I use terminals (kitty, less alacritty and lesser termite) and vim every day.


You are receiving this because you commented.

Mark Kelly

unread,
May 13, 2020, 12:37:25 PM5/13/20
to vim/vim, vim-dev ML, Comment

Just a question that I think is related, if I start an alacritty terminal and TERM=alacritty and I start vim and verify term=alacritty inside vim and all is good :-) and then I start a :terminal - what should TERM be set to inside that terminal ? I am seeing xterm-256color even tho I cannot find anywhere I set that. Is this correct ?
thx,
-m


You are receiving this because you commented.

James McCoy

unread,
May 13, 2020, 12:46:19 PM5/13/20
to vim/vim, vim-dev ML, Comment

then I start a :terminal - what should TERM be set to inside that terminal ? I am seeing xterm-256color even tho I cannot find anywhere I set that. Is this correct ?

Yes, that's correct. At that point, Vim is the terminal, so $TERM is set to what it understands and what the apps inside should use to communicate with Vim (really libvterm). Vim then handles emitting the correct escape codes to the terminal that Vim is running in.


You are receiving this because you commented.

Mark Kelly

unread,
May 13, 2020, 12:49:00 PM5/13/20
to vim/vim, vim-dev ML, Comment

ok, thanks for that great info.


You are receiving this because you commented.

Neil H Watson

unread,
May 20, 2020, 11:58:57 AM5/20/20
to vim/vim, vim-dev ML, Comment

I have the same error. Here's some info that I hope helps:

env|grep -i term
COLORTERM=truecolor
GNOME_TERMINAL_SCREEN=/org/gnome/Terminal/screen/5e844f8c_8918_4e2e_bebd_1756e0762f59
TERM=xterm-256color
GNOME_TERMINAL_SERVICE=:1.2948
  • Error text:
Failures: 
	From test_terminal.vim:
	Found errors in Test_term_keycode_translation():
	Run 1:
	function RunTheTest[39]..Test_term_keycode_translation line 30: Expected ['<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>', '0123456789', '\t\t.+-*/'] but got ['<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>', '', '\t\t.+-*/<S-Left>', '<C-Left>', '<Right>', '<S-Right>', '<C-Right>', '<Up>', '<S-Up>', '<Down>', '<S-Down>', '45678012']
	Run 2:
	function RunTheTest[39]..Test_term_keycode_translation line 30: Expected ['<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>', '0123456789', '\t\t.+-*/'] but got ['<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>', '', '\t\t.+-*/<S-Left>', '<C-Left>', '<Right>', '<S-Right>', '<C-Right>', '<Up>', '<S-Up>', '<Down>', '<S-Down>', '45678012']
	Flaky test failed too often, giving up


You are receiving this because you commented.

Bram Moolenaar

unread,
May 20, 2020, 1:47:03 PM5/20/20
to vim/vim, vim-dev ML, Comment

I see the test is going to Terminal-Normal mode for no reason.
Let me change that, it might also help for this problem.


You are receiving this because you commented.

Bram Moolenaar

unread,
May 20, 2020, 3:19:54 PM5/20/20
to vim/vim, vim-dev ML, Comment

Please try after patch 8.2.0801


You are receiving this because you commented.

Neil H Watson

unread,
May 20, 2020, 3:40:02 PM5/20/20
to vim/vim, vim-dev ML, Comment

8.2.0803 still failed.

    Failures:
            From test_terminal.vim:
            Found errors in Test_term_keycode_translation():
            Run 1:
            function RunTheTest[39]..Test_term_keycode_translation line 30: Expected ['<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>', '0123456789', '\t\t.+-*/'] but got ['<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>', '', '\t\t.+-*/<S-Left>', '<C-Left>', '<Right>', '<S-Right>', '<C-Right>', '<Up>', '<S-Up>', '<Down>', '<S-Down>', '45678012']
            Run 2:
            function RunTheTest[39]..Test_term_keycode_translation line 30: Expected ['<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>', '0123456789', '\t\t.+-*/'] but got ['<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>', '', '\t\t.+-*/<S-Left>', '<C-Left>', '<Right>', '<S-Right>', '<C-Right>', '<Up>', '<S-Up>', '<Down>', '<S-Down>', '45678012']
            Flaky test failed too often, giving up


You are receiving this because you commented.

Bram Moolenaar

unread,
May 20, 2020, 3:46:26 PM5/20/20
to vim/vim, vim-dev ML, Comment

weird. The escape codes appear to be interpreted OK, but the order changes. Look at the keypad keys, starting with 4, 012 at the end, and 9 and 3 are missing.
There is not much more I can do without being able to reproduce.
You could enable channel logging to see what goes over the channel, using ch_logfile().
Perhaps that shows something (especially if you do the same on a system where the tests passes and compare the logs).


You are receiving this because you commented.

Yegappan Lakshmanan

unread,
May 20, 2020, 3:56:18 PM5/20/20
to vim_dev, reply+ACY5DGHJPY6VA2ZQGI...@reply.github.com, vim/vim, vim-dev ML, Comment
Hi Neil,

Can you modify the Test_term_keycode_translation() function in the testdir/test_terminal.vim
file and remove <S-Left> from the "keys" and "output" lists and rerun the test?

- Yegappan
 

vim-dev ML

unread,
May 20, 2020, 3:56:35 PM5/20/20
to vim/vim, vim-dev ML, Your activity


You are receiving this because you are subscribed to this thread.

Neil H Watson

unread,
May 20, 2020, 4:04:58 PM5/20/20
to vim/vim, vim-dev ML, Comment

Same but different?

Failures: 
	From test_terminal.vim:
	Found errors in Test_term_keycode_translation():
	Run 1:
	function RunTheTest[39]..Test_term_keycode_translation line 30: Expected ['<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>', '<C-Left>', '<Right>', '<S-Right>', '<C-Right>', '<Up>', '<S-Up>', '<Down>', '<S-Down>', '0123456789', '\t\t.+-*/'] but got ['<F1>', '<F2>', '<F3>', '<F4>', '<F5>', '<F6>', '<F7>', '<F8>', '<F9>', '<F10>', '<F11>', '<F12>', '<Home>', '<S-Home>', '<C-Home>', '<End>', '<S-End>', '<C-End>', '<Insert>', '<Del>', '', '\t\t.+-*/<Left>', '<C-Left>', '<Right>', '<S-Right>', '<C-Right>', '<Up>', '<S-Up>', '<Down>', '<S-Down>', '45678012']
	Run 2:
	function RunTheTest[39]..Test_term_keycode_translation line 30: Expected ['<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>', '<C-Left>', '<Right>', '<S-Right>', '<C-Right>', '<Up>', '<S-Up>', '<Down>', '<S-Down>', '0123456789', '\t\t.+-*/'] but got ['<F1>', '<F2>', '<F3>', '<F4>', '<F5>', '<F6>', '<F7>', '<F8>', '<F9>', '<F10>', '<F11>', '<F12>', '<Home>', '<S-Home>', '<C-Home>', '<End>', '<S-End>', '<C-End>', '<Insert>', '<Del>', '', '\t\t.+-*/<Left>', '<C-Left>', '<Right>', '<S-Right>', '<C-Right>', '<Up>', '<S-Up>', '<Down>', '<S-Down>', '45678012']
	Flaky test failed too often, giving up
	Screen size too small! Tests require at least 24 lines with 80 characters, got 50 lines with 63 characters


You are receiving this because you commented.

Yegappan Lakshmanan

unread,
May 20, 2020, 4:42:36 PM5/20/20
to vim_dev, reply+ACY5DGC2HYKJFU6RDI...@reply.github.com, vim/vim, vim-dev ML, Comment
Hi,

Can you try replacing the Test_term_keycode_translation() function with the one below
and rerun the test? This removes the test for the <Home> and <Ins> keys.

Thanks,
Yegappan

===================================================================
func Test_term_keycode_translation()
  CheckRunVimInTerminal

  let buf = RunVimInTerminal('', {})
  call term_sendkeys(buf, ":set nocompatible\<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>',
        \ '0123456789', ".+-*/", "two"]

  call term_sendkeys(buf, "i")
  for k in keys
    call term_sendkeys(buf, "\<C-K>" .. k .. "\<CR>")
  endfor
  call term_sendkeys(buf, "\<K0>\<K1>\<K2>\<K3>\<K4>\<K5>\<K6>\<K7>")
  call term_sendkeys(buf, "\<K8>\<K9>\<kEnter>\<kPoint>\<kPlus>")
  call term_sendkeys(buf, "\<kMinus>\<kMultiply>\<kDivide>\<C-\>\<C-N>")
  call term_wait(buf)
  call feedkeys("A\<CR>one\<C-W>.two\<C-W>\<C-\>\<C-N>", 'xt')

  call term_sendkeys(buf, ":write Xkeycodes\<CR>")
  call term_wait(buf)
  call StopVimInTerminal(buf)
  call assert_equal(output, readfile('Xkeycodes'))
  call delete('Xkeycodes')
endfunc
 

vim-dev ML

unread,
May 20, 2020, 4:42:57 PM5/20/20
to vim/vim, vim-dev ML, Your activity


You are receiving this because you are subscribed to this thread.

Neil H Watson

unread,
May 20, 2020, 4:59:28 PM5/20/20
to vim/vim, vim-dev ML, Comment

Failure.

ailures: 
	From test_terminal.vim:
	Found errors in Test_term_keycode_translation():
	Run 1:
	function RunTheTest[39]..Test_term_keycode_translation line 32: Expected ['<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>', '0123456789', '.+-*/', 'two'] but got ['<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>', 'two', '<C-Left>', '<Right>', '<S-Right>', '<C-Right>', '<Up>', '<S-Up>', '<Down>', '<S-Down>', '45678012']
	Run 2:
	function RunTheTest[39]..Test_term_keycode_translation line 32: Expected ['<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>', '0123456789', '.+-*/', 'two'] but got ['<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>', 'two', '<C-Left>', '<Right>', '<S-Right>', '<C-Right>', '<Up>', '<S-Up>', '<Down>', '<S-Down>', '45678012']
	Flaky test failed too often, giving up


You are receiving this because you commented.

Bram Moolenaar

unread,
May 20, 2020, 5:32:13 PM5/20/20
to vim/vim, vim-dev ML, Comment

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.

Neil H Watson

unread,
May 20, 2020, 5:49:43 PM5/20/20
to vim/vim, vim-dev ML, Comment

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.

Sorry, I don't know what that means.

Yegappan Lakshmanan

unread,
May 20, 2020, 10:28:39 PM5/20/20
to vim_dev, reply+ACY5DGFMSE6BI5BALO...@reply.github.com, vim/vim, vim-dev ML, Comment
Hi Bram,

On Wed, May 20, 2020 at 2:32 PM Bram Moolenaar <vim-dev...@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

vim-dev ML

unread,
May 20, 2020, 10:29:00 PM5/20/20
to vim/vim, vim-dev ML, Your activity


You are receiving this because you are subscribed to this thread.

Yegappan Lakshmanan

unread,
May 21, 2020, 12:21:46 AM5/21/20
to vim_dev, reply+ACY5DGF4WVMWNLESGZ...@reply.github.com, vim/vim, vim-dev ML, Your activity
Hi,

On Wed, May 20, 2020 at 7:28 PM vim-dev ML <vim-dev...@256bit.org> wrote:

Hi Bram,

On Wed, May 20, 2020 at 2:32 PM Bram Moolenaar <vim-dev...@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.


In case the code is mangled, I am attaching the function.

- Yegappan
 
keycode.vim

vim-dev ML

unread,
May 21, 2020, 12:21:58 AM5/21/20
to vim/vim, vim-dev ML, Your activity

Vladimir Lomov

unread,
May 21, 2020, 12:32:34 AM5/21/20
to vim/vim, vim-dev ML, Comment

Hello Yegappan,
I tested this version of Test_term_keycode_translation and I got

Failures: 
        From test_terminal.vim:
        Found errors in Test_term_keycode_translation():
        Run 1:
        function RunTheTest[39]..Test_term_keycode_translation line 33: Expected '3' but got ''
        function RunTheTest[39]..Test_term_keycode_translation line 33: Expected '9' but got ''
        Run 2:
        function RunTheTest[39]..Test_term_keycode_translation line 33: Expected '3' but got ''
        function RunTheTest[39]..Test_term_keycode_translation line 33: Expected '9' but got ''
        Flaky test failed too often, giving up

when ran TERM=xterm make -j1 test in .../vim/src. I used vim from commit patch 8.2.0803: libvterm code lags behind the upstream version


You are receiving this because you commented.

Elimar Riesebieter

unread,
May 21, 2020, 7:45:07 AM5/21/20
to vim...@googlegroups.com
* Vladimir Lomov <vim-dev...@256bit.org> [2020-05-20 21:32 -0700]:

> Hello Yegappan,
> I tested this version of `Test_term_keycode_translation` and I got
> ```
> Failures:
> From test_terminal.vim:
> Found errors in Test_term_keycode_translation():
> Run 1:
> function RunTheTest[39]..Test_term_keycode_translation line 33: Expected '3' but got ''
> function RunTheTest[39]..Test_term_keycode_translation line 33: Expected '9' but got ''
> Run 2:
> function RunTheTest[39]..Test_term_keycode_translation line 33: Expected '3' but got ''
> function RunTheTest[39]..Test_term_keycode_translation line 33: Expected '9' but got ''
> Flaky test failed too often, giving up
> ```
> when ran `TERM=xterm make -j1 test` in `.../vim/src`. I used vim from commit [patch 8.2.0803: libvterm code lags behind the upstream version](https://github.com/vim/vim/commit/83a52533b23c88f90be0dea01bc5e32ddadc1d6a)

Same here:
tmux in an urxvt
ssh remote
TERM=tmux-256color

Elimar
--
BOFH excuse #398:
Data for intranet got routed through the extranet and landed on the internet.

Elimar Riesebieter

unread,
May 21, 2020, 9:38:04 AM5/21/20
to vim/vim, vim-dev ML, Comment

Same here:
tmux in an urxvt
ssh remote
TERM=tmux-256color

Bram Moolenaar

unread,
May 21, 2020, 2:39:48 PM5/21/20
to vim/vim, vim-dev ML, Comment

Closed #6070 via fe81389.

Reply all
Reply to author
Forward
0 new messages