Mercurial > vim
comparison src/getchar.c @ 28610:ce202d2984a0 v8.2.4829
patch 8.2.4829: a key may be simplified to NUL
Commit: https://github.com/vim/vim/commit/17c95d9608370559441bb73941ba6d9a4b6b26bd
Author: zeertzjq <zeertzjq@outlook.com>
Date: Tue Apr 26 12:51:07 2022 +0100
patch 8.2.4829: a key may be simplified to NUL
Problem: A key may be simplified to NUL.
Solution: Use K_ZERO instead. Use macros instead of hard coded values.
(closes #10290)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 26 Apr 2022 14:00:03 +0200 |
parents | 4dcccb2673fe |
children | 6ff407067190 |
comparison
equal
deleted
inserted
replaced
28609:d38d48b0205f | 28610:ce202d2984a0 |
---|---|
1635 int c = c_arg; | 1635 int c = c_arg; |
1636 | 1636 |
1637 if (*modifiers & MOD_MASK_CTRL) | 1637 if (*modifiers & MOD_MASK_CTRL) |
1638 { | 1638 { |
1639 if ((c >= '`' && c <= 0x7f) || (c >= '@' && c <= '_')) | 1639 if ((c >= '`' && c <= 0x7f) || (c >= '@' && c <= '_')) |
1640 { | |
1640 c &= 0x1f; | 1641 c &= 0x1f; |
1642 if (c == NUL) | |
1643 c = K_ZERO; | |
1644 } | |
1641 else if (c == '6') | 1645 else if (c == '6') |
1642 // CTRL-6 is equivalent to CTRL-^ | 1646 // CTRL-6 is equivalent to CTRL-^ |
1643 c = 0x1e; | 1647 c = 0x1e; |
1644 #ifdef FEAT_GUI_GTK | 1648 #ifdef FEAT_GUI_GTK |
1645 // These mappings look arbitrary at the first glance, but in fact | 1649 // These mappings look arbitrary at the first glance, but in fact |
3659 char_u dum[DUM_LEN + 1]; | 3663 char_u dum[DUM_LEN + 1]; |
3660 | 3664 |
3661 for (;;) | 3665 for (;;) |
3662 { | 3666 { |
3663 len = ui_inchar(dum, DUM_LEN, 0L, 0); | 3667 len = ui_inchar(dum, DUM_LEN, 0L, 0); |
3664 if (len == 0 || (len == 1 && dum[0] == 3)) | 3668 if (len == 0 || (len == 1 && dum[0] == Ctrl_C)) |
3665 break; | 3669 break; |
3666 } | 3670 } |
3667 return retesc; | 3671 return retesc; |
3668 } | 3672 } |
3669 | 3673 |