summaryrefslogtreecommitdiff
path: root/tui
diff options
context:
space:
mode:
authorJulian Hurst <ark@mansus.space>2025-03-21 19:24:09 +0100
committerJulian Hurst <ark@mansus.space>2025-03-21 19:24:09 +0100
commitc117966782fe826ae0146467dacb4ad20893046e (patch)
tree779132015cf3c1f44feefc6727ddccb5a6fa6ebf /tui
parent6cb9d6f8756e690e6cd2360b8b1ab531da45c405 (diff)
downloadhare-tui-c117966782fe826ae0146467dacb4ad20893046e.tar.gz
Add a bunch of unicode blocks to width.ha
Diffstat (limited to 'tui')
-rw-r--r--tui/width.ha37
1 files changed, 37 insertions, 0 deletions
diff --git a/tui/width.ha b/tui/width.ha
index f6d6078..cb4464a 100644
--- a/tui/width.ha
+++ b/tui/width.ha
@@ -1,5 +1,6 @@
use strings;
+//https://unicodeplus.com/
export fn runewidth(r: rune) uint = {
let ru = r: u32;
// emoticons: https://en.wikipedia.org/wiki/Emoticons_(Unicode_block)
@@ -18,6 +19,42 @@ export fn runewidth(r: rune) uint = {
if (ru >= '\U00004E00' && ru <= '\U00009FFF') {
return 2;
};
+ // CJK Symbols and Punctuation: https://en.wikipedia.org/wiki/CJK_Symbols_and_Punctuation
+ if (ru >= '\U00003000' && ru <= '\U0000303F') {
+ return 2;
+ };
+ // Hangul Syllables: https://en.wikipedia.org/wiki/Hangul_Syllables
+ if (ru >= '\U0000AC00' && ru <= '\U0000D7AF') {
+ return 2;
+ };
+ // Miscellaneous Symbols: https://en.wikipedia.org/wiki/Miscellaneous_Symbols_and_Pictographs
+ if (ru >= '\U00002600' && ru <= '\U000026FF') {
+ return 2;
+ };
+ // Miscellaneous Symbols and Pictographs: https://en.wikipedia.org/wiki/Miscellaneous_Symbols_and_Pictographs
+ if (ru >= '\U0001F300' && ru <= '\U0001F5FF') {
+ return 2;
+ };
+ // Dingbats: https://en.wikipedia.org/wiki/Dingbats_(Unicode_block)
+ if (ru >= '\U00002700' && ru <= '\U000027BF') {
+ return 2;
+ };
+ // Transport and Map symbols: https://en.wikipedia.org/wiki/Transport_and_Map_Symbols
+ if (ru >= '\U0001F680' && ru <= '\U0001F6FF') {
+ return 2;
+ };
+ // Supplemental Symbols and Pictographs: https://en.wikipedia.org/wiki/Supplemental_Symbols_and_Pictographs
+ if (ru >= '\U0001F900' && ru <= '\U0001F9FF') {
+ return 2;
+ };
+ // Miscellaneous Symbols and Arrows: https://en.wikipedia.org/wiki/Miscellaneous_Symbols_and_Arrows
+ if (ru >= '\U00002B00' && ru <= '\U00002BFF') {
+ return 2;
+ };
+ // Symbols and Pictographs Extended-A: https://en.wikipedia.org/wiki/Symbols_and_Pictographs_Extended-A
+ if (ru >= '\U0001FA70' && ru <= '\U0001FAFF') {
+ return 2;
+ };
return 1;
};