Mercurial > vim
comparison src/getchar.c @ 30936:38d20a201beb v9.0.0802
patch 9.0.0802: MS-Windows: cannot map console mouse scroll events
Commit: https://github.com/vim/vim/commit/4c36678ffd1f933a6d4a12415994dea15e4ccec6
Author: Christopher Plewright <chris@createng.com>
Date: Thu Oct 20 13:11:15 2022 +0100
patch 9.0.0802: MS-Windows: cannot map console mouse scroll events
Problem: MS-Windows: cannot map console mouse scroll events.
Solution: Change CSI to K_SPECIAL when checking for a mapping. (Christopher
Plewright, closes #11410)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 20 Oct 2022 14:15:06 +0200 |
parents | 6a2a38b26caf |
children | 109aa4913cba |
comparison
equal
deleted
inserted
replaced
30935:464a04119e94 | 30936:38d20a201beb |
---|---|
2518 && !(State == MODE_HITRETURN && (tb_c1 == CAR || tb_c1 == ' ')) | 2518 && !(State == MODE_HITRETURN && (tb_c1 == CAR || tb_c1 == ' ')) |
2519 && State != MODE_ASKMORE | 2519 && State != MODE_ASKMORE |
2520 && State != MODE_CONFIRM | 2520 && State != MODE_CONFIRM |
2521 && !at_ins_compl_key()) | 2521 && !at_ins_compl_key()) |
2522 { | 2522 { |
2523 #ifdef FEAT_GUI | 2523 #if defined(FEAT_GUI) || defined(MSWIN) |
2524 if (gui.in_use && tb_c1 == CSI && typebuf.tb_len >= 2 | 2524 if (tb_c1 == CSI |
2525 && typebuf.tb_buf[typebuf.tb_off + 1] == KS_MODIFIER) | 2525 # if !defined(MSWIN) |
2526 && gui.in_use | |
2527 # endif | |
2528 && typebuf.tb_len >= 2 | |
2529 && (typebuf.tb_buf[typebuf.tb_off + 1] == KS_MODIFIER | |
2530 # if defined(MSWIN) | |
2531 || (typebuf.tb_len >= 3 | |
2532 && typebuf.tb_buf[typebuf.tb_off + 1] == KS_EXTRA | |
2533 && (typebuf.tb_buf[typebuf.tb_off + 2] == KE_MOUSEUP | |
2534 || typebuf.tb_buf[typebuf.tb_off + 2] == KE_MOUSEDOWN | |
2535 || typebuf.tb_buf[typebuf.tb_off + 2] == KE_MOUSELEFT | |
2536 || typebuf.tb_buf[typebuf.tb_off + 2] == KE_MOUSERIGHT) | |
2537 ) | |
2538 # endif | |
2539 ) | |
2540 ) | |
2526 { | 2541 { |
2527 // The GUI code sends CSI KS_MODIFIER {flags}, but mappings expect | 2542 // The GUI code sends CSI KS_MODIFIER {flags}, but mappings expect |
2528 // K_SPECIAL KS_MODIFIER {flags}. | 2543 // K_SPECIAL KS_MODIFIER {flags}. |
2544 // MS-Windows sends mouse scroll events CSI KS_EXTRA {what}, but | |
2545 // mappings expect K_SPECIAL KS_EXTRA {what}. | |
2529 tb_c1 = K_SPECIAL; | 2546 tb_c1 = K_SPECIAL; |
2530 } | 2547 } |
2531 #endif | 2548 #endif |
2532 #ifdef FEAT_LANGMAP | 2549 #ifdef FEAT_LANGMAP |
2533 if (tb_c1 == K_SPECIAL) | 2550 if (tb_c1 == K_SPECIAL) |
2566 // Skip ":lmap" mappings if keys were mapped. | 2583 // Skip ":lmap" mappings if keys were mapped. |
2567 if (mp->m_keys[0] == tb_c1 | 2584 if (mp->m_keys[0] == tb_c1 |
2568 && (mp->m_mode & local_State) | 2585 && (mp->m_mode & local_State) |
2569 && !(mp->m_simplified && seenModifyOtherKeys | 2586 && !(mp->m_simplified && seenModifyOtherKeys |
2570 && typebuf.tb_maplen == 0) | 2587 && typebuf.tb_maplen == 0) |
2571 && ((mp->m_mode & MODE_LANGMAP) == 0 || typebuf.tb_maplen == 0)) | 2588 && ((mp->m_mode & MODE_LANGMAP) == 0 |
2589 || typebuf.tb_maplen == 0)) | |
2572 { | 2590 { |
2573 #ifdef FEAT_LANGMAP | 2591 #ifdef FEAT_LANGMAP |
2574 int nomap = nolmaplen; | 2592 int nomap = nolmaplen; |
2575 int c2; | 2593 int c2; |
2576 #endif | 2594 #endif |