fork/wezterm
git clone https://git.julia.blue/fork/wezterm
8a3fb1159
termiz-0.23.1
1#!/usr/bin/env python3 2# A little utility to dump ranges of unicode glyphs to visually 3# compare terminal/glyph output. 4# based on https://github.com/bew/dotfiles/blob/0de029ce22/bin/unicode-dump 5import argparse 6 7UNICODE_BLOCKS = { 8"Powerline" : (0xe0b0 ,0xe0d4 ), 9"Basic Latin" : (0x0000 ,0x007F ), 10"Latin-1 Supplement" : (0x0080 ,0x00FF ), 11"Latin Extended-A" : (0x0100 ,0x017F ), 12"Latin Extended-B" : (0x0180 ,0x024F ), 13"IPA Extensions" : (0x0250 ,0x02AF ), 14"Spacing Modifier Letters" : (0x02B0 ,0x02FF ), 15"Combining Diacritical Marks" : (0x0300 ,0x036F ), 16"Greek and Coptic" : (0x0370 ,0x03FF ), 17"Cyrillic" : (0x0400 ,0x04FF ), 18"Cyrillic Supplement" : (0x0500 ,0x052F ), 19"Armenian" : (0x0530 ,0x058F ), 20"Hebrew" : (0x0590 ,0x05FF ), 21"Arabic" : (0x0600 ,0x06FF ), 22"Syriac" : (0x0700 ,0x074F ), 23"Arabic Supplement" : (0x0750 ,0x077F ), 24"Thaana" : (0x0780 ,0x07BF ), 25"NKo" : (0x07C0 ,0x07FF ), 26"Samaritan" : (0x0800 ,0x083F ), 27"Mandaic" : (0x0840 ,0x085F ), 28"Syriac Supplement" : (0x0860 ,0x086F ), 29"Arabic Extended-A" : (0x08A0 ,0x08FF ), 30"Devanagari" : (0x0900 ,0x097F ), 31"Bengali" : (0x0980 ,0x09FF ), 32"Gurmukhi" : (0x0A00 ,0x0A7F ), 33"Gujarati" : (0x0A80 ,0x0AFF ), 34"Oriya" : (0x0B00 ,0x0B7F ), 35"Tamil" : (0x0B80 ,0x0BFF ), 36"Telugu" : (0x0C00 ,0x0C7F ), 37"Kannada" : (0x0C80 ,0x0CFF ), 38"Malayalam" : (0x0D00 ,0x0D7F ), 39"Sinhala" : (0x0D80 ,0x0DFF ), 40"Thai" : (0x0E00 ,0x0E7F ), 41"Lao" : (0x0E80 ,0x0EFF ), 42"Tibetan" : (0x0F00 ,0x0FFF ), 43"Myanmar" : (0x1000 ,0x109F ), 44"Georgian" : (0x10A0 ,0x10FF ), 45"Hangul Jamo" : (0x1100 ,0x11FF ), 46"Ethiopic" : (0x1200 ,0x137F ), 47"Ethiopic Supplement" : (0x1380 ,0x139F ), 48"Cherokee" : (0x13A0 ,0x13FF ), 49"Unified Canadian Aboriginal Syllabics" : (0x1400 ,0x167F ), 50"Ogham" : (0x1680 ,0x169F ), 51"Runic" : (0x16A0 ,0x16FF ), 52"Tagalog" : (0x1700 ,0x171F ), 53"Hanunoo" : (0x1720 ,0x173F ), 54"Buhid" : (0x1740 ,0x175F ), 55"Tagbanwa" : (0x1760 ,0x177F ), 56"Khmer" : (0x1780 ,0x17FF ), 57"Mongolian" : (0x1800 ,0x18AF ), 58"Unified Canadian Aboriginal Syllabics Extended" : (0x18B0 ,0x18FF ), 59"Limbu" : (0x1900 ,0x194F ), 60"Tai Le" : (0x1950 ,0x197F ), 61"New Tai Lue" : (0x1980 ,0x19DF ), 62"Khmer Symbols" : (0x19E0 ,0x19FF ), 63"Buginese" : (0x1A00 ,0x1A1F ), 64"Tai Tham" : (0x1A20 ,0x1AAF ), 65"Combining Diacritical Marks Extended" : (0x1AB0 ,0x1AFF ), 66"Balinese" : (0x1B00 ,0x1B7F ), 67"Sundanese" : (0x1B80 ,0x1BBF ), 68"Batak" : (0x1BC0 ,0x1BFF ), 69"Lepcha" : (0x1C00 ,0x1C4F ), 70"Ol Chiki" : (0x1C50 ,0x1C7F ), 71"Cyrillic Extended C" : (0x1C80 ,0x1C8F ), 72"Georgian Extended" : (0x1C90 ,0x1CBF ), 73"Sundanese Supplement" : (0x1CC0 ,0x1CCF ), 74"Vedic Extensions" : (0x1CD0 ,0x1CFF ), 75"Phonetic Extensions" : (0x1D00 ,0x1D7F ), 76"Phonetic Extensions Supplement" : (0x1D80 ,0x1DBF ), 77"Combining Diacritical Marks Supplement" : (0x1DC0 ,0x1DFF ), 78"Latin Extended Additional" : (0x1E00 ,0x1EFF ), 79"Greek Extended" : (0x1F00 ,0x1FFF ), 80"General Punctuation" : (0x2000 ,0x206F ), 81"Superscripts and Subscripts" : (0x2070 ,0x209F ), 82"Currency Symbols" : (0x20A0 ,0x20CF ), 83"Combining Diacritical Marks for Symbols" : (0x20D0 ,0x20FF ), 84"Letterlike Symbols" : (0x2100 ,0x214F ), 85"Number Forms" : (0x2150 ,0x218F ), 86"Arrows" : (0x2190 ,0x21FF ), 87"Mathematical Operators" : (0x2200 ,0x22FF ), 88"Miscellaneous Technical" : (0x2300 ,0x23FF ), 89"Control Pictures" : (0x2400 ,0x243F ), 90"Optical Character Recognition" : (0x2440 ,0x245F ), 91"Enclosed Alphanumerics" : (0x2460 ,0x24FF ), 92"Box Drawing" : (0x2500 ,0x257F ), 93"Block Elements" : (0x2580 ,0x259F ), 94"Geometric Shapes" : (0x25A0 ,0x25FF ), 95"Miscellaneous Symbols" : (0x2600 ,0x26FF ), 96"Dingbats" : (0x2700 ,0x27BF ), 97"Miscellaneous Mathematical Symbols-A" : (0x27C0 ,0x27EF ), 98"Supplemental Arrows-A" : (0x27F0 ,0x27FF ), 99"Braille Patterns" : (0x2800 ,0x28FF ), 100"Supplemental Arrows-B" : (0x2900 ,0x297F ), 101"Miscellaneous Mathematical Symbols-B" : (0x2980 ,0x29FF ), 102"Supplemental Mathematical Operators" : (0x2A00 ,0x2AFF ), 103"Miscellaneous Symbols and Arrows" : (0x2B00 ,0x2BFF ), 104"Glagolitic" : (0x2C00 ,0x2C5F ), 105"Latin Extended-C" : (0x2C60 ,0x2C7F ), 106"Coptic" : (0x2C80 ,0x2CFF ), 107"Georgian Supplement" : (0x2D00 ,0x2D2F ), 108"Tifinagh" : (0x2D30 ,0x2D7F ), 109"Ethiopic Extended" : (0x2D80 ,0x2DDF ), 110"Cyrillic Extended-A" : (0x2DE0 ,0x2DFF ), 111"Supplemental Punctuation" : (0x2E00 ,0x2E7F ), 112"CJK Radicals Supplement" : (0x2E80 ,0x2EFF ), 113"Kangxi Radicals" : (0x2F00 ,0x2FDF ), 114"Ideographic Description Characters" : (0x2FF0 ,0x2FFF ), 115"CJK Symbols and Punctuation" : (0x3000 ,0x303F ), 116"Hiragana" : (0x3040 ,0x309F ), 117"Katakana" : (0x30A0 ,0x30FF ), 118"Bopomofo" : (0x3100 ,0x312F ), 119"Hangul Compatibility Jamo" : (0x3130 ,0x318F ), 120"Kanbun" : (0x3190 ,0x319F ), 121"Bopomofo Extended" : (0x31A0 ,0x31BF ), 122"CJK Strokes" : (0x31C0 ,0x31EF ), 123"Katakana Phonetic Extensions" : (0x31F0 ,0x31FF ), 124"Enclosed CJK Letters and Months" : (0x3200 ,0x32FF ), 125"CJK Compatibility" : (0x3300 ,0x33FF ), 126"CJK Unified Ideographs Extension A" : (0x3400 ,0x4DBF ), 127"Yijing Hexagram Symbols" : (0x4DC0 ,0x4DFF ), 128"CJK Unified Ideographs" : (0x4E00 ,0x9FFF ), 129"Yi Syllables" : (0xA000 ,0xA48F ), 130"Yi Radicals" : (0xA490 ,0xA4CF ), 131"Lisu" : (0xA4D0 ,0xA4FF ), 132"Vai" : (0xA500 ,0xA63F ), 133"Cyrillic Extended-B" : (0xA640 ,0xA69F ), 134"Bamum" : (0xA6A0 ,0xA6FF ), 135"Modifier Tone Letters" : (0xA700 ,0xA71F ), 136"Latin Extended-D" : (0xA720 ,0xA7FF ), 137"Syloti Nagri" : (0xA800 ,0xA82F ), 138"Common Indic Number Forms" : (0xA830 ,0xA83F ), 139"Phags-pa" : (0xA840 ,0xA87F ), 140"Saurashtra" : (0xA880 ,0xA8DF ), 141"Devanagari Extended" : (0xA8E0 ,0xA8FF ), 142"Kayah Li" : (0xA900 ,0xA92F ), 143"Rejang" : (0xA930 ,0xA95F ), 144"Hangul Jamo Extended-A" : (0xA960 ,0xA97F ), 145"Javanese" : (0xA980 ,0xA9DF ), 146"Myanmar Extended-B" : (0xA9E0 ,0xA9FF ), 147"Cham" : (0xAA00 ,0xAA5F ), 148"Myanmar Extended-A" : (0xAA60 ,0xAA7F ), 149"Tai Viet" : (0xAA80 ,0xAADF ), 150"Meetei Mayek Extensions" : (0xAAE0 ,0xAAFF ), 151"Ethiopic Extended-A" : (0xAB00 ,0xAB2F ), 152"Latin Extended-E" : (0xAB30 ,0xAB6F ), 153"Cherokee Supplement" : (0xAB70 ,0xABBF ), 154"Meetei Mayek" : (0xABC0 ,0xABFF ), 155"Hangul Syllables" : (0xAC00 ,0xD7AF ), 156"Hangul Jamo Extended-B" : (0xD7B0 ,0xD7FF ), 157"High Surrogates" : (0xD800 ,0xDB7F ), 158"High Private Use Surrogates" : (0xDB80 ,0xDBFF ), 159"Low Surrogates" : (0xDC00 ,0xDFFF ), 160"Private Use Area" : (0xE000 ,0xF8FF ), 161"CJK Compatibility Ideographs" : (0xF900 ,0xFAFF ), 162"Alphabetic Presentation Forms" : (0xFB00 ,0xFB4F ), 163"Arabic Presentation Forms-A" : (0xFB50 ,0xFDFF ), 164"Variation Selectors" : (0xFE00 ,0xFE0F ), 165"Vertical Forms" : (0xFE10 ,0xFE1F ), 166"Combining Half Marks" : (0xFE20 ,0xFE2F ), 167"CJK Compatibility Forms" : (0xFE30 ,0xFE4F ), 168"Small Form Variants" : (0xFE50 ,0xFE6F ), 169"Arabic Presentation Forms-B" : (0xFE70 ,0xFEFF ), 170"Halfwidth and Fullwidth Forms" : (0xFF00 ,0xFFEF ), 171"Specials" : (0xFFF0 ,0xFFFF ), 172"Linear B Syllabary" : (0x10000 ,0x1007F ), 173"Linear B Ideograms" : (0x10080 ,0x100FF ), 174"Aegean Numbers" : (0x10100 ,0x1013F ), 175"Ancient Greek Numbers" : (0x10140 ,0x1018F ), 176"Ancient Symbols" : (0x10190 ,0x101CF ), 177"Phaistos Disc" : (0x101D0 ,0x101FF ), 178"Lycian" : (0x10280 ,0x1029F ), 179"Carian" : (0x102A0 ,0x102DF ), 180"Coptic Epact Numbers" : (0x102E0 ,0x102FF ), 181"Old Italic" : (0x10300 ,0x1032F ), 182"Gothic" : (0x10330 ,0x1034F ), 183"Old Permic" : (0x10350 ,0x1037F ), 184"Ugaritic" : (0x10380 ,0x1039F ), 185"Old Persian" : (0x103A0 ,0x103DF ), 186"Deseret" : (0x10400 ,0x1044F ), 187"Shavian" : (0x10450 ,0x1047F ), 188"Osmanya" : (0x10480 ,0x104AF ), 189"Osage" : (0x104B0 ,0x104FF ), 190"Elbasan" : (0x10500 ,0x1052F ), 191"Caucasian Albanian" : (0x10530 ,0x1056F ), 192"Linear A" : (0x10600 ,0x1077F ), 193"Cypriot Syllabary" : (0x10800 ,0x1083F ), 194"Imperial Aramaic" : (0x10840 ,0x1085F ), 195"Palmyrene" : (0x10860 ,0x1087F ), 196"Nabataean" : (0x10880 ,0x108AF ), 197"Hatran" : (0x108E0 ,0x108FF ), 198"Phoenician" : (0x10900 ,0x1091F ), 199"Lydian" : (0x10920 ,0x1093F ), 200"Meroitic Hieroglyphs" : (0x10980 ,0x1099F ), 201"Meroitic Cursive" : (0x109A0 ,0x109FF ), 202"Kharoshthi" : (0x10A00 ,0x10A5F ), 203"Old South Arabian" : (0x10A60 ,0x10A7F ), 204"Old North Arabian" : (0x10A80 ,0x10A9F ), 205"Manichaean" : (0x10AC0 ,0x10AFF ), 206"Avestan" : (0x10B00 ,0x10B3F ), 207"Inscriptional Parthian" : (0x10B40 ,0x10B5F ), 208"Inscriptional Pahlavi" : (0x10B60 ,0x10B7F ), 209"Psalter Pahlavi" : (0x10B80 ,0x10BAF ), 210"Old Turkic" : (0x10C00 ,0x10C4F ), 211"Old Hungarian" : (0x10C80 ,0x10CFF ), 212"Hanifi Rohingya" : (0x10D00 ,0x10D3F ), 213"Rumi Numeral Symbols" : (0x10E60 ,0x10E7F ), 214"Yezidi" : (0x10E80 ,0x10EBF ), 215"Old Sogdian" : (0x10F00 ,0x10F2F ), 216"Sogdian" : (0x10F30 ,0x10F6F ), 217"Chorasmian" : (0x10FB0 ,0x10FDF ), 218"Elymaic" : (0x10FE0 ,0x10FFF ), 219"Brahmi" : (0x11000 ,0x1107F ), 220"Kaithi" : (0x11080 ,0x110CF ), 221"Sora Sompeng" : (0x110D0 ,0x110FF ), 222"Chakma" : (0x11100 ,0x1114F ), 223"Mahajani" : (0x11150 ,0x1117F ), 224"Sharada" : (0x11180 ,0x111DF ), 225"Sinhala Archaic Numbers" : (0x111E0 ,0x111FF ), 226"Khojki" : (0x11200 ,0x1124F ), 227"Multani" : (0x11280 ,0x112AF ), 228"Khudawadi" : (0x112B0 ,0x112FF ), 229"Grantha" : (0x11300 ,0x1137F ), 230"Newa" : (0x11400 ,0x1147F ), 231"Tirhuta" : (0x11480 ,0x114DF ), 232"Siddham" : (0x11580 ,0x115FF ), 233"Modi" : (0x11600 ,0x1165F ), 234"Mongolian Supplement" : (0x11660 ,0x1167F ), 235"Takri" : (0x11680 ,0x116CF ), 236"Ahom" : (0x11700 ,0x1173F ), 237"Dogra" : (0x11800 ,0x1184F ), 238"Warang Citi" : (0x118A0 ,0x118FF ), 239"Dives Akuru" : (0x11900 ,0x1195F ), 240"Nandinagari" : (0x119A0 ,0x119FF ), 241"Zanabazar Square" : (0x11A00 ,0x11A4F ), 242"Soyombo" : (0x11A50 ,0x11AAF ), 243"Pau Cin Hau" : (0x11AC0 ,0x11AFF ), 244"Bhaiksuki" : (0x11C00 ,0x11C6F ), 245"Marchen" : (0x11C70 ,0x11CBF ), 246"Masaram Gondi" : (0x11D00 ,0x11D5F ), 247"Gunjala Gondi" : (0x11D60 ,0x11DAF ), 248"Makasar" : (0x11EE0 ,0x11EFF ), 249"Lisu Supplement" : (0x11FB0 ,0x11FBF ), 250"Tamil Supplement" : (0x11FC0 ,0x11FFF ), 251"Cuneiform" : (0x12000 ,0x123FF ), 252"Cuneiform Numbers and Punctuation" : (0x12400 ,0x1247F ), 253"Early Dynastic Cuneiform" : (0x12480 ,0x1254F ), 254"Egyptian Hieroglyphs" : (0x13000 ,0x1342F ), 255"Egyptian Hieroglyph Format Controls" : (0x13430 ,0x1343F ), 256"Anatolian Hieroglyphs" : (0x14400 ,0x1467F ), 257"Bamum Supplement" : (0x16800 ,0x16A3F ), 258"Mro" : (0x16A40 ,0x16A6F ), 259"Bassa Vah" : (0x16AD0 ,0x16AFF ), 260"Pahawh Hmong" : (0x16B00 ,0x16B8F ), 261"Medefaidrin" : (0x16E40 ,0x16E9F ), 262"Miao" : (0x16F00 ,0x16F9F ), 263"Ideographic Symbols and Punctuation" : (0x16FE0 ,0x16FFF ), 264"Tangut" : (0x17000 ,0x187FF ), 265"Tangut Components" : (0x18800 ,0x18AFF ), 266"Khitan Small Script" : (0x18B00 ,0x18CFF ), 267"Tangut Supplement" : (0x18D00 ,0x18D8F ), 268"Kana Supplement" : (0x1B000 ,0x1B0FF ), 269"Kana Extended-A" : (0x1B100 ,0x1B12F ), 270"Small Kana Extension" : (0x1B130 ,0x1B16F ), 271"Nushu" : (0x1B170 ,0x1B2FF ), 272"Duployan" : (0x1BC00 ,0x1BC9F ), 273"Shorthand Format Controls" : (0x1BCA0 ,0x1BCAF ), 274"Byzantine Musical Symbols" : (0x1D000 ,0x1D0FF ), 275"Musical Symbols" : (0x1D100 ,0x1D1FF ), 276"Ancient Greek Musical Notation" : (0x1D200 ,0x1D24F ), 277"Mayan Numerals" : (0x1D2E0 ,0x1D2FF ), 278"Tai Xuan Jing Symbols" : (0x1D300 ,0x1D35F ), 279"Counting Rod Numerals" : (0x1D360 ,0x1D37F ), 280"Mathematical Alphanumeric Symbols" : (0x1D400 ,0x1D7FF ), 281"Sutton SignWriting" : (0x1D800 ,0x1DAAF ), 282"Glagolitic Supplement" : (0x1E000 ,0x1E02F ), 283"Nyiakeng Puachue Hmong" : (0x1E100 ,0x1E14F ), 284"Wancho" : (0x1E2C0 ,0x1E2FF ), 285"Mende Kikakui" : (0x1E800 ,0x1E8DF ), 286"Adlam" : (0x1E900 ,0x1E95F ), 287"Indic Siyaq Numbers" : (0x1EC70 ,0x1ECBF ), 288"Ottoman Siyaq Numbers" : (0x1ED00 ,0x1ED4F ), 289"Arabic Mathematical Alphabetic Symbols" : (0x1EE00 ,0x1EEFF ), 290"Mahjong Tiles" : (0x1F000 ,0x1F02F ), 291"Domino Tiles" : (0x1F030 ,0x1F09F ), 292"Playing Cards" : (0x1F0A0 ,0x1F0FF ), 293"Enclosed Alphanumeric Supplement" : (0x1F100 ,0x1F1FF ), 294"Enclosed Ideographic Supplement" : (0x1F200 ,0x1F2FF ), 295"Miscellaneous Symbols and Pictographs" : (0x1F300 ,0x1F5FF ), 296"Emoticons (Emoji)" : (0x1F600 ,0x1F64F ), 297"Ornamental Dingbats" : (0x1F650 ,0x1F67F ), 298"Transport and Map Symbols" : (0x1F680 ,0x1F6FF ), 299"Alchemical Symbols" : (0x1F700 ,0x1F77F ), 300"Geometric Shapes Extended" : (0x1F780 ,0x1F7FF ), 301"Supplemental Arrows-C" : (0x1F800 ,0x1F8FF ), 302"Supplemental Symbols and Pictographs" : (0x1F900 ,0x1F9FF ), 303"Chess Symbols" : (0x1FA00 ,0x1FA6F ), 304"Symbols and Pictographs Extended-A" : (0x1FA70 ,0x1FAFF ), 305"Symbols for Legacy Computing" : (0x1FB00 ,0x1FBFF ), 306"CJK Unified Ideographs Extension B" : (0x20000 ,0x2A6DF ), 307"CJK Unified Ideographs Extension C" : (0x2A700 ,0x2B73F ), 308"CJK Unified Ideographs Extension D" : (0x2B740 ,0x2B81F ), 309"CJK Unified Ideographs Extension E" : (0x2B820 ,0x2CEAF ), 310"CJK Unified Ideographs Extension F" : (0x2CEB0 ,0x2EBEF ), 311"CJK Compatibility Ideographs Supplement" : (0x2F800 ,0x2FA1F ), 312"CJK Unified Ideographs Extension G" : (0x30000 ,0x3134F ), 313"Tags" : (0xE0000 ,0xE007F ), 314"Variation Selectors Supplement" : (0xE0100 ,0xE01EF ), 315"Supplementary Private Use Area-A" : (0xF0000 ,0xFFFFF ), 316"Supplementary Private Use Area-B" : (0x100000 ,0x10FFFF ), 317} 318 319def resolve_block_name (name ): 320lname = name .lower () 321candidates = [] 322for k in UNICODE_BLOCKS .keys (): 323if lname in k .lower (): 324candidates .append (k ) 325if len (candidates )== 0 : 326raise KeyError ("{} is not a valid block name" .format (name )) 327if len (candidates )== 1 : 328return candidates [0 ] 329raise KeyError ("{} could match {}" .format (name ,", " .join (candidates ))) 330 331def print_range (start ,end ): 332"0x{:x} -> 0x{:x}" .format (start ,end )) 333is_alt = False 334for cp in range (start ,end + 1 ): 335if cp & 0x1f == 0 : 336if is_alt : 337"\n\x1b[44m" ,end = '' ) 338else : 339"\n\x1b[0m" ,end = '' ) 340is_alt = not is_alt 341chr (cp ),end = ' ' ) 342"\x1b[0m" ) 343 344def do_show_range (args ): 345print_range (int (args .start ,0 ),int (args .end ,0 )) 346 347def do_show_block (args ): 348name = resolve_block_name (args .name ) 349"Showing glyphs in `{}`" .format (name )) 350 (start ,end )= UNICODE_BLOCKS [name ] 351print_range (start ,end ) 352 353def do_list_blocks (args ): 354"\n" .join (sorted (list (UNICODE_BLOCKS .keys ())))) 355 356parser = argparse .ArgumentParser () 357sub = parser .add_subparsers () 358 359show_block = sub .add_parser ("show-block" ,help = "print glyphs in named block" ) 360show_block .add_argument ("name" ) 361show_block .set_defaults (func = do_show_block ) 362 363list_blocks = sub .add_parser ("list-blocks" ,help = "list unicode blocks" ) 364list_blocks .set_defaults (func = do_list_blocks ) 365 366show_range = sub .add_parser ("show-range" ,help = "print glyphs in a range" ) 367show_range .add_argument ('start' ) 368show_range .add_argument ('end' ) 369show_range .set_defaults (func = do_show_range ) 370 371args = parser .parse_args () 372args .func (args ) 373 374"" ,flush = True )