Mercurial > vim
comparison src/misc2.c @ 22522:6c7e4db139a3 v8.2.1809
patch 8.2.1809: mapping some keys with Ctrl does not work properly
Commit: https://github.com/vim/vim/commit/4e2114e988f5d8635f2ad748be3cafcc44289138
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Oct 7 16:12:37 2020 +0200
patch 8.2.1809: mapping some keys with Ctrl does not work properly
Problem: Mapping some keys with Ctrl does not work properly.
Solution: For terminal, GTK and Motif handle "@", "^" and "_" codes.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 07 Oct 2020 16:15:04 +0200 |
parents | c19acd92ee83 |
children | 6325ef9143bc |
comparison
equal
deleted
inserted
replaced
22521:3ab7a6685179 | 22522:6c7e4db139a3 |
---|---|
2943 } | 2943 } |
2944 } | 2944 } |
2945 return 0; | 2945 return 0; |
2946 } | 2946 } |
2947 | 2947 |
2948 | |
2949 /* | |
2950 * Some keys are used with Ctrl without Shift and are still expected to be | |
2951 * mapped as if Shift was pressed: | |
2952 * CTRL-2 is CTRL-@ | |
2953 * CTRL-6 is CTRL-^ | |
2954 * CTRL-- is CTRL-_ | |
2955 * Also, <C-H> and <C-h> mean the same thing, always use "H". | |
2956 * Returns the possibly adjusted key. | |
2957 */ | |
2958 int | |
2959 may_adjust_key_for_ctrl(int modifiers, int key) | |
2960 { | |
2961 if (modifiers & MOD_MASK_CTRL) | |
2962 { | |
2963 if (ASCII_ISALPHA(key)) | |
2964 return TOUPPER_ASC(key); | |
2965 if (key == '2') | |
2966 return '@'; | |
2967 if (key == '6') | |
2968 return '^'; | |
2969 if (key == '-') | |
2970 return '_'; | |
2971 } | |
2972 return key; | |
2973 } | |
2948 | 2974 |
2949 /* | 2975 /* |
2950 * Some keys already have Shift included, pass them as normal keys. | 2976 * Some keys already have Shift included, pass them as normal keys. |
2951 * Not when Ctrl is also used, because <C-H> and <C-S-H> are different. | 2977 * Not when Ctrl is also used, because <C-H> and <C-S-H> are different. |
2952 * Also for <A-S-a> and <M-S-a>. | 2978 * Also for <A-S-a> and <M-S-a>. |