Mercurial > vim
comparison src/getchar.c @ 31211:d6355c3af211 v9.0.0939
patch 9.0.0939: still using simplified mappings when using kitty protocol
Commit: https://github.com/vim/vim/commit/47f1fdc28c6839ec8f5aede631d3a870624767b6
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Nov 24 13:27:36 2022 +0000
patch 9.0.0939: still using simplified mappings when using kitty protocol
Problem: Still using simplified mappings when using the kitty keyboard
protocol.
Solution: Use the kitty_protocol_state value to decide whether to use
simplified mappings. Improve how seenModifyOtherKeys is set and
reset.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 24 Nov 2022 14:30:03 +0100 |
parents | 25f6c7f77c70 |
children | 42acbd0cb313 |
comparison
equal
deleted
inserted
replaced
31210:50ad80360e99 | 31211:d6355c3af211 |
---|---|
2454 } | 2454 } |
2455 return 0; | 2455 return 0; |
2456 } | 2456 } |
2457 | 2457 |
2458 /* | 2458 /* |
2459 * Return TRUE if the terminal sends modifiers with various keys. This is when | |
2460 * modifyOtherKeys level 2 is enabled or the kitty keyboard protocol is | |
2461 * enabled. | |
2462 */ | |
2463 static int | |
2464 key_protocol_enabled(void) | |
2465 { | |
2466 return seenModifyOtherKeys || kitty_protocol_state == KKPS_ENABLED; | |
2467 } | |
2468 | |
2469 /* | |
2459 * Handle mappings in the typeahead buffer. | 2470 * Handle mappings in the typeahead buffer. |
2460 * - When something was mapped, return map_result_retry for recursive mappings. | 2471 * - When something was mapped, return map_result_retry for recursive mappings. |
2461 * - When nothing mapped and typeahead has a character: return map_result_get. | 2472 * - When nothing mapped and typeahead has a character: return map_result_get. |
2462 * - When there is no match yet, return map_result_nomatch, need to get more | 2473 * - When there is no match yet, return map_result_nomatch, need to get more |
2463 * typeahead. | 2474 * typeahead. |
2562 // Only consider an entry if the first character matches and it is | 2573 // Only consider an entry if the first character matches and it is |
2563 // for the current state. | 2574 // for the current state. |
2564 // Skip ":lmap" mappings if keys were mapped. | 2575 // Skip ":lmap" mappings if keys were mapped. |
2565 if (mp->m_keys[0] == tb_c1 | 2576 if (mp->m_keys[0] == tb_c1 |
2566 && (mp->m_mode & local_State) | 2577 && (mp->m_mode & local_State) |
2567 && !(mp->m_simplified && seenModifyOtherKeys | 2578 && !(mp->m_simplified && key_protocol_enabled() |
2568 && typebuf.tb_maplen == 0) | 2579 && typebuf.tb_maplen == 0) |
2569 && ((mp->m_mode & MODE_LANGMAP) == 0 | 2580 && ((mp->m_mode & MODE_LANGMAP) == 0 |
2570 || typebuf.tb_maplen == 0)) | 2581 || typebuf.tb_maplen == 0)) |
2571 { | 2582 { |
2572 #ifdef FEAT_LANGMAP | 2583 #ifdef FEAT_LANGMAP |