Mercurial > vim
comparison src/testdir/view_util.vim @ 31247:a864e75257dd v9.0.0957
patch 9.0.0957: tests fail without the terminal feature
Commit: https://github.com/vim/vim/commit/64fabf3802b8d38157c6b89010b9bea7766b3841
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Nov 27 13:51:22 2022 +0000
patch 9.0.0957: tests fail without the terminal feature
Problem: Tests fail without the terminal feature.
Solution: Move functions to another utility script.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 27 Nov 2022 15:00:04 +0100 |
parents | f936d46cc9c1 |
children | d2107f7b2155 |
comparison
equal
deleted
inserted
replaced
31246:a536455a9b74 | 31247:a864e75257dd |
---|---|
60 | 60 |
61 func CloseWindow() abort | 61 func CloseWindow() abort |
62 bw! | 62 bw! |
63 redraw! | 63 redraw! |
64 endfunc | 64 endfunc |
65 | |
66 | |
67 " When using RunVimInTerminal() we expect modifyOtherKeys level 2 to be enabled | |
68 " automatically. The key + modifier Escape codes must then use the | |
69 " modifyOtherKeys encoding. They are recognized anyway, thus it's safer to use | |
70 " than the raw code. | |
71 | |
72 " Return the modifyOtherKeys level 2 encoding for "key" with "modifier" | |
73 " (number value, e.g. CTRL is 5). | |
74 func GetEscCodeCSI27(key, modifier) | |
75 let key = printf("%d", char2nr(a:key)) | |
76 let mod = printf("%d", a:modifier) | |
77 return "\<Esc>[27;" .. mod .. ';' .. key .. '~' | |
78 endfunc | |
79 | |
80 " Return the modifyOtherKeys level 2 encoding for "key" with "modifier" | |
81 " (character value, e.g. CTRL is "C"). | |
82 func GetEscCodeWithModifier(modifier, key) | |
83 let modifier = get({'C': 5}, a:modifier, '') | |
84 if modifier == '' | |
85 echoerr 'Unknown modifier: ' .. a:modifier | |
86 endif | |
87 return GetEscCodeCSI27(a:key, modifier) | |
88 endfunc | |
89 | |
90 " Return the kitty keyboard protocol encoding for "key" with "modifier" | |
91 " (number value, e.g. CTRL is 5). | |
92 func GetEscCodeCSIu(key, modifier) | |
93 let key = printf("%d", char2nr(a:key)) | |
94 let mod = printf("%d", a:modifier) | |
95 return "\<Esc>[" .. key .. ';' .. mod .. 'u' | |
96 endfunc | |
97 | |
98 " Return the kitty keyboard protocol encoding for "key" without a modifier. | |
99 " Used for the Escape key. | |
100 func GetEscCodeCSIuWithoutModifier(key) | |
101 let key = printf("%d", char2nr(a:key)) | |
102 return "\<Esc>[" .. key .. 'u' | |
103 endfunc | |
104 |