diff options
-rw-r--r-- | docs/mod_tap.md | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/docs/mod_tap.md b/docs/mod_tap.md index b69500f9c..dc11b0dea 100644 --- a/docs/mod_tap.md +++ b/docs/mod_tap.md | |||
@@ -83,32 +83,29 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
83 | 83 | ||
84 | ### Changing hold function | 84 | ### Changing hold function |
85 | 85 | ||
86 | Likewise, the same custom code can also be used to intercept the hold function to send custom user key code. The following example uses `LT(0, kc)` (layer-tap key with no practical use because layer 0 is always active) to add cut, copy and paste function to X,C and V keys when they are held down: | 86 | Likewise, similar custom code can also be used to intercept the hold function to send custom user key code. The following example uses `LT(0, kc)` (layer-tap key with no practical use because layer 0 is always active) to add cut, copy and paste function to X,C and V keys when they are held down: |
87 | 87 | ||
88 | ```c | 88 | ```c |
89 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | 89 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { |
90 | switch (keycode) { | 90 | switch (keycode) { |
91 | case LT(0,KC_X): | 91 | case LT(0,KC_X): |
92 | if (record->tap.count && record->event.pressed) { | 92 | if (!record->tap.count && record->event.pressed) { |
93 | return true; // Return true for normal processing of tap keycode | ||
94 | } else if (record->event.pressed) { | ||
95 | tap_code16(C(KC_X)); // Intercept hold function to send Ctrl-X | 93 | tap_code16(C(KC_X)); // Intercept hold function to send Ctrl-X |
94 | return false; | ||
96 | } | 95 | } |
97 | return false; | 96 | return true; // Return true for normal processing of tap keycode |
98 | case LT(0,KC_C): | 97 | case LT(0,KC_C): |
99 | if (record->tap.count && record->event.pressed) { | 98 | if (!record->tap.count && record->event.pressed) { |
100 | return true; // Return true for normal processing of tap keycode | ||
101 | } else if (record->event.pressed) { | ||
102 | tap_code16(C(KC_C)); // Intercept hold function to send Ctrl-C | 99 | tap_code16(C(KC_C)); // Intercept hold function to send Ctrl-C |
100 | return false; | ||
103 | } | 101 | } |
104 | return false; | 102 | return true; // Return true for normal processing of tap keycode |
105 | case LT(0,KC_V): | 103 | case LT(0,KC_V): |
106 | if (record->tap.count && record->event.pressed) { | 104 | if (!record->tap.count && record->event.pressed) { |
107 | return true; // Return true for normal processing of tap keycode | ||
108 | } else if (record->event.pressed) { | ||
109 | tap_code16(C(KC_V)); // Intercept hold function to send Ctrl-V | 105 | tap_code16(C(KC_V)); // Intercept hold function to send Ctrl-V |
106 | return false; | ||
110 | } | 107 | } |
111 | return false; | 108 | return true; // Return true for normal processing of tap keycode |
112 | } | 109 | } |
113 | return true; | 110 | return true; |
114 | } | 111 | } |