Mercurial > vim
comparison src/testdir/keycode_check.vim @ 31243:984ebd1f6605 v9.0.0955
patch 9.0.0955: libvterm does not support the XTQMODKEYS request
Commit: https://github.com/vim/vim/commit/cc0907165d388e4e8842d3bda9e24ed4d932d6b8
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Nov 27 11:31:23 2022 +0000
patch 9.0.0955: libvterm does not support the XTQMODKEYS request
Problem: Libvterm does not support the XTQMODKEYS request.
Solution: Implement the XTQMODKEYS request and response. Update the keycode
check results.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 27 Nov 2022 12:45:05 +0100 |
parents | ee50174810ac |
children | dbec60b8c253 |
comparison
equal
deleted
inserted
replaced
31242:f12d4937f67b | 31243:984ebd1f6605 |
---|---|
132 echo 'No terminal results yet' | 132 echo 'No terminal results yet' |
133 return | 133 return |
134 endif | 134 endif |
135 sort(terms) | 135 sort(terms) |
136 | 136 |
137 var items = ['protocol', 'version', 'status', 'modkeys'] | 137 var items = ['protocol', 'version', 'kitty', 'modkeys'] |
138 + key_entries->copy()->map((_, v) => v[1]) | 138 + key_entries->copy()->map((_, v) => v[1]) |
139 | 139 |
140 # For each terminal compute the needed width, add two. | 140 # For each terminal compute the needed width, add two. |
141 # You may need to increase the terminal width to avoid wrapping. | 141 # You may need to increase the terminal width to avoid wrapping. |
142 var widths = [] | 142 var widths = [] |
192 '2. modifyOtherKeys level 2', | 192 '2. modifyOtherKeys level 2', |
193 '3. kitty', | 193 '3. kitty', |
194 ]) | 194 ]) |
195 echo "\n" | 195 echo "\n" |
196 &t_TE = "\<Esc>[>4;m" | 196 &t_TE = "\<Esc>[>4;m" |
197 var proto_name = 'none' | 197 var proto_name = 'unknown' |
198 if proto == 1 | 198 if proto == 1 |
199 &t_TI = "" | 199 # Request the XTQMODKEYS value and request the kitty keyboard protocol status. |
200 &t_TI = "\<Esc>[?4m" .. "\<Esc>[?u" | |
201 proto_name = 'none' | |
200 elseif proto == 2 | 202 elseif proto == 2 |
201 # Enable modifyOtherKeys level 2. Request the XTQMODKEYS value. | 203 # Enable modifyOtherKeys level 2 and request the XTQMODKEYS value. |
202 &t_TI = "\<Esc>[>4;2m" .. "\<Esc>[?4m" | 204 &t_TI = "\<Esc>[>4;2m" .. "\<Esc>[?4m" |
203 proto_name = 'mok2' | 205 proto_name = 'mok2' |
204 elseif proto == 3 | 206 elseif proto == 3 |
205 # Enable Kitty keyboard protocol and request the status | 207 # Enable Kitty keyboard protocol and request the status. |
206 &t_TI = "\<Esc>[>1u" .. "\<Esc>[?u" | 208 &t_TI = "\<Esc>[>1u" .. "\<Esc>[?u" |
207 proto_name = 'kitty' | 209 proto_name = 'kitty' |
208 else | 210 else |
209 echoerr 'invalid protocol choice' | 211 echoerr 'invalid protocol choice' |
210 return | 212 return |
260 if !has_key(keycodes, name) | 262 if !has_key(keycodes, name) |
261 keycodes[name] = {} | 263 keycodes[name] = {} |
262 endif | 264 endif |
263 keycodes[name]['protocol'] = proto_name | 265 keycodes[name]['protocol'] = proto_name |
264 keycodes[name]['version'] = '' | 266 keycodes[name]['version'] = '' |
265 keycodes[name]['status'] = '' | 267 keycodes[name]['kitty'] = '' |
266 keycodes[name]['modkeys'] = '' | 268 keycodes[name]['modkeys'] = '' |
267 | 269 |
268 # Check the log file for a status and the version response | 270 # Check the log file for a status and the version response |
269 ch_logfile('', '') | 271 ch_logfile('', '') |
270 var log = readfile('keylog') | 272 var log = readfile('keylog') |
275 var code = substitute(line, '.*raw key input: "\([^"]*\).*', '\1', '') | 277 var code = substitute(line, '.*raw key input: "\([^"]*\).*', '\1', '') |
276 | 278 |
277 # Check for the XTQMODKEYS response. | 279 # Check for the XTQMODKEYS response. |
278 if code =~ modkeys_pattern | 280 if code =~ modkeys_pattern |
279 var modkeys = substitute(code, '.*\(' .. modkeys_pattern .. '\).*', '\1', '') | 281 var modkeys = substitute(code, '.*\(' .. modkeys_pattern .. '\).*', '\1', '') |
280 # Get the level out of the response | 282 # We could get the level out of the response, but showing the response |
281 modkeys = substitute(modkeys, '.*4;\(\d\)m', '\1', '') | 283 # itself provides more information. |
284 # modkeys = substitute(modkeys, '.*4;\(\d\)m', '\1', '') | |
282 | 285 |
283 if keycodes[name]['modkeys'] != '' | 286 if keycodes[name]['modkeys'] != '' |
284 echomsg 'Another modkeys found after ' .. keycodes[name]['modkeys'] | 287 echomsg 'Another modkeys found after ' .. keycodes[name]['modkeys'] |
285 endif | 288 endif |
286 keycodes[name]['modkeys'] = modkeys | 289 keycodes[name]['modkeys'] = modkeys |
290 if code =~ kitty_status_pattern | 293 if code =~ kitty_status_pattern |
291 var status = substitute(code, '.*\(' .. kitty_status_pattern .. '\).*', '\1', '') | 294 var status = substitute(code, '.*\(' .. kitty_status_pattern .. '\).*', '\1', '') |
292 # use the response itself as the status | 295 # use the response itself as the status |
293 status = Literal2hex(status) | 296 status = Literal2hex(status) |
294 | 297 |
295 if keycodes[name]['status'] != '' | 298 if keycodes[name]['kitty'] != '' |
296 echomsg 'Another status found after ' .. keycodes[name]['status'] | 299 echomsg 'Another status found after ' .. keycodes[name]['kitty'] |
297 endif | 300 endif |
298 keycodes[name]['status'] = status | 301 keycodes[name]['kitty'] = status |
299 endif | 302 endif |
300 | 303 |
301 if code =~ version_pattern | 304 if code =~ version_pattern |
302 var version = substitute(code, '.*\(' .. version_pattern .. '\).*', '\1', '') | 305 var version = substitute(code, '.*\(' .. version_pattern .. '\).*', '\1', '') |
303 keycodes[name]['version'] = Literal2hex(version) | 306 keycodes[name]['version'] = Literal2hex(version) |