From f634fddd344a456c3eff8014d9d58a2d764d7a8c Mon Sep 17 00:00:00 2001 From: Ryan Date: Fri, 4 Mar 2022 22:04:45 +1100 Subject: [PATCH] Remove `send_unicode_hex_string()` (#16518) --- docs/feature_unicode.md | 11 ------- docs/ja/feature_unicode.md | 11 ------- .../process_keycode/process_unicode_common.c | 33 ------------------- .../process_keycode/process_unicode_common.h | 1 - 4 files changed, 56 deletions(-) diff --git a/docs/feature_unicode.md b/docs/feature_unicode.md index 6c3e2a1a2f..bced419a03 100644 --- a/docs/feature_unicode.md +++ b/docs/feature_unicode.md @@ -230,17 +230,6 @@ send_unicode_string("(ノಠ痊ಠ)ノ彡┻━┻"); Example uses include sending Unicode strings when a key is pressed, as described in [Macros](feature_macros.md). -### `send_unicode_hex_string()` (Deprecated) - -Similar to `send_unicode_string()`, but the characters are represented by their Unicode code points, written in hexadecimal and separated by spaces. For example, the table flip above would be achieved with: - -```c -send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B"); -``` - -An easy way to convert your Unicode string to this format is to use [this site](https://r12a.github.io/app-conversion/) and take the result in the "Hex/UTF-32" section. - - ## Additional Language Support In `quantum/keymap_extras`, you'll see various language files — these work the same way as the ones for alternative layouts such as Colemak or BÉPO. When you include one of these language headers, you gain access to keycodes specific to that language / national layout. Such keycodes are defined by a 2-letter country/language code, followed by an underscore and a 4-letter abbreviation of the character to which the key corresponds. For example, including `keymap_french.h` and using `FR_UGRV` in your keymap will output `ù` when typed on a system with a native French AZERTY layout. diff --git a/docs/ja/feature_unicode.md b/docs/ja/feature_unicode.md index bfcb866ce1..2158678f3c 100644 --- a/docs/ja/feature_unicode.md +++ b/docs/ja/feature_unicode.md @@ -233,17 +233,6 @@ send_unicode_string("(ノಠ痊ಠ)ノ彡┻━┻"); 使用例には、[Macros](ja/feature_macros.md) で説明されているように、キーが押された時に Unicode 文字列を送信することが含まれます。 -### `send_unicode_hex_string()` - -`send_unicode_string()` に似ていますが、文字は Unicode コードポイントで表され、16進数で記述され、空白で区切られています。例えば、上記のちゃぶ台返しは以下で表されます: - -```c -send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B"); -``` - -[このサイト](https://r12a.github.io/app-conversion/)で結果を "Hex/UTF-32" で受け取ることで、Unicode 文字列をこの形式に簡単に変換できます。 - - ## 追加の言語サポート `quantum/keymap_extras` には、様々な言語ファイルがあります — これらは Colemak または BÉPO のような代替レイアウトのファイルと同じように動作します。これらの言語ヘッダのいずれかを `#include` すると、その言語/国のレイアウトに固有のキーコードにアクセスできます。このようなキーコードは、2文字の国/言語コードの後に、アンダースコアとキーが対応する4文字の略語が続くことで定義されます。例えば、キーマップに `keymap_french.h` を含め、`FR_UGRV` を使うと、ネイティブのフランス語 AZERTY レイアウトを使うシステムで入力すると、`ù` が出力されます。 diff --git a/quantum/process_keycode/process_unicode_common.c b/quantum/process_keycode/process_unicode_common.c index 46b77e14ba..2606ea1f37 100644 --- a/quantum/process_keycode/process_unicode_common.c +++ b/quantum/process_keycode/process_unicode_common.c @@ -16,8 +16,6 @@ #include "process_unicode_common.h" #include "eeprom.h" -#include -#include unicode_config_t unicode_config; uint8_t unicode_saved_mods; @@ -231,37 +229,6 @@ void register_unicode(uint32_t code_point) { unicode_input_finish(); } -// clang-format off - -void send_unicode_hex_string(const char *str) { - if (!str) { - return; - } - - while (*str) { - // Find the next code point (token) in the string - for (; *str == ' '; str++); // Skip leading spaces - size_t n = strcspn(str, " "); // Length of the current token - char code_point[n+1]; - strncpy(code_point, str, n); // Copy token into buffer - code_point[n] = '\0'; // Make sure it's null-terminated - - // Normalize the code point: make all hex digits lowercase - for (char *p = code_point; *p; p++) { - *p = tolower((unsigned char)*p); - } - - // Send the code point as a Unicode input string - unicode_input_start(); - send_string(code_point); - unicode_input_finish(); - - str += n; // Move to the first ' ' (or '\0') after the current token - } -} - -// clang-format on - // Borrowed from https://nullprogram.com/blog/2017/10/06/ static const char *decode_utf8(const char *str, int32_t *code_point) { const char *next; diff --git a/quantum/process_keycode/process_unicode_common.h b/quantum/process_keycode/process_unicode_common.h index 1a6607c757..8a4494c939 100644 --- a/quantum/process_keycode/process_unicode_common.h +++ b/quantum/process_keycode/process_unicode_common.h @@ -90,7 +90,6 @@ void register_hex(uint16_t hex); void register_hex32(uint32_t hex); void register_unicode(uint32_t code_point); -void send_unicode_hex_string(const char *str); void send_unicode_string(const char *str); bool process_unicode_common(uint16_t keycode, keyrecord_t *record);