Bram Moolenaar | edf3f97 | 2016-08-29 22:49:24 +0200 | [diff] [blame] | 1 | /* vi:set ts=8 sts=4 sw=4 noet: |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2 | * |
| 3 | * VIM - Vi IMproved by Bram Moolenaar |
| 4 | * |
| 5 | * Do ":help uganda" in Vim to read copying and usage conditions. |
| 6 | * Do ":help credits" in Vim to see a list of people who contributed. |
| 7 | * See README.txt for an overview of the Vim source code. |
| 8 | */ |
| 9 | |
| 10 | /* |
| 11 | * digraph.c: code for digraphs |
| 12 | */ |
| 13 | |
| 14 | #include "vim.h" |
| 15 | |
| 16 | #if defined(FEAT_DIGRAPHS) || defined(PROTO) |
| 17 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 18 | typedef int result_T; |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 19 | |
| 20 | typedef struct digraph |
| 21 | { |
| 22 | char_u char1; |
| 23 | char_u char2; |
| 24 | result_T result; |
| 25 | } digr_T; |
| 26 | |
Bram Moolenaar | eae8ae1 | 2018-12-14 18:53:02 +0100 | [diff] [blame] | 27 | static void printdigraph(digr_T *dp, result_T *previous); |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 28 | |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 29 | // digraphs added by the user |
Bram Moolenaar | 0ab2a88 | 2009-05-13 10:51:08 +0000 | [diff] [blame] | 30 | static garray_T user_digraphs = {0, 0, (int)sizeof(digr_T), 10, NULL}; |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 31 | |
| 32 | /* |
| 33 | * Note: Characters marked with XX are not included literally, because some |
| 34 | * compilers cannot handle them (Amiga SAS/C is the most picky one). |
| 35 | */ |
Bram Moolenaar | 6c0b44b | 2005-06-01 21:56:33 +0000 | [diff] [blame] | 36 | static digr_T digraphdefault[] = |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 37 | |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 38 | #ifdef HPUX_DIGRAPHS |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 39 | /* |
| 40 | * different HPUX digraphs |
| 41 | */ |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 42 | {{'A', '`', 161}, // ¡ |
| 43 | {'A', '^', 162}, // ¢ |
| 44 | {'E', '`', 163}, // £ |
| 45 | {'E', '^', 164}, // ¤ |
| 46 | {'E', '"', 165}, // ¥ |
| 47 | {'I', '^', 166}, // ¦ |
| 48 | {'I', '"', 167}, // § |
| 49 | {'\'', '\'', 168}, // ¨ |
| 50 | {'`', '`', 169}, // © |
| 51 | {'^', '^', 170}, // ª |
| 52 | {'"', '"', 171}, // « |
| 53 | {'~', '~', 172}, // ¬ |
| 54 | {'U', '`', 173}, // |
| 55 | {'U', '^', 174}, // ® |
| 56 | {'L', '=', 175}, // ¯ |
| 57 | {'~', '_', 176}, // ° |
| 58 | {'Y', '\'', 177}, // ± |
| 59 | {'y', '\'', 178}, // ² |
| 60 | {'~', 'o', 179}, // ³ |
| 61 | {'C', ',', 180}, // ´ |
| 62 | {'c', ',', 181}, // µ |
| 63 | {'N', '~', 182}, // ¶ |
| 64 | {'n', '~', 183}, // · |
| 65 | {'~', '!', 184}, // ¸ |
| 66 | {'~', '?', 185}, // ¹ |
| 67 | {'o', 'x', 186}, // º |
| 68 | {'L', '-', 187}, // » |
| 69 | {'Y', '=', 188}, // ¼ |
| 70 | {'p', 'p', 189}, // ½ |
| 71 | {'f', 'l', 190}, // ¾ |
| 72 | {'c', '|', 191}, // ¿ |
| 73 | {'a', '^', 192}, // À |
| 74 | {'e', '^', 193}, // Á |
| 75 | {'o', '^', 194}, // Â |
| 76 | {'u', '^', 195}, // Ã |
| 77 | {'a', '\'', 196}, // Ä |
| 78 | {'e', '\'', 197}, // Å |
| 79 | {'o', '\'', 198}, // Æ |
| 80 | {'u', '\'', 199}, // Ç |
| 81 | {'a', '`', 200}, // È |
| 82 | {'e', '`', 201}, // É |
| 83 | {'o', '`', 202}, // Ê |
| 84 | {'u', '`', 203}, // Ë |
| 85 | {'a', '"', 204}, // Ì |
| 86 | {'e', '"', 205}, // Í |
| 87 | {'o', '"', 206}, // Î |
| 88 | {'u', '"', 207}, // Ï |
| 89 | {'A', 'o', 208}, // Ð |
| 90 | {'i', '^', 209}, // Ñ |
| 91 | {'O', '/', 210}, // Ò |
| 92 | {'A', 'E', 211}, // Ó |
| 93 | {'a', 'o', 212}, // Ô |
| 94 | {'i', '\'', 213}, // Õ |
| 95 | {'o', '/', 214}, // Ö |
| 96 | {'a', 'e', 215}, // × |
| 97 | {'A', '"', 216}, // Ø |
| 98 | {'i', '`', 217}, // Ù |
| 99 | {'O', '"', 218}, // Ú |
| 100 | {'U', '"', 219}, // Û |
| 101 | {'E', '\'', 220}, // Ü |
| 102 | {'i', '"', 221}, // Ý |
| 103 | {'s', 's', 222}, // Þ |
| 104 | {'O', '^', 223}, // ß |
| 105 | {'A', '\'', 224}, // à |
| 106 | {'A', '~', 225}, // á |
| 107 | {'a', '~', 226}, // â |
| 108 | {'D', '-', 227}, // ã |
| 109 | {'d', '-', 228}, // ä |
| 110 | {'I', '\'', 229}, // å |
| 111 | {'I', '`', 230}, // æ |
| 112 | {'O', '\'', 231}, // ç |
| 113 | {'O', '`', 232}, // è |
| 114 | {'O', '~', 233}, // é |
| 115 | {'o', '~', 234}, // ê |
| 116 | {'S', '~', 235}, // ë |
| 117 | {'s', '~', 236}, // ì |
| 118 | {'U', '\'', 237}, // í |
| 119 | {'Y', '"', 238}, // î |
| 120 | {'y', '"', 239}, // ï |
| 121 | {'p', '-', 240}, // ð |
| 122 | {'p', '~', 241}, // ñ |
| 123 | {'~', '.', 242}, // ò |
| 124 | {'j', 'u', 243}, // ó |
| 125 | {'P', 'p', 244}, // ô |
| 126 | {'3', '4', 245}, // õ |
| 127 | {'-', '-', 246}, // ö |
| 128 | {'1', '4', 247}, // ÷ |
| 129 | {'1', '2', 248}, // ø |
| 130 | {'a', '_', 249}, // ù |
| 131 | {'o', '_', 250}, // ú |
| 132 | {'<', '<', 251}, // û |
| 133 | {'x', 'x', 252}, // ü |
| 134 | {'>', '>', 253}, // ý |
| 135 | {'+', '-', 254}, // þ |
| 136 | {'n', 'u', 255}, // x XX |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 137 | {NUL, NUL, NUL} |
| 138 | }; |
| 139 | |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 140 | #else // !HPUX_DIGRAPHS |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 141 | |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 142 | # ifdef EBCDIC |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 143 | |
| 144 | /* |
| 145 | * EBCDIC - ISO digraphs |
| 146 | * TODO: EBCDIC Table is Code-Page 1047 |
| 147 | */ |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 148 | {{'a', '^', 66}, // â |
| 149 | {'a', '"', 67}, // ä |
| 150 | {'a', '`', 68}, // à |
| 151 | {'a', '\'', 69}, // á |
| 152 | {'a', '~', 70}, // ã |
| 153 | {'a', '@', 71}, // å |
| 154 | {'a', 'a', 71}, // å |
| 155 | {'c', ',', 72}, // ç |
| 156 | {'n', '~', 73}, // ñ |
| 157 | {'c', '|', 74}, // ¢ |
| 158 | {'e', '\'', 81}, // é |
| 159 | {'e', '^', 82}, // ê |
| 160 | {'e', '"', 83}, // ë |
| 161 | {'e', '`', 84}, // è |
| 162 | {'i', '\'', 85}, // í |
| 163 | {'i', '^', 86}, // î |
| 164 | {'i', '"', 87}, // ï |
| 165 | {'i', '`', 88}, // ì |
| 166 | {'s', 's', 89}, // ß |
| 167 | {'A', '^', 98}, // Â |
| 168 | {'A', '"', 99}, // Ä |
| 169 | {'A', '`', 100}, // À |
| 170 | {'A', '\'', 101}, // Á |
| 171 | {'A', '~', 102}, // Ã |
| 172 | {'A', '@', 103}, // Å |
| 173 | {'A', 'A', 103}, // Å |
| 174 | {'C', ',', 104}, // Ç |
| 175 | {'N', '~', 105}, // Ñ |
| 176 | {'|', '|', 106}, // ¦ |
| 177 | {'o', '/', 112}, // ø |
| 178 | {'E', '\'', 113}, // É |
| 179 | {'E', '^', 114}, // Ê |
| 180 | {'E', '"', 115}, // Ë |
| 181 | {'E', '`', 116}, // È |
| 182 | {'I', '\'', 117}, // Í |
| 183 | {'I', '^', 118}, // Î |
| 184 | {'I', '"', 119}, // Ï |
| 185 | {'I', '`', 120}, // Ì |
| 186 | {'O', '/', 128}, // 0/ XX |
| 187 | {'<', '<', 138}, // « |
| 188 | {'>', '>', 139}, // » |
| 189 | {'d', '-', 140}, // ð |
| 190 | {'y', '\'', 141}, // ý |
| 191 | {'i', 'p', 142}, // þ |
| 192 | {'+', '-', 143}, // ± |
| 193 | {'~', 'o', 144}, // ° |
| 194 | {'a', '-', 154}, // ª |
| 195 | {'o', '-', 155}, // º |
| 196 | {'a', 'e', 156}, // æ |
| 197 | {',', ',', 157}, // , XX |
| 198 | {'A', 'E', 158}, // Æ |
| 199 | {'o', 'x', 159}, // ¤ - currency symbol in ISO 8859-1 |
| 200 | {'e', '=', 159}, // ¤ - euro symbol in ISO 8859-15 |
| 201 | {'E', 'u', 159}, // ¤ - euro symbol in ISO 8859-15 |
| 202 | {'j', 'u', 160}, // µ |
| 203 | {'y', '"', 167}, // x XX |
| 204 | {'~', '!', 170}, // ¡ |
| 205 | {'~', '?', 171}, // ¿ |
| 206 | {'D', '-', 172}, // Ð |
| 207 | {'I', 'p', 174}, // Þ |
| 208 | {'r', 'O', 175}, // ® |
| 209 | {'-', ',', 176}, // ¬ |
| 210 | {'$', '$', 177}, // £ |
| 211 | {'Y', '-', 178}, // ¥ |
| 212 | {'~', '.', 179}, // · |
| 213 | {'c', 'O', 180}, // © |
| 214 | {'p', 'a', 181}, // § |
| 215 | {'p', 'p', 182}, // ¶ |
| 216 | {'1', '4', 183}, // ¼ |
| 217 | {'1', '2', 184}, // ½ |
| 218 | {'3', '4', 185}, // ¾ |
| 219 | {'Y', '\'', 186}, // Ý |
| 220 | {'"', '"', 187}, // ¨ |
| 221 | {'-', '=', 188}, // ¯ |
| 222 | {'\'', '\'', 190}, // ´ |
| 223 | {'O', 'E', 191}, // × - OE in ISO 8859-15 |
| 224 | {'/', '\\', 191}, // × - multiplication symbol in ISO 8859-1 |
| 225 | {'-', '-', 202}, // |
| 226 | {'o', '^', 203}, // ô |
| 227 | {'o', '"', 204}, // ö |
| 228 | {'o', '`', 205}, // ò |
| 229 | {'o', '\'', 206}, // ó |
| 230 | {'o', '~', 207}, // õ |
| 231 | {'1', '1', 218}, // ¹ |
| 232 | {'u', '^', 219}, // û |
| 233 | {'u', '"', 220}, // ü |
| 234 | {'u', '`', 221}, // ù |
| 235 | {'u', '\'', 222}, // ú |
| 236 | {':', '-', 225}, // ÷ - division symbol in ISO 8859-1 |
| 237 | {'o', 'e', 225}, // ÷ - oe in ISO 8859-15 |
| 238 | {'2', '2', 234}, // ² |
| 239 | {'O', '^', 235}, // Ô |
| 240 | {'O', '"', 236}, // Ö |
| 241 | {'O', '`', 237}, // Ò |
| 242 | {'O', '\'', 238}, // Ó |
| 243 | {'O', '~', 239}, // Õ |
| 244 | {'3', '3', 250}, // ³ |
| 245 | {'U', '^', 251}, // Û |
| 246 | {'U', '"', 252}, // Ü |
| 247 | {'U', '`', 253}, // Ù |
| 248 | {'U', '\'', 254}, // Ú |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 249 | {NUL, NUL, NUL} |
| 250 | }; |
| 251 | |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 252 | # else // EBCDIC |
| 253 | # ifdef OLD_DIGRAPHS |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 254 | |
| 255 | /* |
| 256 | * digraphs compatible with Vim 5.x |
| 257 | */ |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 258 | {{'~', '!', 161}, // ¡ |
| 259 | {'c', '|', 162}, // ¢ |
| 260 | {'$', '$', 163}, // £ |
| 261 | {'o', 'x', 164}, // ¤ - currency symbol in ISO 8859-1 |
| 262 | {'e', '=', 164}, // ¤ - euro symbol in ISO 8859-15 |
| 263 | {'Y', '-', 165}, // ¥ |
| 264 | {'|', '|', 166}, // ¦ |
| 265 | {'p', 'a', 167}, // § |
| 266 | {'"', '"', 168}, // ¨ |
| 267 | {'c', 'O', 169}, // © |
| 268 | {'a', '-', 170}, // ª |
| 269 | {'<', '<', 171}, // « |
| 270 | {'-', ',', 172}, // ¬ |
| 271 | {'-', '-', 173}, // |
| 272 | {'r', 'O', 174}, // ® |
| 273 | {'-', '=', 175}, // ¯ |
| 274 | {'~', 'o', 176}, // ° |
| 275 | {'+', '-', 177}, // ± |
| 276 | {'2', '2', 178}, // ² |
| 277 | {'3', '3', 179}, // ³ |
| 278 | {'\'', '\'', 180}, // ´ |
| 279 | {'j', 'u', 181}, // µ |
| 280 | {'p', 'p', 182}, // ¶ |
| 281 | {'~', '.', 183}, // · |
| 282 | {',', ',', 184}, // ¸ |
| 283 | {'1', '1', 185}, // ¹ |
| 284 | {'o', '-', 186}, // º |
| 285 | {'>', '>', 187}, // » |
| 286 | {'1', '4', 188}, // ¼ |
| 287 | {'1', '2', 189}, // ½ |
| 288 | {'3', '4', 190}, // ¾ |
| 289 | {'~', '?', 191}, // ¿ |
| 290 | {'A', '`', 192}, // À |
| 291 | {'A', '\'', 193}, // Á |
| 292 | {'A', '^', 194}, // Â |
| 293 | {'A', '~', 195}, // Ã |
| 294 | {'A', '"', 196}, // Ä |
| 295 | {'A', '@', 197}, // Å |
| 296 | {'A', 'A', 197}, // Å |
| 297 | {'A', 'E', 198}, // Æ |
| 298 | {'C', ',', 199}, // Ç |
| 299 | {'E', '`', 200}, // È |
| 300 | {'E', '\'', 201}, // É |
| 301 | {'E', '^', 202}, // Ê |
| 302 | {'E', '"', 203}, // Ë |
| 303 | {'I', '`', 204}, // Ì |
| 304 | {'I', '\'', 205}, // Í |
| 305 | {'I', '^', 206}, // Î |
| 306 | {'I', '"', 207}, // Ï |
| 307 | {'D', '-', 208}, // Ð |
| 308 | {'N', '~', 209}, // Ñ |
| 309 | {'O', '`', 210}, // Ò |
| 310 | {'O', '\'', 211}, // Ó |
| 311 | {'O', '^', 212}, // Ô |
| 312 | {'O', '~', 213}, // Õ |
| 313 | {'O', '"', 214}, // Ö |
| 314 | {'/', '\\', 215}, // × - multiplication symbol in ISO 8859-1 |
| 315 | {'O', 'E', 215}, // × - OE in ISO 8859-15 |
| 316 | {'O', '/', 216}, // Ø |
| 317 | {'U', '`', 217}, // Ù |
| 318 | {'U', '\'', 218}, // Ú |
| 319 | {'U', '^', 219}, // Û |
| 320 | {'U', '"', 220}, // Ü |
| 321 | {'Y', '\'', 221}, // Ý |
| 322 | {'I', 'p', 222}, // Þ |
| 323 | {'s', 's', 223}, // ß |
| 324 | {'a', '`', 224}, // à |
| 325 | {'a', '\'', 225}, // á |
| 326 | {'a', '^', 226}, // â |
| 327 | {'a', '~', 227}, // ã |
| 328 | {'a', '"', 228}, // ä |
| 329 | {'a', '@', 229}, // å |
| 330 | {'a', 'a', 229}, // å |
| 331 | {'a', 'e', 230}, // æ |
| 332 | {'c', ',', 231}, // ç |
| 333 | {'e', '`', 232}, // è |
| 334 | {'e', '\'', 233}, // é |
| 335 | {'e', '^', 234}, // ê |
| 336 | {'e', '"', 235}, // ë |
| 337 | {'i', '`', 236}, // ì |
| 338 | {'i', '\'', 237}, // í |
| 339 | {'i', '^', 238}, // î |
| 340 | {'i', '"', 239}, // ï |
| 341 | {'d', '-', 240}, // ð |
| 342 | {'n', '~', 241}, // ñ |
| 343 | {'o', '`', 242}, // ò |
| 344 | {'o', '\'', 243}, // ó |
| 345 | {'o', '^', 244}, // ô |
| 346 | {'o', '~', 245}, // õ |
| 347 | {'o', '"', 246}, // ö |
| 348 | {':', '-', 247}, // ÷ - division symbol in ISO 8859-1 |
| 349 | {'o', 'e', 247}, // ÷ - oe in ISO 8859-15 |
| 350 | {'o', '/', 248}, // ø |
| 351 | {'u', '`', 249}, // ù |
| 352 | {'u', '\'', 250}, // ú |
| 353 | {'u', '^', 251}, // û |
| 354 | {'u', '"', 252}, // ü |
| 355 | {'y', '\'', 253}, // ý |
| 356 | {'i', 'p', 254}, // þ |
| 357 | {'y', '"', 255}, // x XX |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 358 | {NUL, NUL, NUL} |
| 359 | }; |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 360 | # else // OLD_DIGRAPHS |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 361 | |
| 362 | /* |
| 363 | * digraphs for Unicode from RFC1345 |
| 364 | * (also work for ISO-8859-1 aka latin1) |
| 365 | */ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 366 | { |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 367 | {'N', 'U', 0x0a}, // LF for NUL |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 368 | {'S', 'H', 0x01}, |
| 369 | {'S', 'X', 0x02}, |
| 370 | {'E', 'X', 0x03}, |
| 371 | {'E', 'T', 0x04}, |
| 372 | {'E', 'Q', 0x05}, |
| 373 | {'A', 'K', 0x06}, |
| 374 | {'B', 'L', 0x07}, |
| 375 | {'B', 'S', 0x08}, |
| 376 | {'H', 'T', 0x09}, |
| 377 | {'L', 'F', 0x0a}, |
| 378 | {'V', 'T', 0x0b}, |
| 379 | {'F', 'F', 0x0c}, |
| 380 | {'C', 'R', 0x0d}, |
| 381 | {'S', 'O', 0x0e}, |
| 382 | {'S', 'I', 0x0f}, |
| 383 | {'D', 'L', 0x10}, |
| 384 | {'D', '1', 0x11}, |
| 385 | {'D', '2', 0x12}, |
| 386 | {'D', '3', 0x13}, |
| 387 | {'D', '4', 0x14}, |
| 388 | {'N', 'K', 0x15}, |
| 389 | {'S', 'Y', 0x16}, |
| 390 | {'E', 'B', 0x17}, |
| 391 | {'C', 'N', 0x18}, |
| 392 | {'E', 'M', 0x19}, |
| 393 | {'S', 'B', 0x1a}, |
| 394 | {'E', 'C', 0x1b}, |
| 395 | {'F', 'S', 0x1c}, |
| 396 | {'G', 'S', 0x1d}, |
| 397 | {'R', 'S', 0x1e}, |
| 398 | {'U', 'S', 0x1f}, |
| 399 | {'S', 'P', 0x20}, |
| 400 | {'N', 'b', 0x23}, |
| 401 | {'D', 'O', 0x24}, |
| 402 | {'A', 't', 0x40}, |
| 403 | {'<', '(', 0x5b}, |
| 404 | {'/', '/', 0x5c}, |
| 405 | {')', '>', 0x5d}, |
| 406 | {'\'', '>', 0x5e}, |
| 407 | {'\'', '!', 0x60}, |
| 408 | {'(', '!', 0x7b}, |
| 409 | {'!', '!', 0x7c}, |
| 410 | {'!', ')', 0x7d}, |
| 411 | {'\'', '?', 0x7e}, |
| 412 | {'D', 'T', 0x7f}, |
| 413 | {'P', 'A', 0x80}, |
| 414 | {'H', 'O', 0x81}, |
| 415 | {'B', 'H', 0x82}, |
| 416 | {'N', 'H', 0x83}, |
| 417 | {'I', 'N', 0x84}, |
| 418 | {'N', 'L', 0x85}, |
| 419 | {'S', 'A', 0x86}, |
| 420 | {'E', 'S', 0x87}, |
| 421 | {'H', 'S', 0x88}, |
| 422 | {'H', 'J', 0x89}, |
| 423 | {'V', 'S', 0x8a}, |
| 424 | {'P', 'D', 0x8b}, |
| 425 | {'P', 'U', 0x8c}, |
| 426 | {'R', 'I', 0x8d}, |
| 427 | {'S', '2', 0x8e}, |
| 428 | {'S', '3', 0x8f}, |
| 429 | {'D', 'C', 0x90}, |
| 430 | {'P', '1', 0x91}, |
| 431 | {'P', '2', 0x92}, |
| 432 | {'T', 'S', 0x93}, |
| 433 | {'C', 'C', 0x94}, |
| 434 | {'M', 'W', 0x95}, |
| 435 | {'S', 'G', 0x96}, |
| 436 | {'E', 'G', 0x97}, |
| 437 | {'S', 'S', 0x98}, |
| 438 | {'G', 'C', 0x99}, |
| 439 | {'S', 'C', 0x9a}, |
| 440 | {'C', 'I', 0x9b}, |
| 441 | {'S', 'T', 0x9c}, |
| 442 | {'O', 'C', 0x9d}, |
| 443 | {'P', 'M', 0x9e}, |
| 444 | {'A', 'C', 0x9f}, |
| 445 | {'N', 'S', 0xa0}, |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 446 | # define DG_START_LATIN 0xa1 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 447 | {'!', 'I', 0xa1}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 448 | {'~', '!', 0xa1}, // ¡ Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 449 | {'C', 't', 0xa2}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 450 | {'c', '|', 0xa2}, // ¢ Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 451 | {'P', 'd', 0xa3}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 452 | {'$', '$', 0xa3}, // £ Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 453 | {'C', 'u', 0xa4}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 454 | {'o', 'x', 0xa4}, // ¤ Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 455 | {'Y', 'e', 0xa5}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 456 | {'Y', '-', 0xa5}, // ¥ Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 457 | {'B', 'B', 0xa6}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 458 | {'|', '|', 0xa6}, // ¦ Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 459 | {'S', 'E', 0xa7}, |
| 460 | {'\'', ':', 0xa8}, |
| 461 | {'C', 'o', 0xa9}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 462 | {'c', 'O', 0xa9}, // © Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 463 | {'-', 'a', 0xaa}, |
| 464 | {'<', '<', 0xab}, |
| 465 | {'N', 'O', 0xac}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 466 | {'-', ',', 0xac}, // ¬ Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 467 | {'-', '-', 0xad}, |
| 468 | {'R', 'g', 0xae}, |
| 469 | {'\'', 'm', 0xaf}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 470 | {'-', '=', 0xaf}, // ¯ Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 471 | {'D', 'G', 0xb0}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 472 | {'~', 'o', 0xb0}, // ° Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 473 | {'+', '-', 0xb1}, |
| 474 | {'2', 'S', 0xb2}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 475 | {'2', '2', 0xb2}, // ² Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 476 | {'3', 'S', 0xb3}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 477 | {'3', '3', 0xb3}, // ³ Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 478 | {'\'', '\'', 0xb4}, |
| 479 | {'M', 'y', 0xb5}, |
| 480 | {'P', 'I', 0xb6}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 481 | {'p', 'p', 0xb6}, // ¶ Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 482 | {'.', 'M', 0xb7}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 483 | {'~', '.', 0xb7}, // · Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 484 | {'\'', ',', 0xb8}, |
| 485 | {'1', 'S', 0xb9}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 486 | {'1', '1', 0xb9}, // ¹ Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 487 | {'-', 'o', 0xba}, |
| 488 | {'>', '>', 0xbb}, |
| 489 | {'1', '4', 0xbc}, |
| 490 | {'1', '2', 0xbd}, |
| 491 | {'3', '4', 0xbe}, |
| 492 | {'?', 'I', 0xbf}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 493 | {'~', '?', 0xbf}, // ¿ Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 494 | {'A', '!', 0xc0}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 495 | {'A', '`', 0xc0}, // À Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 496 | {'A', '\'', 0xc1}, |
| 497 | {'A', '>', 0xc2}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 498 | {'A', '^', 0xc2}, // Â Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 499 | {'A', '?', 0xc3}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 500 | {'A', '~', 0xc3}, // Ã Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 501 | {'A', ':', 0xc4}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 502 | {'A', '"', 0xc4}, // Ä Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 503 | {'A', 'A', 0xc5}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 504 | {'A', '@', 0xc5}, // Å Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 505 | {'A', 'E', 0xc6}, |
| 506 | {'C', ',', 0xc7}, |
| 507 | {'E', '!', 0xc8}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 508 | {'E', '`', 0xc8}, // È Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 509 | {'E', '\'', 0xc9}, |
| 510 | {'E', '>', 0xca}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 511 | {'E', '^', 0xca}, // Ê Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 512 | {'E', ':', 0xcb}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 513 | {'E', '"', 0xcb}, // Ë Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 514 | {'I', '!', 0xcc}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 515 | {'I', '`', 0xcc}, // Ì Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 516 | {'I', '\'', 0xcd}, |
| 517 | {'I', '>', 0xce}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 518 | {'I', '^', 0xce}, // Î Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 519 | {'I', ':', 0xcf}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 520 | {'I', '"', 0xcf}, // Ï Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 521 | {'D', '-', 0xd0}, |
| 522 | {'N', '?', 0xd1}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 523 | {'N', '~', 0xd1}, // Ñ Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 524 | {'O', '!', 0xd2}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 525 | {'O', '`', 0xd2}, // Ò Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 526 | {'O', '\'', 0xd3}, |
| 527 | {'O', '>', 0xd4}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 528 | {'O', '^', 0xd4}, // Ô Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 529 | {'O', '?', 0xd5}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 530 | {'O', '~', 0xd5}, // Õ Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 531 | {'O', ':', 0xd6}, |
| 532 | {'*', 'X', 0xd7}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 533 | {'/', '\\', 0xd7}, // × Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 534 | {'O', '/', 0xd8}, |
| 535 | {'U', '!', 0xd9}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 536 | {'U', '`', 0xd9}, // Ù Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 537 | {'U', '\'', 0xda}, |
| 538 | {'U', '>', 0xdb}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 539 | {'U', '^', 0xdb}, // Û Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 540 | {'U', ':', 0xdc}, |
| 541 | {'Y', '\'', 0xdd}, |
| 542 | {'T', 'H', 0xde}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 543 | {'I', 'p', 0xde}, // Þ Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 544 | {'s', 's', 0xdf}, |
| 545 | {'a', '!', 0xe0}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 546 | {'a', '`', 0xe0}, // à Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 547 | {'a', '\'', 0xe1}, |
| 548 | {'a', '>', 0xe2}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 549 | {'a', '^', 0xe2}, // â Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 550 | {'a', '?', 0xe3}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 551 | {'a', '~', 0xe3}, // ã Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 552 | {'a', ':', 0xe4}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 553 | {'a', '"', 0xe4}, // ä Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 554 | {'a', 'a', 0xe5}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 555 | {'a', '@', 0xe5}, // å Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 556 | {'a', 'e', 0xe6}, |
| 557 | {'c', ',', 0xe7}, |
| 558 | {'e', '!', 0xe8}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 559 | {'e', '`', 0xe8}, // è Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 560 | {'e', '\'', 0xe9}, |
| 561 | {'e', '>', 0xea}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 562 | {'e', '^', 0xea}, // ê Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 563 | {'e', ':', 0xeb}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 564 | {'e', '"', 0xeb}, // ë Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 565 | {'i', '!', 0xec}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 566 | {'i', '`', 0xec}, // ì Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 567 | {'i', '\'', 0xed}, |
| 568 | {'i', '>', 0xee}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 569 | {'i', '^', 0xee}, // î Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 570 | {'i', ':', 0xef}, |
| 571 | {'d', '-', 0xf0}, |
| 572 | {'n', '?', 0xf1}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 573 | {'n', '~', 0xf1}, // ñ Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 574 | {'o', '!', 0xf2}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 575 | {'o', '`', 0xf2}, // ò Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 576 | {'o', '\'', 0xf3}, |
| 577 | {'o', '>', 0xf4}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 578 | {'o', '^', 0xf4}, // ô Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 579 | {'o', '?', 0xf5}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 580 | {'o', '~', 0xf5}, // õ Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 581 | {'o', ':', 0xf6}, |
| 582 | {'-', ':', 0xf7}, |
| 583 | {'o', '/', 0xf8}, |
| 584 | {'u', '!', 0xf9}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 585 | {'u', '`', 0xf9}, // ù Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 586 | {'u', '\'', 0xfa}, |
| 587 | {'u', '>', 0xfb}, |
Bram Moolenaar | 4119309 | 2019-08-24 21:53:31 +0200 | [diff] [blame] | 588 | {'u', '^', 0xfb}, // û Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 589 | {'u', ':', 0xfc}, |
| 590 | {'y', '\'', 0xfd}, |
| 591 | {'t', 'h', 0xfe}, |
| 592 | {'y', ':', 0xff}, |
Bram Moolenaar | eae8ae1 | 2018-12-14 18:53:02 +0100 | [diff] [blame] | 593 | {'y', '"', 0xff}, // x XX Vim 5.x compatible |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 594 | |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 595 | # define USE_UNICODE_DIGRAPHS |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 596 | |
| 597 | {'A', '-', 0x0100}, |
| 598 | {'a', '-', 0x0101}, |
| 599 | {'A', '(', 0x0102}, |
| 600 | {'a', '(', 0x0103}, |
| 601 | {'A', ';', 0x0104}, |
| 602 | {'a', ';', 0x0105}, |
| 603 | {'C', '\'', 0x0106}, |
| 604 | {'c', '\'', 0x0107}, |
| 605 | {'C', '>', 0x0108}, |
| 606 | {'c', '>', 0x0109}, |
| 607 | {'C', '.', 0x010a}, |
| 608 | {'c', '.', 0x010b}, |
| 609 | {'C', '<', 0x010c}, |
| 610 | {'c', '<', 0x010d}, |
| 611 | {'D', '<', 0x010e}, |
| 612 | {'d', '<', 0x010f}, |
| 613 | {'D', '/', 0x0110}, |
| 614 | {'d', '/', 0x0111}, |
| 615 | {'E', '-', 0x0112}, |
| 616 | {'e', '-', 0x0113}, |
| 617 | {'E', '(', 0x0114}, |
| 618 | {'e', '(', 0x0115}, |
| 619 | {'E', '.', 0x0116}, |
| 620 | {'e', '.', 0x0117}, |
| 621 | {'E', ';', 0x0118}, |
| 622 | {'e', ';', 0x0119}, |
| 623 | {'E', '<', 0x011a}, |
| 624 | {'e', '<', 0x011b}, |
| 625 | {'G', '>', 0x011c}, |
| 626 | {'g', '>', 0x011d}, |
| 627 | {'G', '(', 0x011e}, |
| 628 | {'g', '(', 0x011f}, |
| 629 | {'G', '.', 0x0120}, |
| 630 | {'g', '.', 0x0121}, |
| 631 | {'G', ',', 0x0122}, |
| 632 | {'g', ',', 0x0123}, |
| 633 | {'H', '>', 0x0124}, |
| 634 | {'h', '>', 0x0125}, |
| 635 | {'H', '/', 0x0126}, |
| 636 | {'h', '/', 0x0127}, |
| 637 | {'I', '?', 0x0128}, |
| 638 | {'i', '?', 0x0129}, |
| 639 | {'I', '-', 0x012a}, |
| 640 | {'i', '-', 0x012b}, |
| 641 | {'I', '(', 0x012c}, |
| 642 | {'i', '(', 0x012d}, |
| 643 | {'I', ';', 0x012e}, |
| 644 | {'i', ';', 0x012f}, |
| 645 | {'I', '.', 0x0130}, |
| 646 | {'i', '.', 0x0131}, |
| 647 | {'I', 'J', 0x0132}, |
| 648 | {'i', 'j', 0x0133}, |
| 649 | {'J', '>', 0x0134}, |
| 650 | {'j', '>', 0x0135}, |
| 651 | {'K', ',', 0x0136}, |
| 652 | {'k', ',', 0x0137}, |
| 653 | {'k', 'k', 0x0138}, |
| 654 | {'L', '\'', 0x0139}, |
| 655 | {'l', '\'', 0x013a}, |
| 656 | {'L', ',', 0x013b}, |
| 657 | {'l', ',', 0x013c}, |
| 658 | {'L', '<', 0x013d}, |
| 659 | {'l', '<', 0x013e}, |
| 660 | {'L', '.', 0x013f}, |
| 661 | {'l', '.', 0x0140}, |
| 662 | {'L', '/', 0x0141}, |
| 663 | {'l', '/', 0x0142}, |
| 664 | {'N', '\'', 0x0143}, |
| 665 | {'n', '\'', 0x0144}, |
| 666 | {'N', ',', 0x0145}, |
| 667 | {'n', ',', 0x0146}, |
| 668 | {'N', '<', 0x0147}, |
| 669 | {'n', '<', 0x0148}, |
| 670 | {'\'', 'n', 0x0149}, |
| 671 | {'N', 'G', 0x014a}, |
| 672 | {'n', 'g', 0x014b}, |
| 673 | {'O', '-', 0x014c}, |
| 674 | {'o', '-', 0x014d}, |
| 675 | {'O', '(', 0x014e}, |
| 676 | {'o', '(', 0x014f}, |
| 677 | {'O', '"', 0x0150}, |
| 678 | {'o', '"', 0x0151}, |
| 679 | {'O', 'E', 0x0152}, |
| 680 | {'o', 'e', 0x0153}, |
| 681 | {'R', '\'', 0x0154}, |
| 682 | {'r', '\'', 0x0155}, |
| 683 | {'R', ',', 0x0156}, |
| 684 | {'r', ',', 0x0157}, |
| 685 | {'R', '<', 0x0158}, |
| 686 | {'r', '<', 0x0159}, |
| 687 | {'S', '\'', 0x015a}, |
| 688 | {'s', '\'', 0x015b}, |
| 689 | {'S', '>', 0x015c}, |
| 690 | {'s', '>', 0x015d}, |
| 691 | {'S', ',', 0x015e}, |
| 692 | {'s', ',', 0x015f}, |
| 693 | {'S', '<', 0x0160}, |
| 694 | {'s', '<', 0x0161}, |
| 695 | {'T', ',', 0x0162}, |
| 696 | {'t', ',', 0x0163}, |
| 697 | {'T', '<', 0x0164}, |
| 698 | {'t', '<', 0x0165}, |
| 699 | {'T', '/', 0x0166}, |
| 700 | {'t', '/', 0x0167}, |
| 701 | {'U', '?', 0x0168}, |
| 702 | {'u', '?', 0x0169}, |
| 703 | {'U', '-', 0x016a}, |
| 704 | {'u', '-', 0x016b}, |
| 705 | {'U', '(', 0x016c}, |
| 706 | {'u', '(', 0x016d}, |
| 707 | {'U', '0', 0x016e}, |
| 708 | {'u', '0', 0x016f}, |
| 709 | {'U', '"', 0x0170}, |
| 710 | {'u', '"', 0x0171}, |
| 711 | {'U', ';', 0x0172}, |
| 712 | {'u', ';', 0x0173}, |
| 713 | {'W', '>', 0x0174}, |
| 714 | {'w', '>', 0x0175}, |
| 715 | {'Y', '>', 0x0176}, |
| 716 | {'y', '>', 0x0177}, |
| 717 | {'Y', ':', 0x0178}, |
| 718 | {'Z', '\'', 0x0179}, |
| 719 | {'z', '\'', 0x017a}, |
| 720 | {'Z', '.', 0x017b}, |
| 721 | {'z', '.', 0x017c}, |
| 722 | {'Z', '<', 0x017d}, |
| 723 | {'z', '<', 0x017e}, |
| 724 | {'O', '9', 0x01a0}, |
| 725 | {'o', '9', 0x01a1}, |
| 726 | {'O', 'I', 0x01a2}, |
| 727 | {'o', 'i', 0x01a3}, |
| 728 | {'y', 'r', 0x01a6}, |
| 729 | {'U', '9', 0x01af}, |
| 730 | {'u', '9', 0x01b0}, |
| 731 | {'Z', '/', 0x01b5}, |
| 732 | {'z', '/', 0x01b6}, |
| 733 | {'E', 'D', 0x01b7}, |
| 734 | {'A', '<', 0x01cd}, |
| 735 | {'a', '<', 0x01ce}, |
| 736 | {'I', '<', 0x01cf}, |
| 737 | {'i', '<', 0x01d0}, |
| 738 | {'O', '<', 0x01d1}, |
| 739 | {'o', '<', 0x01d2}, |
| 740 | {'U', '<', 0x01d3}, |
| 741 | {'u', '<', 0x01d4}, |
| 742 | {'A', '1', 0x01de}, |
| 743 | {'a', '1', 0x01df}, |
| 744 | {'A', '7', 0x01e0}, |
| 745 | {'a', '7', 0x01e1}, |
| 746 | {'A', '3', 0x01e2}, |
| 747 | {'a', '3', 0x01e3}, |
| 748 | {'G', '/', 0x01e4}, |
| 749 | {'g', '/', 0x01e5}, |
| 750 | {'G', '<', 0x01e6}, |
| 751 | {'g', '<', 0x01e7}, |
| 752 | {'K', '<', 0x01e8}, |
| 753 | {'k', '<', 0x01e9}, |
| 754 | {'O', ';', 0x01ea}, |
| 755 | {'o', ';', 0x01eb}, |
| 756 | {'O', '1', 0x01ec}, |
| 757 | {'o', '1', 0x01ed}, |
| 758 | {'E', 'Z', 0x01ee}, |
| 759 | {'e', 'z', 0x01ef}, |
| 760 | {'j', '<', 0x01f0}, |
| 761 | {'G', '\'', 0x01f4}, |
| 762 | {'g', '\'', 0x01f5}, |
| 763 | {';', 'S', 0x02bf}, |
| 764 | {'\'', '<', 0x02c7}, |
| 765 | {'\'', '(', 0x02d8}, |
| 766 | {'\'', '.', 0x02d9}, |
| 767 | {'\'', '0', 0x02da}, |
| 768 | {'\'', ';', 0x02db}, |
| 769 | {'\'', '"', 0x02dd}, |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 770 | # define DG_START_GREEK 0x0386 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 771 | {'A', '%', 0x0386}, |
| 772 | {'E', '%', 0x0388}, |
| 773 | {'Y', '%', 0x0389}, |
| 774 | {'I', '%', 0x038a}, |
| 775 | {'O', '%', 0x038c}, |
| 776 | {'U', '%', 0x038e}, |
| 777 | {'W', '%', 0x038f}, |
| 778 | {'i', '3', 0x0390}, |
| 779 | {'A', '*', 0x0391}, |
| 780 | {'B', '*', 0x0392}, |
| 781 | {'G', '*', 0x0393}, |
| 782 | {'D', '*', 0x0394}, |
| 783 | {'E', '*', 0x0395}, |
| 784 | {'Z', '*', 0x0396}, |
| 785 | {'Y', '*', 0x0397}, |
| 786 | {'H', '*', 0x0398}, |
| 787 | {'I', '*', 0x0399}, |
| 788 | {'K', '*', 0x039a}, |
| 789 | {'L', '*', 0x039b}, |
| 790 | {'M', '*', 0x039c}, |
| 791 | {'N', '*', 0x039d}, |
| 792 | {'C', '*', 0x039e}, |
| 793 | {'O', '*', 0x039f}, |
| 794 | {'P', '*', 0x03a0}, |
| 795 | {'R', '*', 0x03a1}, |
| 796 | {'S', '*', 0x03a3}, |
| 797 | {'T', '*', 0x03a4}, |
| 798 | {'U', '*', 0x03a5}, |
| 799 | {'F', '*', 0x03a6}, |
| 800 | {'X', '*', 0x03a7}, |
| 801 | {'Q', '*', 0x03a8}, |
| 802 | {'W', '*', 0x03a9}, |
| 803 | {'J', '*', 0x03aa}, |
| 804 | {'V', '*', 0x03ab}, |
| 805 | {'a', '%', 0x03ac}, |
| 806 | {'e', '%', 0x03ad}, |
| 807 | {'y', '%', 0x03ae}, |
| 808 | {'i', '%', 0x03af}, |
| 809 | {'u', '3', 0x03b0}, |
| 810 | {'a', '*', 0x03b1}, |
| 811 | {'b', '*', 0x03b2}, |
| 812 | {'g', '*', 0x03b3}, |
| 813 | {'d', '*', 0x03b4}, |
| 814 | {'e', '*', 0x03b5}, |
| 815 | {'z', '*', 0x03b6}, |
| 816 | {'y', '*', 0x03b7}, |
| 817 | {'h', '*', 0x03b8}, |
| 818 | {'i', '*', 0x03b9}, |
| 819 | {'k', '*', 0x03ba}, |
| 820 | {'l', '*', 0x03bb}, |
| 821 | {'m', '*', 0x03bc}, |
| 822 | {'n', '*', 0x03bd}, |
| 823 | {'c', '*', 0x03be}, |
| 824 | {'o', '*', 0x03bf}, |
| 825 | {'p', '*', 0x03c0}, |
| 826 | {'r', '*', 0x03c1}, |
| 827 | {'*', 's', 0x03c2}, |
| 828 | {'s', '*', 0x03c3}, |
| 829 | {'t', '*', 0x03c4}, |
| 830 | {'u', '*', 0x03c5}, |
| 831 | {'f', '*', 0x03c6}, |
| 832 | {'x', '*', 0x03c7}, |
| 833 | {'q', '*', 0x03c8}, |
| 834 | {'w', '*', 0x03c9}, |
| 835 | {'j', '*', 0x03ca}, |
| 836 | {'v', '*', 0x03cb}, |
| 837 | {'o', '%', 0x03cc}, |
| 838 | {'u', '%', 0x03cd}, |
| 839 | {'w', '%', 0x03ce}, |
| 840 | {'\'', 'G', 0x03d8}, |
| 841 | {',', 'G', 0x03d9}, |
| 842 | {'T', '3', 0x03da}, |
| 843 | {'t', '3', 0x03db}, |
| 844 | {'M', '3', 0x03dc}, |
| 845 | {'m', '3', 0x03dd}, |
| 846 | {'K', '3', 0x03de}, |
| 847 | {'k', '3', 0x03df}, |
| 848 | {'P', '3', 0x03e0}, |
| 849 | {'p', '3', 0x03e1}, |
| 850 | {'\'', '%', 0x03f4}, |
| 851 | {'j', '3', 0x03f5}, |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 852 | # define DG_START_CYRILLIC 0x0401 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 853 | {'I', 'O', 0x0401}, |
| 854 | {'D', '%', 0x0402}, |
| 855 | {'G', '%', 0x0403}, |
| 856 | {'I', 'E', 0x0404}, |
| 857 | {'D', 'S', 0x0405}, |
| 858 | {'I', 'I', 0x0406}, |
| 859 | {'Y', 'I', 0x0407}, |
| 860 | {'J', '%', 0x0408}, |
| 861 | {'L', 'J', 0x0409}, |
| 862 | {'N', 'J', 0x040a}, |
| 863 | {'T', 's', 0x040b}, |
| 864 | {'K', 'J', 0x040c}, |
| 865 | {'V', '%', 0x040e}, |
| 866 | {'D', 'Z', 0x040f}, |
| 867 | {'A', '=', 0x0410}, |
| 868 | {'B', '=', 0x0411}, |
| 869 | {'V', '=', 0x0412}, |
| 870 | {'G', '=', 0x0413}, |
| 871 | {'D', '=', 0x0414}, |
| 872 | {'E', '=', 0x0415}, |
| 873 | {'Z', '%', 0x0416}, |
| 874 | {'Z', '=', 0x0417}, |
| 875 | {'I', '=', 0x0418}, |
| 876 | {'J', '=', 0x0419}, |
| 877 | {'K', '=', 0x041a}, |
| 878 | {'L', '=', 0x041b}, |
| 879 | {'M', '=', 0x041c}, |
| 880 | {'N', '=', 0x041d}, |
| 881 | {'O', '=', 0x041e}, |
| 882 | {'P', '=', 0x041f}, |
| 883 | {'R', '=', 0x0420}, |
| 884 | {'S', '=', 0x0421}, |
| 885 | {'T', '=', 0x0422}, |
| 886 | {'U', '=', 0x0423}, |
| 887 | {'F', '=', 0x0424}, |
| 888 | {'H', '=', 0x0425}, |
| 889 | {'C', '=', 0x0426}, |
| 890 | {'C', '%', 0x0427}, |
| 891 | {'S', '%', 0x0428}, |
| 892 | {'S', 'c', 0x0429}, |
| 893 | {'=', '"', 0x042a}, |
| 894 | {'Y', '=', 0x042b}, |
| 895 | {'%', '"', 0x042c}, |
| 896 | {'J', 'E', 0x042d}, |
| 897 | {'J', 'U', 0x042e}, |
| 898 | {'J', 'A', 0x042f}, |
| 899 | {'a', '=', 0x0430}, |
| 900 | {'b', '=', 0x0431}, |
| 901 | {'v', '=', 0x0432}, |
| 902 | {'g', '=', 0x0433}, |
| 903 | {'d', '=', 0x0434}, |
| 904 | {'e', '=', 0x0435}, |
| 905 | {'z', '%', 0x0436}, |
| 906 | {'z', '=', 0x0437}, |
| 907 | {'i', '=', 0x0438}, |
| 908 | {'j', '=', 0x0439}, |
| 909 | {'k', '=', 0x043a}, |
| 910 | {'l', '=', 0x043b}, |
| 911 | {'m', '=', 0x043c}, |
| 912 | {'n', '=', 0x043d}, |
| 913 | {'o', '=', 0x043e}, |
| 914 | {'p', '=', 0x043f}, |
| 915 | {'r', '=', 0x0440}, |
| 916 | {'s', '=', 0x0441}, |
| 917 | {'t', '=', 0x0442}, |
| 918 | {'u', '=', 0x0443}, |
| 919 | {'f', '=', 0x0444}, |
| 920 | {'h', '=', 0x0445}, |
| 921 | {'c', '=', 0x0446}, |
| 922 | {'c', '%', 0x0447}, |
| 923 | {'s', '%', 0x0448}, |
| 924 | {'s', 'c', 0x0449}, |
| 925 | {'=', '\'', 0x044a}, |
| 926 | {'y', '=', 0x044b}, |
| 927 | {'%', '\'', 0x044c}, |
| 928 | {'j', 'e', 0x044d}, |
| 929 | {'j', 'u', 0x044e}, |
| 930 | {'j', 'a', 0x044f}, |
| 931 | {'i', 'o', 0x0451}, |
| 932 | {'d', '%', 0x0452}, |
| 933 | {'g', '%', 0x0453}, |
| 934 | {'i', 'e', 0x0454}, |
| 935 | {'d', 's', 0x0455}, |
| 936 | {'i', 'i', 0x0456}, |
| 937 | {'y', 'i', 0x0457}, |
| 938 | {'j', '%', 0x0458}, |
| 939 | {'l', 'j', 0x0459}, |
| 940 | {'n', 'j', 0x045a}, |
| 941 | {'t', 's', 0x045b}, |
| 942 | {'k', 'j', 0x045c}, |
| 943 | {'v', '%', 0x045e}, |
| 944 | {'d', 'z', 0x045f}, |
| 945 | {'Y', '3', 0x0462}, |
| 946 | {'y', '3', 0x0463}, |
| 947 | {'O', '3', 0x046a}, |
| 948 | {'o', '3', 0x046b}, |
| 949 | {'F', '3', 0x0472}, |
| 950 | {'f', '3', 0x0473}, |
| 951 | {'V', '3', 0x0474}, |
| 952 | {'v', '3', 0x0475}, |
| 953 | {'C', '3', 0x0480}, |
| 954 | {'c', '3', 0x0481}, |
| 955 | {'G', '3', 0x0490}, |
| 956 | {'g', '3', 0x0491}, |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 957 | # define DG_START_HEBREW 0x05d0 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 958 | {'A', '+', 0x05d0}, |
| 959 | {'B', '+', 0x05d1}, |
| 960 | {'G', '+', 0x05d2}, |
| 961 | {'D', '+', 0x05d3}, |
| 962 | {'H', '+', 0x05d4}, |
| 963 | {'W', '+', 0x05d5}, |
| 964 | {'Z', '+', 0x05d6}, |
| 965 | {'X', '+', 0x05d7}, |
| 966 | {'T', 'j', 0x05d8}, |
| 967 | {'J', '+', 0x05d9}, |
| 968 | {'K', '%', 0x05da}, |
| 969 | {'K', '+', 0x05db}, |
| 970 | {'L', '+', 0x05dc}, |
| 971 | {'M', '%', 0x05dd}, |
| 972 | {'M', '+', 0x05de}, |
| 973 | {'N', '%', 0x05df}, |
| 974 | {'N', '+', 0x05e0}, |
| 975 | {'S', '+', 0x05e1}, |
| 976 | {'E', '+', 0x05e2}, |
| 977 | {'P', '%', 0x05e3}, |
| 978 | {'P', '+', 0x05e4}, |
| 979 | {'Z', 'j', 0x05e5}, |
| 980 | {'Z', 'J', 0x05e6}, |
| 981 | {'Q', '+', 0x05e7}, |
| 982 | {'R', '+', 0x05e8}, |
| 983 | {'S', 'h', 0x05e9}, |
| 984 | {'T', '+', 0x05ea}, |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 985 | # define DG_START_ARABIC 0x060c |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 986 | {',', '+', 0x060c}, |
| 987 | {';', '+', 0x061b}, |
| 988 | {'?', '+', 0x061f}, |
| 989 | {'H', '\'', 0x0621}, |
| 990 | {'a', 'M', 0x0622}, |
| 991 | {'a', 'H', 0x0623}, |
| 992 | {'w', 'H', 0x0624}, |
| 993 | {'a', 'h', 0x0625}, |
| 994 | {'y', 'H', 0x0626}, |
| 995 | {'a', '+', 0x0627}, |
| 996 | {'b', '+', 0x0628}, |
| 997 | {'t', 'm', 0x0629}, |
| 998 | {'t', '+', 0x062a}, |
| 999 | {'t', 'k', 0x062b}, |
| 1000 | {'g', '+', 0x062c}, |
| 1001 | {'h', 'k', 0x062d}, |
| 1002 | {'x', '+', 0x062e}, |
| 1003 | {'d', '+', 0x062f}, |
| 1004 | {'d', 'k', 0x0630}, |
| 1005 | {'r', '+', 0x0631}, |
| 1006 | {'z', '+', 0x0632}, |
| 1007 | {'s', '+', 0x0633}, |
| 1008 | {'s', 'n', 0x0634}, |
| 1009 | {'c', '+', 0x0635}, |
| 1010 | {'d', 'd', 0x0636}, |
| 1011 | {'t', 'j', 0x0637}, |
| 1012 | {'z', 'H', 0x0638}, |
| 1013 | {'e', '+', 0x0639}, |
| 1014 | {'i', '+', 0x063a}, |
| 1015 | {'+', '+', 0x0640}, |
| 1016 | {'f', '+', 0x0641}, |
| 1017 | {'q', '+', 0x0642}, |
| 1018 | {'k', '+', 0x0643}, |
| 1019 | {'l', '+', 0x0644}, |
| 1020 | {'m', '+', 0x0645}, |
| 1021 | {'n', '+', 0x0646}, |
| 1022 | {'h', '+', 0x0647}, |
| 1023 | {'w', '+', 0x0648}, |
| 1024 | {'j', '+', 0x0649}, |
| 1025 | {'y', '+', 0x064a}, |
| 1026 | {':', '+', 0x064b}, |
| 1027 | {'"', '+', 0x064c}, |
| 1028 | {'=', '+', 0x064d}, |
| 1029 | {'/', '+', 0x064e}, |
| 1030 | {'\'', '+', 0x064f}, |
| 1031 | {'1', '+', 0x0650}, |
| 1032 | {'3', '+', 0x0651}, |
| 1033 | {'0', '+', 0x0652}, |
| 1034 | {'a', 'S', 0x0670}, |
| 1035 | {'p', '+', 0x067e}, |
| 1036 | {'v', '+', 0x06a4}, |
| 1037 | {'g', 'f', 0x06af}, |
| 1038 | {'0', 'a', 0x06f0}, |
| 1039 | {'1', 'a', 0x06f1}, |
| 1040 | {'2', 'a', 0x06f2}, |
| 1041 | {'3', 'a', 0x06f3}, |
| 1042 | {'4', 'a', 0x06f4}, |
| 1043 | {'5', 'a', 0x06f5}, |
| 1044 | {'6', 'a', 0x06f6}, |
| 1045 | {'7', 'a', 0x06f7}, |
| 1046 | {'8', 'a', 0x06f8}, |
| 1047 | {'9', 'a', 0x06f9}, |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 1048 | # define DG_START_LATIN_EXTENDED 0x1e02 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1049 | {'B', '.', 0x1e02}, |
| 1050 | {'b', '.', 0x1e03}, |
| 1051 | {'B', '_', 0x1e06}, |
| 1052 | {'b', '_', 0x1e07}, |
| 1053 | {'D', '.', 0x1e0a}, |
| 1054 | {'d', '.', 0x1e0b}, |
| 1055 | {'D', '_', 0x1e0e}, |
| 1056 | {'d', '_', 0x1e0f}, |
| 1057 | {'D', ',', 0x1e10}, |
| 1058 | {'d', ',', 0x1e11}, |
| 1059 | {'F', '.', 0x1e1e}, |
| 1060 | {'f', '.', 0x1e1f}, |
| 1061 | {'G', '-', 0x1e20}, |
| 1062 | {'g', '-', 0x1e21}, |
| 1063 | {'H', '.', 0x1e22}, |
| 1064 | {'h', '.', 0x1e23}, |
| 1065 | {'H', ':', 0x1e26}, |
| 1066 | {'h', ':', 0x1e27}, |
| 1067 | {'H', ',', 0x1e28}, |
| 1068 | {'h', ',', 0x1e29}, |
| 1069 | {'K', '\'', 0x1e30}, |
| 1070 | {'k', '\'', 0x1e31}, |
| 1071 | {'K', '_', 0x1e34}, |
| 1072 | {'k', '_', 0x1e35}, |
| 1073 | {'L', '_', 0x1e3a}, |
| 1074 | {'l', '_', 0x1e3b}, |
| 1075 | {'M', '\'', 0x1e3e}, |
| 1076 | {'m', '\'', 0x1e3f}, |
| 1077 | {'M', '.', 0x1e40}, |
| 1078 | {'m', '.', 0x1e41}, |
| 1079 | {'N', '.', 0x1e44}, |
| 1080 | {'n', '.', 0x1e45}, |
| 1081 | {'N', '_', 0x1e48}, |
| 1082 | {'n', '_', 0x1e49}, |
| 1083 | {'P', '\'', 0x1e54}, |
| 1084 | {'p', '\'', 0x1e55}, |
| 1085 | {'P', '.', 0x1e56}, |
| 1086 | {'p', '.', 0x1e57}, |
| 1087 | {'R', '.', 0x1e58}, |
| 1088 | {'r', '.', 0x1e59}, |
| 1089 | {'R', '_', 0x1e5e}, |
| 1090 | {'r', '_', 0x1e5f}, |
| 1091 | {'S', '.', 0x1e60}, |
| 1092 | {'s', '.', 0x1e61}, |
| 1093 | {'T', '.', 0x1e6a}, |
| 1094 | {'t', '.', 0x1e6b}, |
| 1095 | {'T', '_', 0x1e6e}, |
| 1096 | {'t', '_', 0x1e6f}, |
| 1097 | {'V', '?', 0x1e7c}, |
| 1098 | {'v', '?', 0x1e7d}, |
| 1099 | {'W', '!', 0x1e80}, |
Bram Moolenaar | eae8ae1 | 2018-12-14 18:53:02 +0100 | [diff] [blame] | 1100 | {'W', '`', 0x1e80}, // extra alternative, easier to remember |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1101 | {'w', '!', 0x1e81}, |
Bram Moolenaar | eae8ae1 | 2018-12-14 18:53:02 +0100 | [diff] [blame] | 1102 | {'w', '`', 0x1e81}, // extra alternative, easier to remember |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1103 | {'W', '\'', 0x1e82}, |
| 1104 | {'w', '\'', 0x1e83}, |
| 1105 | {'W', ':', 0x1e84}, |
| 1106 | {'w', ':', 0x1e85}, |
| 1107 | {'W', '.', 0x1e86}, |
| 1108 | {'w', '.', 0x1e87}, |
| 1109 | {'X', '.', 0x1e8a}, |
| 1110 | {'x', '.', 0x1e8b}, |
| 1111 | {'X', ':', 0x1e8c}, |
| 1112 | {'x', ':', 0x1e8d}, |
| 1113 | {'Y', '.', 0x1e8e}, |
| 1114 | {'y', '.', 0x1e8f}, |
| 1115 | {'Z', '>', 0x1e90}, |
| 1116 | {'z', '>', 0x1e91}, |
| 1117 | {'Z', '_', 0x1e94}, |
| 1118 | {'z', '_', 0x1e95}, |
| 1119 | {'h', '_', 0x1e96}, |
| 1120 | {'t', ':', 0x1e97}, |
| 1121 | {'w', '0', 0x1e98}, |
| 1122 | {'y', '0', 0x1e99}, |
| 1123 | {'A', '2', 0x1ea2}, |
| 1124 | {'a', '2', 0x1ea3}, |
| 1125 | {'E', '2', 0x1eba}, |
| 1126 | {'e', '2', 0x1ebb}, |
| 1127 | {'E', '?', 0x1ebc}, |
| 1128 | {'e', '?', 0x1ebd}, |
| 1129 | {'I', '2', 0x1ec8}, |
| 1130 | {'i', '2', 0x1ec9}, |
| 1131 | {'O', '2', 0x1ece}, |
| 1132 | {'o', '2', 0x1ecf}, |
| 1133 | {'U', '2', 0x1ee6}, |
| 1134 | {'u', '2', 0x1ee7}, |
| 1135 | {'Y', '!', 0x1ef2}, |
Bram Moolenaar | eae8ae1 | 2018-12-14 18:53:02 +0100 | [diff] [blame] | 1136 | {'Y', '`', 0x1ef2}, // extra alternative, easier to remember |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1137 | {'y', '!', 0x1ef3}, |
Bram Moolenaar | eae8ae1 | 2018-12-14 18:53:02 +0100 | [diff] [blame] | 1138 | {'y', '`', 0x1ef3}, // extra alternative, easier to remember |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1139 | {'Y', '2', 0x1ef6}, |
| 1140 | {'y', '2', 0x1ef7}, |
| 1141 | {'Y', '?', 0x1ef8}, |
| 1142 | {'y', '?', 0x1ef9}, |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 1143 | # define DG_START_GREEK_EXTENDED 0x1f00 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1144 | {';', '\'', 0x1f00}, |
| 1145 | {',', '\'', 0x1f01}, |
| 1146 | {';', '!', 0x1f02}, |
| 1147 | {',', '!', 0x1f03}, |
| 1148 | {'?', ';', 0x1f04}, |
| 1149 | {'?', ',', 0x1f05}, |
| 1150 | {'!', ':', 0x1f06}, |
| 1151 | {'?', ':', 0x1f07}, |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 1152 | # define DG_START_PUNCTUATION 0x2002 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1153 | {'1', 'N', 0x2002}, |
| 1154 | {'1', 'M', 0x2003}, |
| 1155 | {'3', 'M', 0x2004}, |
| 1156 | {'4', 'M', 0x2005}, |
| 1157 | {'6', 'M', 0x2006}, |
| 1158 | {'1', 'T', 0x2009}, |
| 1159 | {'1', 'H', 0x200a}, |
| 1160 | {'-', '1', 0x2010}, |
| 1161 | {'-', 'N', 0x2013}, |
| 1162 | {'-', 'M', 0x2014}, |
| 1163 | {'-', '3', 0x2015}, |
| 1164 | {'!', '2', 0x2016}, |
| 1165 | {'=', '2', 0x2017}, |
| 1166 | {'\'', '6', 0x2018}, |
| 1167 | {'\'', '9', 0x2019}, |
| 1168 | {'.', '9', 0x201a}, |
| 1169 | {'9', '\'', 0x201b}, |
| 1170 | {'"', '6', 0x201c}, |
| 1171 | {'"', '9', 0x201d}, |
| 1172 | {':', '9', 0x201e}, |
| 1173 | {'9', '"', 0x201f}, |
| 1174 | {'/', '-', 0x2020}, |
| 1175 | {'/', '=', 0x2021}, |
| 1176 | {'.', '.', 0x2025}, |
Bram Moolenaar | 8161551 | 2016-11-04 22:17:16 +0100 | [diff] [blame] | 1177 | {',', '.', 0x2026}, |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1178 | {'%', '0', 0x2030}, |
| 1179 | {'1', '\'', 0x2032}, |
| 1180 | {'2', '\'', 0x2033}, |
| 1181 | {'3', '\'', 0x2034}, |
| 1182 | {'1', '"', 0x2035}, |
| 1183 | {'2', '"', 0x2036}, |
| 1184 | {'3', '"', 0x2037}, |
| 1185 | {'C', 'a', 0x2038}, |
| 1186 | {'<', '1', 0x2039}, |
| 1187 | {'>', '1', 0x203a}, |
| 1188 | {':', 'X', 0x203b}, |
| 1189 | {'\'', '-', 0x203e}, |
| 1190 | {'/', 'f', 0x2044}, |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 1191 | # define DG_START_SUB_SUPER 0x2070 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1192 | {'0', 'S', 0x2070}, |
| 1193 | {'4', 'S', 0x2074}, |
| 1194 | {'5', 'S', 0x2075}, |
| 1195 | {'6', 'S', 0x2076}, |
| 1196 | {'7', 'S', 0x2077}, |
| 1197 | {'8', 'S', 0x2078}, |
| 1198 | {'9', 'S', 0x2079}, |
| 1199 | {'+', 'S', 0x207a}, |
| 1200 | {'-', 'S', 0x207b}, |
| 1201 | {'=', 'S', 0x207c}, |
| 1202 | {'(', 'S', 0x207d}, |
| 1203 | {')', 'S', 0x207e}, |
| 1204 | {'n', 'S', 0x207f}, |
| 1205 | {'0', 's', 0x2080}, |
| 1206 | {'1', 's', 0x2081}, |
| 1207 | {'2', 's', 0x2082}, |
| 1208 | {'3', 's', 0x2083}, |
| 1209 | {'4', 's', 0x2084}, |
| 1210 | {'5', 's', 0x2085}, |
| 1211 | {'6', 's', 0x2086}, |
| 1212 | {'7', 's', 0x2087}, |
| 1213 | {'8', 's', 0x2088}, |
| 1214 | {'9', 's', 0x2089}, |
| 1215 | {'+', 's', 0x208a}, |
| 1216 | {'-', 's', 0x208b}, |
| 1217 | {'=', 's', 0x208c}, |
| 1218 | {'(', 's', 0x208d}, |
| 1219 | {')', 's', 0x208e}, |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 1220 | # define DG_START_CURRENCY 0x20a4 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1221 | {'L', 'i', 0x20a4}, |
| 1222 | {'P', 't', 0x20a7}, |
| 1223 | {'W', '=', 0x20a9}, |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 1224 | {'=', 'e', 0x20ac}, // euro |
| 1225 | {'E', 'u', 0x20ac}, // euro |
| 1226 | {'=', 'R', 0x20bd}, // rouble |
| 1227 | {'=', 'P', 0x20bd}, // rouble |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 1228 | # define DG_START_OTHER1 0x2103 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1229 | {'o', 'C', 0x2103}, |
| 1230 | {'c', 'o', 0x2105}, |
| 1231 | {'o', 'F', 0x2109}, |
| 1232 | {'N', '0', 0x2116}, |
| 1233 | {'P', 'O', 0x2117}, |
| 1234 | {'R', 'x', 0x211e}, |
| 1235 | {'S', 'M', 0x2120}, |
| 1236 | {'T', 'M', 0x2122}, |
| 1237 | {'O', 'm', 0x2126}, |
| 1238 | {'A', 'O', 0x212b}, |
| 1239 | {'1', '3', 0x2153}, |
| 1240 | {'2', '3', 0x2154}, |
| 1241 | {'1', '5', 0x2155}, |
| 1242 | {'2', '5', 0x2156}, |
| 1243 | {'3', '5', 0x2157}, |
| 1244 | {'4', '5', 0x2158}, |
| 1245 | {'1', '6', 0x2159}, |
| 1246 | {'5', '6', 0x215a}, |
| 1247 | {'1', '8', 0x215b}, |
| 1248 | {'3', '8', 0x215c}, |
| 1249 | {'5', '8', 0x215d}, |
| 1250 | {'7', '8', 0x215e}, |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 1251 | # define DG_START_ROMAN 0x2160 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1252 | {'1', 'R', 0x2160}, |
| 1253 | {'2', 'R', 0x2161}, |
| 1254 | {'3', 'R', 0x2162}, |
| 1255 | {'4', 'R', 0x2163}, |
| 1256 | {'5', 'R', 0x2164}, |
| 1257 | {'6', 'R', 0x2165}, |
| 1258 | {'7', 'R', 0x2166}, |
| 1259 | {'8', 'R', 0x2167}, |
| 1260 | {'9', 'R', 0x2168}, |
| 1261 | {'a', 'R', 0x2169}, |
| 1262 | {'b', 'R', 0x216a}, |
| 1263 | {'c', 'R', 0x216b}, |
| 1264 | {'1', 'r', 0x2170}, |
| 1265 | {'2', 'r', 0x2171}, |
| 1266 | {'3', 'r', 0x2172}, |
| 1267 | {'4', 'r', 0x2173}, |
| 1268 | {'5', 'r', 0x2174}, |
| 1269 | {'6', 'r', 0x2175}, |
| 1270 | {'7', 'r', 0x2176}, |
| 1271 | {'8', 'r', 0x2177}, |
| 1272 | {'9', 'r', 0x2178}, |
| 1273 | {'a', 'r', 0x2179}, |
| 1274 | {'b', 'r', 0x217a}, |
| 1275 | {'c', 'r', 0x217b}, |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 1276 | # define DG_START_ARROWS 0x2190 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1277 | {'<', '-', 0x2190}, |
| 1278 | {'-', '!', 0x2191}, |
| 1279 | {'-', '>', 0x2192}, |
| 1280 | {'-', 'v', 0x2193}, |
| 1281 | {'<', '>', 0x2194}, |
| 1282 | {'U', 'D', 0x2195}, |
| 1283 | {'<', '=', 0x21d0}, |
| 1284 | {'=', '>', 0x21d2}, |
| 1285 | {'=', '=', 0x21d4}, |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 1286 | # define DG_START_MATH 0x2200 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1287 | {'F', 'A', 0x2200}, |
| 1288 | {'d', 'P', 0x2202}, |
| 1289 | {'T', 'E', 0x2203}, |
| 1290 | {'/', '0', 0x2205}, |
| 1291 | {'D', 'E', 0x2206}, |
| 1292 | {'N', 'B', 0x2207}, |
| 1293 | {'(', '-', 0x2208}, |
| 1294 | {'-', ')', 0x220b}, |
| 1295 | {'*', 'P', 0x220f}, |
| 1296 | {'+', 'Z', 0x2211}, |
| 1297 | {'-', '2', 0x2212}, |
| 1298 | {'-', '+', 0x2213}, |
| 1299 | {'*', '-', 0x2217}, |
| 1300 | {'O', 'b', 0x2218}, |
| 1301 | {'S', 'b', 0x2219}, |
| 1302 | {'R', 'T', 0x221a}, |
| 1303 | {'0', '(', 0x221d}, |
| 1304 | {'0', '0', 0x221e}, |
| 1305 | {'-', 'L', 0x221f}, |
| 1306 | {'-', 'V', 0x2220}, |
| 1307 | {'P', 'P', 0x2225}, |
| 1308 | {'A', 'N', 0x2227}, |
| 1309 | {'O', 'R', 0x2228}, |
| 1310 | {'(', 'U', 0x2229}, |
| 1311 | {')', 'U', 0x222a}, |
| 1312 | {'I', 'n', 0x222b}, |
| 1313 | {'D', 'I', 0x222c}, |
| 1314 | {'I', 'o', 0x222e}, |
| 1315 | {'.', ':', 0x2234}, |
| 1316 | {':', '.', 0x2235}, |
| 1317 | {':', 'R', 0x2236}, |
| 1318 | {':', ':', 0x2237}, |
| 1319 | {'?', '1', 0x223c}, |
| 1320 | {'C', 'G', 0x223e}, |
| 1321 | {'?', '-', 0x2243}, |
| 1322 | {'?', '=', 0x2245}, |
| 1323 | {'?', '2', 0x2248}, |
| 1324 | {'=', '?', 0x224c}, |
| 1325 | {'H', 'I', 0x2253}, |
| 1326 | {'!', '=', 0x2260}, |
| 1327 | {'=', '3', 0x2261}, |
| 1328 | {'=', '<', 0x2264}, |
| 1329 | {'>', '=', 0x2265}, |
| 1330 | {'<', '*', 0x226a}, |
| 1331 | {'*', '>', 0x226b}, |
| 1332 | {'!', '<', 0x226e}, |
| 1333 | {'!', '>', 0x226f}, |
| 1334 | {'(', 'C', 0x2282}, |
| 1335 | {')', 'C', 0x2283}, |
| 1336 | {'(', '_', 0x2286}, |
| 1337 | {')', '_', 0x2287}, |
| 1338 | {'0', '.', 0x2299}, |
| 1339 | {'0', '2', 0x229a}, |
| 1340 | {'-', 'T', 0x22a5}, |
| 1341 | {'.', 'P', 0x22c5}, |
| 1342 | {':', '3', 0x22ee}, |
| 1343 | {'.', '3', 0x22ef}, |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 1344 | # define DG_START_TECHNICAL 0x2302 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1345 | {'E', 'h', 0x2302}, |
| 1346 | {'<', '7', 0x2308}, |
| 1347 | {'>', '7', 0x2309}, |
| 1348 | {'7', '<', 0x230a}, |
| 1349 | {'7', '>', 0x230b}, |
| 1350 | {'N', 'I', 0x2310}, |
| 1351 | {'(', 'A', 0x2312}, |
| 1352 | {'T', 'R', 0x2315}, |
| 1353 | {'I', 'u', 0x2320}, |
| 1354 | {'I', 'l', 0x2321}, |
| 1355 | {'<', '/', 0x2329}, |
| 1356 | {'/', '>', 0x232a}, |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 1357 | # define DG_START_OTHER2 0x2423 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1358 | {'V', 's', 0x2423}, |
| 1359 | {'1', 'h', 0x2440}, |
| 1360 | {'3', 'h', 0x2441}, |
| 1361 | {'2', 'h', 0x2442}, |
| 1362 | {'4', 'h', 0x2443}, |
| 1363 | {'1', 'j', 0x2446}, |
| 1364 | {'2', 'j', 0x2447}, |
| 1365 | {'3', 'j', 0x2448}, |
| 1366 | {'4', 'j', 0x2449}, |
| 1367 | {'1', '.', 0x2488}, |
| 1368 | {'2', '.', 0x2489}, |
| 1369 | {'3', '.', 0x248a}, |
| 1370 | {'4', '.', 0x248b}, |
| 1371 | {'5', '.', 0x248c}, |
| 1372 | {'6', '.', 0x248d}, |
| 1373 | {'7', '.', 0x248e}, |
| 1374 | {'8', '.', 0x248f}, |
| 1375 | {'9', '.', 0x2490}, |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 1376 | # define DG_START_DRAWING 0x2500 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1377 | {'h', 'h', 0x2500}, |
| 1378 | {'H', 'H', 0x2501}, |
| 1379 | {'v', 'v', 0x2502}, |
| 1380 | {'V', 'V', 0x2503}, |
| 1381 | {'3', '-', 0x2504}, |
| 1382 | {'3', '_', 0x2505}, |
| 1383 | {'3', '!', 0x2506}, |
| 1384 | {'3', '/', 0x2507}, |
| 1385 | {'4', '-', 0x2508}, |
| 1386 | {'4', '_', 0x2509}, |
| 1387 | {'4', '!', 0x250a}, |
| 1388 | {'4', '/', 0x250b}, |
| 1389 | {'d', 'r', 0x250c}, |
| 1390 | {'d', 'R', 0x250d}, |
| 1391 | {'D', 'r', 0x250e}, |
| 1392 | {'D', 'R', 0x250f}, |
| 1393 | {'d', 'l', 0x2510}, |
| 1394 | {'d', 'L', 0x2511}, |
| 1395 | {'D', 'l', 0x2512}, |
| 1396 | {'L', 'D', 0x2513}, |
| 1397 | {'u', 'r', 0x2514}, |
| 1398 | {'u', 'R', 0x2515}, |
| 1399 | {'U', 'r', 0x2516}, |
| 1400 | {'U', 'R', 0x2517}, |
| 1401 | {'u', 'l', 0x2518}, |
| 1402 | {'u', 'L', 0x2519}, |
| 1403 | {'U', 'l', 0x251a}, |
| 1404 | {'U', 'L', 0x251b}, |
| 1405 | {'v', 'r', 0x251c}, |
| 1406 | {'v', 'R', 0x251d}, |
| 1407 | {'V', 'r', 0x2520}, |
| 1408 | {'V', 'R', 0x2523}, |
| 1409 | {'v', 'l', 0x2524}, |
| 1410 | {'v', 'L', 0x2525}, |
| 1411 | {'V', 'l', 0x2528}, |
| 1412 | {'V', 'L', 0x252b}, |
| 1413 | {'d', 'h', 0x252c}, |
| 1414 | {'d', 'H', 0x252f}, |
| 1415 | {'D', 'h', 0x2530}, |
| 1416 | {'D', 'H', 0x2533}, |
| 1417 | {'u', 'h', 0x2534}, |
| 1418 | {'u', 'H', 0x2537}, |
| 1419 | {'U', 'h', 0x2538}, |
| 1420 | {'U', 'H', 0x253b}, |
| 1421 | {'v', 'h', 0x253c}, |
| 1422 | {'v', 'H', 0x253f}, |
| 1423 | {'V', 'h', 0x2542}, |
| 1424 | {'V', 'H', 0x254b}, |
| 1425 | {'F', 'D', 0x2571}, |
| 1426 | {'B', 'D', 0x2572}, |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 1427 | # define DG_START_BLOCK 0x2580 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1428 | {'T', 'B', 0x2580}, |
| 1429 | {'L', 'B', 0x2584}, |
| 1430 | {'F', 'B', 0x2588}, |
| 1431 | {'l', 'B', 0x258c}, |
| 1432 | {'R', 'B', 0x2590}, |
| 1433 | {'.', 'S', 0x2591}, |
| 1434 | {':', 'S', 0x2592}, |
| 1435 | {'?', 'S', 0x2593}, |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 1436 | # define DG_START_SHAPES 0x25a0 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1437 | {'f', 'S', 0x25a0}, |
| 1438 | {'O', 'S', 0x25a1}, |
| 1439 | {'R', 'O', 0x25a2}, |
| 1440 | {'R', 'r', 0x25a3}, |
| 1441 | {'R', 'F', 0x25a4}, |
| 1442 | {'R', 'Y', 0x25a5}, |
| 1443 | {'R', 'H', 0x25a6}, |
| 1444 | {'R', 'Z', 0x25a7}, |
| 1445 | {'R', 'K', 0x25a8}, |
| 1446 | {'R', 'X', 0x25a9}, |
| 1447 | {'s', 'B', 0x25aa}, |
| 1448 | {'S', 'R', 0x25ac}, |
| 1449 | {'O', 'r', 0x25ad}, |
| 1450 | {'U', 'T', 0x25b2}, |
| 1451 | {'u', 'T', 0x25b3}, |
| 1452 | {'P', 'R', 0x25b6}, |
| 1453 | {'T', 'r', 0x25b7}, |
| 1454 | {'D', 't', 0x25bc}, |
| 1455 | {'d', 'T', 0x25bd}, |
| 1456 | {'P', 'L', 0x25c0}, |
| 1457 | {'T', 'l', 0x25c1}, |
| 1458 | {'D', 'b', 0x25c6}, |
| 1459 | {'D', 'w', 0x25c7}, |
| 1460 | {'L', 'Z', 0x25ca}, |
| 1461 | {'0', 'm', 0x25cb}, |
| 1462 | {'0', 'o', 0x25ce}, |
| 1463 | {'0', 'M', 0x25cf}, |
| 1464 | {'0', 'L', 0x25d0}, |
| 1465 | {'0', 'R', 0x25d1}, |
| 1466 | {'S', 'n', 0x25d8}, |
| 1467 | {'I', 'c', 0x25d9}, |
| 1468 | {'F', 'd', 0x25e2}, |
| 1469 | {'B', 'd', 0x25e3}, |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 1470 | # define DG_START_SYMBOLS 0x2605 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1471 | {'*', '2', 0x2605}, |
| 1472 | {'*', '1', 0x2606}, |
| 1473 | {'<', 'H', 0x261c}, |
| 1474 | {'>', 'H', 0x261e}, |
| 1475 | {'0', 'u', 0x263a}, |
| 1476 | {'0', 'U', 0x263b}, |
| 1477 | {'S', 'U', 0x263c}, |
| 1478 | {'F', 'm', 0x2640}, |
| 1479 | {'M', 'l', 0x2642}, |
| 1480 | {'c', 'S', 0x2660}, |
| 1481 | {'c', 'H', 0x2661}, |
| 1482 | {'c', 'D', 0x2662}, |
| 1483 | {'c', 'C', 0x2663}, |
| 1484 | {'M', 'd', 0x2669}, |
| 1485 | {'M', '8', 0x266a}, |
| 1486 | {'M', '2', 0x266b}, |
| 1487 | {'M', 'b', 0x266d}, |
| 1488 | {'M', 'x', 0x266e}, |
| 1489 | {'M', 'X', 0x266f}, |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 1490 | # define DG_START_DINGBATS 0x2713 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1491 | {'O', 'K', 0x2713}, |
| 1492 | {'X', 'X', 0x2717}, |
| 1493 | {'-', 'X', 0x2720}, |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 1494 | # define DG_START_CJK_SYMBOLS 0x3000 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1495 | {'I', 'S', 0x3000}, |
| 1496 | {',', '_', 0x3001}, |
| 1497 | {'.', '_', 0x3002}, |
| 1498 | {'+', '"', 0x3003}, |
| 1499 | {'+', '_', 0x3004}, |
| 1500 | {'*', '_', 0x3005}, |
| 1501 | {';', '_', 0x3006}, |
| 1502 | {'0', '_', 0x3007}, |
| 1503 | {'<', '+', 0x300a}, |
| 1504 | {'>', '+', 0x300b}, |
| 1505 | {'<', '\'', 0x300c}, |
| 1506 | {'>', '\'', 0x300d}, |
| 1507 | {'<', '"', 0x300e}, |
| 1508 | {'>', '"', 0x300f}, |
| 1509 | {'(', '"', 0x3010}, |
| 1510 | {')', '"', 0x3011}, |
| 1511 | {'=', 'T', 0x3012}, |
| 1512 | {'=', '_', 0x3013}, |
| 1513 | {'(', '\'', 0x3014}, |
| 1514 | {')', '\'', 0x3015}, |
| 1515 | {'(', 'I', 0x3016}, |
| 1516 | {')', 'I', 0x3017}, |
| 1517 | {'-', '?', 0x301c}, |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 1518 | # define DG_START_HIRAGANA 0x3041 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1519 | {'A', '5', 0x3041}, |
| 1520 | {'a', '5', 0x3042}, |
| 1521 | {'I', '5', 0x3043}, |
| 1522 | {'i', '5', 0x3044}, |
| 1523 | {'U', '5', 0x3045}, |
| 1524 | {'u', '5', 0x3046}, |
| 1525 | {'E', '5', 0x3047}, |
| 1526 | {'e', '5', 0x3048}, |
| 1527 | {'O', '5', 0x3049}, |
| 1528 | {'o', '5', 0x304a}, |
| 1529 | {'k', 'a', 0x304b}, |
| 1530 | {'g', 'a', 0x304c}, |
| 1531 | {'k', 'i', 0x304d}, |
| 1532 | {'g', 'i', 0x304e}, |
| 1533 | {'k', 'u', 0x304f}, |
| 1534 | {'g', 'u', 0x3050}, |
| 1535 | {'k', 'e', 0x3051}, |
| 1536 | {'g', 'e', 0x3052}, |
| 1537 | {'k', 'o', 0x3053}, |
| 1538 | {'g', 'o', 0x3054}, |
| 1539 | {'s', 'a', 0x3055}, |
| 1540 | {'z', 'a', 0x3056}, |
| 1541 | {'s', 'i', 0x3057}, |
| 1542 | {'z', 'i', 0x3058}, |
| 1543 | {'s', 'u', 0x3059}, |
| 1544 | {'z', 'u', 0x305a}, |
| 1545 | {'s', 'e', 0x305b}, |
| 1546 | {'z', 'e', 0x305c}, |
| 1547 | {'s', 'o', 0x305d}, |
| 1548 | {'z', 'o', 0x305e}, |
| 1549 | {'t', 'a', 0x305f}, |
| 1550 | {'d', 'a', 0x3060}, |
| 1551 | {'t', 'i', 0x3061}, |
| 1552 | {'d', 'i', 0x3062}, |
| 1553 | {'t', 'U', 0x3063}, |
| 1554 | {'t', 'u', 0x3064}, |
| 1555 | {'d', 'u', 0x3065}, |
| 1556 | {'t', 'e', 0x3066}, |
| 1557 | {'d', 'e', 0x3067}, |
| 1558 | {'t', 'o', 0x3068}, |
| 1559 | {'d', 'o', 0x3069}, |
| 1560 | {'n', 'a', 0x306a}, |
| 1561 | {'n', 'i', 0x306b}, |
| 1562 | {'n', 'u', 0x306c}, |
| 1563 | {'n', 'e', 0x306d}, |
| 1564 | {'n', 'o', 0x306e}, |
| 1565 | {'h', 'a', 0x306f}, |
| 1566 | {'b', 'a', 0x3070}, |
| 1567 | {'p', 'a', 0x3071}, |
| 1568 | {'h', 'i', 0x3072}, |
| 1569 | {'b', 'i', 0x3073}, |
| 1570 | {'p', 'i', 0x3074}, |
| 1571 | {'h', 'u', 0x3075}, |
| 1572 | {'b', 'u', 0x3076}, |
| 1573 | {'p', 'u', 0x3077}, |
| 1574 | {'h', 'e', 0x3078}, |
| 1575 | {'b', 'e', 0x3079}, |
| 1576 | {'p', 'e', 0x307a}, |
| 1577 | {'h', 'o', 0x307b}, |
| 1578 | {'b', 'o', 0x307c}, |
| 1579 | {'p', 'o', 0x307d}, |
| 1580 | {'m', 'a', 0x307e}, |
| 1581 | {'m', 'i', 0x307f}, |
| 1582 | {'m', 'u', 0x3080}, |
| 1583 | {'m', 'e', 0x3081}, |
| 1584 | {'m', 'o', 0x3082}, |
| 1585 | {'y', 'A', 0x3083}, |
| 1586 | {'y', 'a', 0x3084}, |
| 1587 | {'y', 'U', 0x3085}, |
| 1588 | {'y', 'u', 0x3086}, |
| 1589 | {'y', 'O', 0x3087}, |
| 1590 | {'y', 'o', 0x3088}, |
| 1591 | {'r', 'a', 0x3089}, |
| 1592 | {'r', 'i', 0x308a}, |
| 1593 | {'r', 'u', 0x308b}, |
| 1594 | {'r', 'e', 0x308c}, |
| 1595 | {'r', 'o', 0x308d}, |
| 1596 | {'w', 'A', 0x308e}, |
| 1597 | {'w', 'a', 0x308f}, |
| 1598 | {'w', 'i', 0x3090}, |
| 1599 | {'w', 'e', 0x3091}, |
| 1600 | {'w', 'o', 0x3092}, |
| 1601 | {'n', '5', 0x3093}, |
| 1602 | {'v', 'u', 0x3094}, |
| 1603 | {'"', '5', 0x309b}, |
| 1604 | {'0', '5', 0x309c}, |
| 1605 | {'*', '5', 0x309d}, |
| 1606 | {'+', '5', 0x309e}, |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 1607 | # define DG_START_KATAKANA 0x30a1 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1608 | {'a', '6', 0x30a1}, |
| 1609 | {'A', '6', 0x30a2}, |
| 1610 | {'i', '6', 0x30a3}, |
| 1611 | {'I', '6', 0x30a4}, |
| 1612 | {'u', '6', 0x30a5}, |
| 1613 | {'U', '6', 0x30a6}, |
| 1614 | {'e', '6', 0x30a7}, |
| 1615 | {'E', '6', 0x30a8}, |
| 1616 | {'o', '6', 0x30a9}, |
| 1617 | {'O', '6', 0x30aa}, |
| 1618 | {'K', 'a', 0x30ab}, |
| 1619 | {'G', 'a', 0x30ac}, |
| 1620 | {'K', 'i', 0x30ad}, |
| 1621 | {'G', 'i', 0x30ae}, |
| 1622 | {'K', 'u', 0x30af}, |
| 1623 | {'G', 'u', 0x30b0}, |
| 1624 | {'K', 'e', 0x30b1}, |
| 1625 | {'G', 'e', 0x30b2}, |
| 1626 | {'K', 'o', 0x30b3}, |
| 1627 | {'G', 'o', 0x30b4}, |
| 1628 | {'S', 'a', 0x30b5}, |
| 1629 | {'Z', 'a', 0x30b6}, |
| 1630 | {'S', 'i', 0x30b7}, |
| 1631 | {'Z', 'i', 0x30b8}, |
| 1632 | {'S', 'u', 0x30b9}, |
| 1633 | {'Z', 'u', 0x30ba}, |
| 1634 | {'S', 'e', 0x30bb}, |
| 1635 | {'Z', 'e', 0x30bc}, |
| 1636 | {'S', 'o', 0x30bd}, |
| 1637 | {'Z', 'o', 0x30be}, |
| 1638 | {'T', 'a', 0x30bf}, |
| 1639 | {'D', 'a', 0x30c0}, |
| 1640 | {'T', 'i', 0x30c1}, |
| 1641 | {'D', 'i', 0x30c2}, |
| 1642 | {'T', 'U', 0x30c3}, |
| 1643 | {'T', 'u', 0x30c4}, |
| 1644 | {'D', 'u', 0x30c5}, |
| 1645 | {'T', 'e', 0x30c6}, |
| 1646 | {'D', 'e', 0x30c7}, |
| 1647 | {'T', 'o', 0x30c8}, |
| 1648 | {'D', 'o', 0x30c9}, |
| 1649 | {'N', 'a', 0x30ca}, |
| 1650 | {'N', 'i', 0x30cb}, |
| 1651 | {'N', 'u', 0x30cc}, |
| 1652 | {'N', 'e', 0x30cd}, |
| 1653 | {'N', 'o', 0x30ce}, |
| 1654 | {'H', 'a', 0x30cf}, |
| 1655 | {'B', 'a', 0x30d0}, |
| 1656 | {'P', 'a', 0x30d1}, |
| 1657 | {'H', 'i', 0x30d2}, |
| 1658 | {'B', 'i', 0x30d3}, |
| 1659 | {'P', 'i', 0x30d4}, |
| 1660 | {'H', 'u', 0x30d5}, |
| 1661 | {'B', 'u', 0x30d6}, |
| 1662 | {'P', 'u', 0x30d7}, |
| 1663 | {'H', 'e', 0x30d8}, |
| 1664 | {'B', 'e', 0x30d9}, |
| 1665 | {'P', 'e', 0x30da}, |
| 1666 | {'H', 'o', 0x30db}, |
| 1667 | {'B', 'o', 0x30dc}, |
| 1668 | {'P', 'o', 0x30dd}, |
| 1669 | {'M', 'a', 0x30de}, |
| 1670 | {'M', 'i', 0x30df}, |
| 1671 | {'M', 'u', 0x30e0}, |
| 1672 | {'M', 'e', 0x30e1}, |
| 1673 | {'M', 'o', 0x30e2}, |
| 1674 | {'Y', 'A', 0x30e3}, |
| 1675 | {'Y', 'a', 0x30e4}, |
| 1676 | {'Y', 'U', 0x30e5}, |
| 1677 | {'Y', 'u', 0x30e6}, |
| 1678 | {'Y', 'O', 0x30e7}, |
| 1679 | {'Y', 'o', 0x30e8}, |
| 1680 | {'R', 'a', 0x30e9}, |
| 1681 | {'R', 'i', 0x30ea}, |
| 1682 | {'R', 'u', 0x30eb}, |
| 1683 | {'R', 'e', 0x30ec}, |
| 1684 | {'R', 'o', 0x30ed}, |
| 1685 | {'W', 'A', 0x30ee}, |
| 1686 | {'W', 'a', 0x30ef}, |
| 1687 | {'W', 'i', 0x30f0}, |
| 1688 | {'W', 'e', 0x30f1}, |
| 1689 | {'W', 'o', 0x30f2}, |
| 1690 | {'N', '6', 0x30f3}, |
| 1691 | {'V', 'u', 0x30f4}, |
| 1692 | {'K', 'A', 0x30f5}, |
| 1693 | {'K', 'E', 0x30f6}, |
| 1694 | {'V', 'a', 0x30f7}, |
| 1695 | {'V', 'i', 0x30f8}, |
| 1696 | {'V', 'e', 0x30f9}, |
| 1697 | {'V', 'o', 0x30fa}, |
| 1698 | {'.', '6', 0x30fb}, |
| 1699 | {'-', '6', 0x30fc}, |
| 1700 | {'*', '6', 0x30fd}, |
| 1701 | {'+', '6', 0x30fe}, |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 1702 | # define DG_START_BOPOMOFO 0x3105 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1703 | {'b', '4', 0x3105}, |
| 1704 | {'p', '4', 0x3106}, |
| 1705 | {'m', '4', 0x3107}, |
| 1706 | {'f', '4', 0x3108}, |
| 1707 | {'d', '4', 0x3109}, |
| 1708 | {'t', '4', 0x310a}, |
| 1709 | {'n', '4', 0x310b}, |
| 1710 | {'l', '4', 0x310c}, |
| 1711 | {'g', '4', 0x310d}, |
| 1712 | {'k', '4', 0x310e}, |
| 1713 | {'h', '4', 0x310f}, |
| 1714 | {'j', '4', 0x3110}, |
| 1715 | {'q', '4', 0x3111}, |
| 1716 | {'x', '4', 0x3112}, |
| 1717 | {'z', 'h', 0x3113}, |
| 1718 | {'c', 'h', 0x3114}, |
| 1719 | {'s', 'h', 0x3115}, |
| 1720 | {'r', '4', 0x3116}, |
| 1721 | {'z', '4', 0x3117}, |
| 1722 | {'c', '4', 0x3118}, |
| 1723 | {'s', '4', 0x3119}, |
| 1724 | {'a', '4', 0x311a}, |
| 1725 | {'o', '4', 0x311b}, |
| 1726 | {'e', '4', 0x311c}, |
| 1727 | {'a', 'i', 0x311e}, |
| 1728 | {'e', 'i', 0x311f}, |
| 1729 | {'a', 'u', 0x3120}, |
| 1730 | {'o', 'u', 0x3121}, |
| 1731 | {'a', 'n', 0x3122}, |
| 1732 | {'e', 'n', 0x3123}, |
| 1733 | {'a', 'N', 0x3124}, |
| 1734 | {'e', 'N', 0x3125}, |
| 1735 | {'e', 'r', 0x3126}, |
| 1736 | {'i', '4', 0x3127}, |
| 1737 | {'u', '4', 0x3128}, |
| 1738 | {'i', 'u', 0x3129}, |
| 1739 | {'v', '4', 0x312a}, |
| 1740 | {'n', 'G', 0x312b}, |
| 1741 | {'g', 'n', 0x312c}, |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 1742 | # define DG_START_OTHER3 0x3220 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1743 | {'1', 'c', 0x3220}, |
| 1744 | {'2', 'c', 0x3221}, |
| 1745 | {'3', 'c', 0x3222}, |
| 1746 | {'4', 'c', 0x3223}, |
| 1747 | {'5', 'c', 0x3224}, |
| 1748 | {'6', 'c', 0x3225}, |
| 1749 | {'7', 'c', 0x3226}, |
| 1750 | {'8', 'c', 0x3227}, |
| 1751 | {'9', 'c', 0x3228}, |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 1752 | // code points 0xe000 - 0xefff excluded, they have no assigned |
| 1753 | // characters, only used in proposals. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1754 | {'f', 'f', 0xfb00}, |
| 1755 | {'f', 'i', 0xfb01}, |
| 1756 | {'f', 'l', 0xfb02}, |
| 1757 | {'f', 't', 0xfb05}, |
| 1758 | {'s', 't', 0xfb06}, |
Bram Moolenaar | 5f91c0c | 2008-01-03 16:54:33 +0000 | [diff] [blame] | 1759 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1760 | {NUL, NUL, NUL} |
| 1761 | }; |
| 1762 | |
Bram Moolenaar | e3f915d | 2020-07-14 23:02:44 +0200 | [diff] [blame] | 1763 | # endif // OLD_DIGRAPHS |
| 1764 | # endif // EBCDIC |
| 1765 | #endif // !HPUX_DIGRAPHS |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1766 | |
| 1767 | /* |
| 1768 | * handle digraphs after typing a character |
| 1769 | */ |
| 1770 | int |
Bram Moolenaar | 7454a06 | 2016-01-30 15:14:10 +0100 | [diff] [blame] | 1771 | do_digraph(int c) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1772 | { |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 1773 | static int backspaced; // character before K_BS |
| 1774 | static int lastchar; // last typed character |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1775 | |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 1776 | if (c == -1) // init values |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1777 | { |
| 1778 | backspaced = -1; |
| 1779 | } |
| 1780 | else if (p_dg) |
| 1781 | { |
| 1782 | if (backspaced >= 0) |
| 1783 | c = getdigraph(backspaced, c, FALSE); |
| 1784 | backspaced = -1; |
| 1785 | if ((c == K_BS || c == Ctrl_H) && lastchar >= 0) |
| 1786 | backspaced = lastchar; |
| 1787 | } |
| 1788 | lastchar = c; |
| 1789 | return c; |
| 1790 | } |
| 1791 | |
| 1792 | /* |
Bram Moolenaar | 5f73ef8 | 2018-02-27 21:09:30 +0100 | [diff] [blame] | 1793 | * Find a digraph for "val". If found return the string to display it. |
| 1794 | * If not found return NULL. |
| 1795 | */ |
| 1796 | char_u * |
Bram Moolenaar | bc5020a | 2018-06-16 17:25:22 +0200 | [diff] [blame] | 1797 | get_digraph_for_char(int val_arg) |
Bram Moolenaar | 5f73ef8 | 2018-02-27 21:09:30 +0100 | [diff] [blame] | 1798 | { |
Bram Moolenaar | bc5020a | 2018-06-16 17:25:22 +0200 | [diff] [blame] | 1799 | int val = val_arg; |
Bram Moolenaar | 5f73ef8 | 2018-02-27 21:09:30 +0100 | [diff] [blame] | 1800 | int i; |
| 1801 | int use_defaults; |
| 1802 | digr_T *dp; |
| 1803 | static char_u r[3]; |
| 1804 | |
Bram Moolenaar | eae8ae1 | 2018-12-14 18:53:02 +0100 | [diff] [blame] | 1805 | #if defined(USE_UNICODE_DIGRAPHS) |
Bram Moolenaar | bc5020a | 2018-06-16 17:25:22 +0200 | [diff] [blame] | 1806 | if (!enc_utf8) |
| 1807 | { |
| 1808 | char_u buf[6], *to; |
| 1809 | vimconv_T vc; |
| 1810 | |
| 1811 | // convert the character from 'encoding' to Unicode |
| 1812 | i = mb_char2bytes(val, buf); |
| 1813 | vc.vc_type = CONV_NONE; |
| 1814 | if (convert_setup(&vc, p_enc, (char_u *)"utf-8") == OK) |
| 1815 | { |
| 1816 | vc.vc_fail = TRUE; |
| 1817 | to = string_convert(&vc, buf, &i); |
| 1818 | if (to != NULL) |
| 1819 | { |
| 1820 | val = utf_ptr2char(to); |
| 1821 | vim_free(to); |
| 1822 | } |
| 1823 | (void)convert_setup(&vc, NULL, NULL); |
| 1824 | } |
| 1825 | } |
| 1826 | #endif |
| 1827 | |
Bram Moolenaar | 5f73ef8 | 2018-02-27 21:09:30 +0100 | [diff] [blame] | 1828 | for (use_defaults = 0; use_defaults <= 1; use_defaults++) |
| 1829 | { |
| 1830 | if (use_defaults == 0) |
| 1831 | dp = (digr_T *)user_digraphs.ga_data; |
| 1832 | else |
| 1833 | dp = digraphdefault; |
| 1834 | for (i = 0; use_defaults ? dp->char1 != NUL |
| 1835 | : i < user_digraphs.ga_len; ++i) |
| 1836 | { |
| 1837 | if (dp->result == val) |
| 1838 | { |
| 1839 | r[0] = dp->char1; |
| 1840 | r[1] = dp->char2; |
| 1841 | r[2] = NUL; |
| 1842 | return r; |
| 1843 | } |
| 1844 | ++dp; |
| 1845 | } |
| 1846 | } |
| 1847 | return NULL; |
| 1848 | } |
| 1849 | |
| 1850 | /* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1851 | * Get a digraph. Used after typing CTRL-K on the command line or in normal |
| 1852 | * mode. |
| 1853 | * Returns composed character, or NUL when ESC was used. |
| 1854 | */ |
| 1855 | int |
Bram Moolenaar | 7454a06 | 2016-01-30 15:14:10 +0100 | [diff] [blame] | 1856 | get_digraph( |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 1857 | int cmdline) // TRUE when called from the cmdline |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1858 | { |
| 1859 | int c, cc; |
| 1860 | |
| 1861 | ++no_mapping; |
| 1862 | ++allow_keys; |
Bram Moolenaar | 61abfd1 | 2007-09-13 16:26:47 +0000 | [diff] [blame] | 1863 | c = plain_vgetc(); |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1864 | --no_mapping; |
| 1865 | --allow_keys; |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 1866 | if (c != ESC) // ESC cancels CTRL-K |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1867 | { |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 1868 | if (IS_SPECIAL(c)) // insert special key code |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1869 | return c; |
| 1870 | if (cmdline) |
| 1871 | { |
| 1872 | if (char2cells(c) == 1 |
| 1873 | #if defined(FEAT_CRYPT) || defined(FEAT_EVAL) |
| 1874 | && cmdline_star == 0 |
| 1875 | #endif |
| 1876 | ) |
| 1877 | putcmdline(c, TRUE); |
| 1878 | } |
| 1879 | #ifdef FEAT_CMDL_INFO |
| 1880 | else |
| 1881 | add_to_showcmd(c); |
| 1882 | #endif |
| 1883 | ++no_mapping; |
| 1884 | ++allow_keys; |
Bram Moolenaar | 61abfd1 | 2007-09-13 16:26:47 +0000 | [diff] [blame] | 1885 | cc = plain_vgetc(); |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1886 | --no_mapping; |
| 1887 | --allow_keys; |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 1888 | if (cc != ESC) // ESC cancels CTRL-K |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1889 | return getdigraph(c, cc, TRUE); |
| 1890 | } |
| 1891 | return NUL; |
| 1892 | } |
| 1893 | |
| 1894 | /* |
| 1895 | * Lookup the pair "char1", "char2" in the digraph tables. |
| 1896 | * If no match, return "char2". |
Bram Moolenaar | 70b2a56 | 2012-01-10 22:26:17 +0100 | [diff] [blame] | 1897 | * If "meta_char" is TRUE and "char1" is a space, return "char2" | 0x80. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1898 | */ |
| 1899 | static int |
Bram Moolenaar | 7454a06 | 2016-01-30 15:14:10 +0100 | [diff] [blame] | 1900 | getexactdigraph(int char1, int char2, int meta_char) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1901 | { |
| 1902 | int i; |
| 1903 | int retval = 0; |
| 1904 | digr_T *dp; |
| 1905 | |
| 1906 | if (IS_SPECIAL(char1) || IS_SPECIAL(char2)) |
| 1907 | return char2; |
| 1908 | |
| 1909 | /* |
| 1910 | * Search user digraphs first. |
| 1911 | */ |
| 1912 | dp = (digr_T *)user_digraphs.ga_data; |
| 1913 | for (i = 0; i < user_digraphs.ga_len; ++i) |
| 1914 | { |
| 1915 | if ((int)dp->char1 == char1 && (int)dp->char2 == char2) |
| 1916 | { |
| 1917 | retval = dp->result; |
| 1918 | break; |
| 1919 | } |
| 1920 | ++dp; |
| 1921 | } |
| 1922 | |
| 1923 | /* |
| 1924 | * Search default digraphs. |
| 1925 | */ |
| 1926 | if (retval == 0) |
| 1927 | { |
| 1928 | dp = digraphdefault; |
| 1929 | for (i = 0; dp->char1 != 0; ++i) |
| 1930 | { |
| 1931 | if ((int)dp->char1 == char1 && (int)dp->char2 == char2) |
| 1932 | { |
| 1933 | retval = dp->result; |
| 1934 | break; |
| 1935 | } |
| 1936 | ++dp; |
| 1937 | } |
| 1938 | } |
Bram Moolenaar | 1350597 | 2019-01-24 15:04:48 +0100 | [diff] [blame] | 1939 | #ifdef USE_UNICODE_DIGRAPHS |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1940 | if (retval != 0 && !enc_utf8) |
| 1941 | { |
| 1942 | char_u buf[6], *to; |
| 1943 | vimconv_T vc; |
| 1944 | |
| 1945 | /* |
| 1946 | * Convert the Unicode digraph to 'encoding'. |
| 1947 | */ |
| 1948 | i = utf_char2bytes(retval, buf); |
| 1949 | retval = 0; |
| 1950 | vc.vc_type = CONV_NONE; |
| 1951 | if (convert_setup(&vc, (char_u *)"utf-8", p_enc) == OK) |
| 1952 | { |
| 1953 | vc.vc_fail = TRUE; |
| 1954 | to = string_convert(&vc, buf, &i); |
| 1955 | if (to != NULL) |
| 1956 | { |
| 1957 | retval = (*mb_ptr2char)(to); |
| 1958 | vim_free(to); |
| 1959 | } |
| 1960 | (void)convert_setup(&vc, NULL, NULL); |
| 1961 | } |
| 1962 | } |
Bram Moolenaar | 1350597 | 2019-01-24 15:04:48 +0100 | [diff] [blame] | 1963 | #endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1964 | |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 1965 | // Ignore multi-byte characters when not in multi-byte mode. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1966 | if (!has_mbyte && retval > 0xff) |
| 1967 | retval = 0; |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1968 | |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 1969 | if (retval == 0) // digraph deleted or not found |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1970 | { |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 1971 | if (char1 == ' ' && meta_char) // <space> <char> --> meta-char |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1972 | return (char2 | 0x80); |
| 1973 | return char2; |
| 1974 | } |
| 1975 | return retval; |
| 1976 | } |
| 1977 | |
| 1978 | /* |
| 1979 | * Get digraph. |
| 1980 | * Allow for both char1-char2 and char2-char1 |
| 1981 | */ |
| 1982 | int |
Bram Moolenaar | 7454a06 | 2016-01-30 15:14:10 +0100 | [diff] [blame] | 1983 | getdigraph(int char1, int char2, int meta_char) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1984 | { |
| 1985 | int retval; |
| 1986 | |
Bram Moolenaar | 70b2a56 | 2012-01-10 22:26:17 +0100 | [diff] [blame] | 1987 | if (((retval = getexactdigraph(char1, char2, meta_char)) == char2) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1988 | && (char1 != char2) |
Bram Moolenaar | 70b2a56 | 2012-01-10 22:26:17 +0100 | [diff] [blame] | 1989 | && ((retval = getexactdigraph(char2, char1, meta_char)) == char1)) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1990 | return char2; |
| 1991 | return retval; |
| 1992 | } |
| 1993 | |
| 1994 | /* |
| 1995 | * Add the digraphs in the argument to the digraph table. |
| 1996 | * format: {c1}{c2} char {c1}{c2} char ... |
| 1997 | */ |
| 1998 | void |
Bram Moolenaar | 7454a06 | 2016-01-30 15:14:10 +0100 | [diff] [blame] | 1999 | putdigraph(char_u *str) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2000 | { |
| 2001 | int char1, char2, n; |
| 2002 | int i; |
| 2003 | digr_T *dp; |
| 2004 | |
| 2005 | while (*str != NUL) |
| 2006 | { |
| 2007 | str = skipwhite(str); |
| 2008 | if (*str == NUL) |
| 2009 | return; |
| 2010 | char1 = *str++; |
| 2011 | char2 = *str++; |
| 2012 | if (char2 == 0) |
| 2013 | { |
Bram Moolenaar | f9e3e09 | 2019-01-13 23:38:42 +0100 | [diff] [blame] | 2014 | emsg(_(e_invarg)); |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2015 | return; |
| 2016 | } |
| 2017 | if (char1 == ESC || char2 == ESC) |
| 2018 | { |
Bram Moolenaar | f9e3e09 | 2019-01-13 23:38:42 +0100 | [diff] [blame] | 2019 | emsg(_("E104: Escape not allowed in digraph")); |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2020 | return; |
| 2021 | } |
| 2022 | str = skipwhite(str); |
| 2023 | if (!VIM_ISDIGIT(*str)) |
| 2024 | { |
Bram Moolenaar | f9e3e09 | 2019-01-13 23:38:42 +0100 | [diff] [blame] | 2025 | emsg(_(e_number_exp)); |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2026 | return; |
| 2027 | } |
| 2028 | n = getdigits(&str); |
| 2029 | |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 2030 | // If the digraph already exists, replace the result. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2031 | dp = (digr_T *)user_digraphs.ga_data; |
| 2032 | for (i = 0; i < user_digraphs.ga_len; ++i) |
| 2033 | { |
| 2034 | if ((int)dp->char1 == char1 && (int)dp->char2 == char2) |
| 2035 | { |
| 2036 | dp->result = n; |
| 2037 | break; |
| 2038 | } |
| 2039 | ++dp; |
| 2040 | } |
| 2041 | |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 2042 | // Add a new digraph to the table. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2043 | if (i == user_digraphs.ga_len) |
| 2044 | { |
| 2045 | if (ga_grow(&user_digraphs, 1) == OK) |
| 2046 | { |
| 2047 | dp = (digr_T *)user_digraphs.ga_data + user_digraphs.ga_len; |
| 2048 | dp->char1 = char1; |
| 2049 | dp->char2 = char2; |
| 2050 | dp->result = n; |
| 2051 | ++user_digraphs.ga_len; |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2052 | } |
| 2053 | } |
| 2054 | } |
| 2055 | } |
| 2056 | |
Bram Moolenaar | eae8ae1 | 2018-12-14 18:53:02 +0100 | [diff] [blame] | 2057 | #if defined(USE_UNICODE_DIGRAPHS) |
| 2058 | static void |
| 2059 | digraph_header(char *msg) |
| 2060 | { |
| 2061 | if (msg_col > 0) |
| 2062 | msg_putchar('\n'); |
| 2063 | msg_outtrans_attr((char_u *)msg, HL_ATTR(HLF_CM)); |
| 2064 | msg_putchar('\n'); |
| 2065 | } |
| 2066 | #endif |
| 2067 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2068 | void |
Bram Moolenaar | eae8ae1 | 2018-12-14 18:53:02 +0100 | [diff] [blame] | 2069 | listdigraphs(int use_headers) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2070 | { |
| 2071 | int i; |
| 2072 | digr_T *dp; |
Bram Moolenaar | eae8ae1 | 2018-12-14 18:53:02 +0100 | [diff] [blame] | 2073 | result_T previous = 0; |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2074 | |
| 2075 | msg_putchar('\n'); |
| 2076 | |
| 2077 | dp = digraphdefault; |
| 2078 | for (i = 0; dp->char1 != NUL && !got_int; ++i) |
| 2079 | { |
Bram Moolenaar | eae8ae1 | 2018-12-14 18:53:02 +0100 | [diff] [blame] | 2080 | #if defined(USE_UNICODE_DIGRAPHS) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2081 | digr_T tmp; |
| 2082 | |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 2083 | // May need to convert the result to 'encoding'. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2084 | tmp.char1 = dp->char1; |
| 2085 | tmp.char2 = dp->char2; |
| 2086 | tmp.result = getexactdigraph(tmp.char1, tmp.char2, FALSE); |
| 2087 | if (tmp.result != 0 && tmp.result != tmp.char2 |
| 2088 | && (has_mbyte || tmp.result <= 255)) |
Bram Moolenaar | eae8ae1 | 2018-12-14 18:53:02 +0100 | [diff] [blame] | 2089 | printdigraph(&tmp, use_headers ? &previous : NULL); |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2090 | #else |
| 2091 | |
| 2092 | if (getexactdigraph(dp->char1, dp->char2, FALSE) == dp->result |
Bram Moolenaar | 1350597 | 2019-01-24 15:04:48 +0100 | [diff] [blame] | 2093 | && (has_mbyte || dp->result <= 255)) |
Bram Moolenaar | eae8ae1 | 2018-12-14 18:53:02 +0100 | [diff] [blame] | 2094 | printdigraph(dp, use_headers ? &previous : NULL); |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2095 | #endif |
| 2096 | ++dp; |
| 2097 | ui_breakcheck(); |
| 2098 | } |
| 2099 | |
| 2100 | dp = (digr_T *)user_digraphs.ga_data; |
| 2101 | for (i = 0; i < user_digraphs.ga_len && !got_int; ++i) |
| 2102 | { |
Bram Moolenaar | eae8ae1 | 2018-12-14 18:53:02 +0100 | [diff] [blame] | 2103 | #if defined(USE_UNICODE_DIGRAPHS) |
| 2104 | if (previous >= 0 && use_headers) |
| 2105 | digraph_header(_("Custom")); |
| 2106 | previous = -1; |
| 2107 | #endif |
| 2108 | printdigraph(dp, NULL); |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2109 | ui_breakcheck(); |
| 2110 | ++dp; |
| 2111 | } |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 2112 | must_redraw = CLEAR; // clear screen, because some digraphs may be |
| 2113 | // wrong, in which case we messed up ScreenLines |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2114 | } |
| 2115 | |
Bram Moolenaar | 5843f5f | 2019-08-20 20:13:45 +0200 | [diff] [blame] | 2116 | static struct dg_header_entry { |
Bram Moolenaar | eae8ae1 | 2018-12-14 18:53:02 +0100 | [diff] [blame] | 2117 | int dg_start; |
| 2118 | char *dg_header; |
| 2119 | } header_table[] = { |
| 2120 | {DG_START_LATIN, N_("Latin supplement")}, |
| 2121 | {DG_START_GREEK, N_("Greek and Coptic")}, |
| 2122 | {DG_START_CYRILLIC, N_("Cyrillic")}, |
| 2123 | {DG_START_HEBREW, N_("Hebrew")}, |
| 2124 | {DG_START_ARABIC, N_("Arabic")}, |
| 2125 | {DG_START_LATIN_EXTENDED, N_("Latin extended")}, |
| 2126 | {DG_START_GREEK_EXTENDED, N_("Greek extended")}, |
| 2127 | {DG_START_PUNCTUATION, N_("Punctuation")}, |
| 2128 | {DG_START_SUB_SUPER, N_("Super- and subscripts")}, |
| 2129 | {DG_START_CURRENCY, N_("Currency")}, |
| 2130 | {DG_START_OTHER1, N_("Other")}, |
| 2131 | {DG_START_ROMAN, N_("Roman numbers")}, |
| 2132 | {DG_START_ARROWS, N_("Arrows")}, |
| 2133 | {DG_START_MATH, N_("Mathematical operators")}, |
| 2134 | {DG_START_TECHNICAL, N_("Technical")}, |
| 2135 | {DG_START_OTHER2, N_("Other")}, |
| 2136 | {DG_START_DRAWING, N_("Box drawing")}, |
| 2137 | {DG_START_BLOCK, N_("Block elements")}, |
| 2138 | {DG_START_SHAPES, N_("Geometric shapes")}, |
| 2139 | {DG_START_SYMBOLS, N_("Symbols")}, |
| 2140 | {DG_START_DINGBATS, N_("Dingbats")}, |
| 2141 | {DG_START_CJK_SYMBOLS, N_("CJK symbols and punctuation")}, |
| 2142 | {DG_START_HIRAGANA, N_("Hiragana")}, |
| 2143 | {DG_START_KATAKANA, N_("Katakana")}, |
| 2144 | {DG_START_BOPOMOFO, N_("Bopomofo")}, |
| 2145 | {DG_START_OTHER3, N_("Other")}, |
| 2146 | {0xfffffff, NULL}, |
| 2147 | }; |
| 2148 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2149 | static void |
Bram Moolenaar | eae8ae1 | 2018-12-14 18:53:02 +0100 | [diff] [blame] | 2150 | printdigraph(digr_T *dp, result_T *previous) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2151 | { |
| 2152 | char_u buf[30]; |
| 2153 | char_u *p; |
| 2154 | |
| 2155 | int list_width; |
| 2156 | |
Bram Moolenaar | 1350597 | 2019-01-24 15:04:48 +0100 | [diff] [blame] | 2157 | if ((dy_flags & DY_UHEX) || has_mbyte) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2158 | list_width = 13; |
| 2159 | else |
| 2160 | list_width = 11; |
| 2161 | |
| 2162 | if (dp->result != 0) |
| 2163 | { |
Bram Moolenaar | eae8ae1 | 2018-12-14 18:53:02 +0100 | [diff] [blame] | 2164 | #if defined(USE_UNICODE_DIGRAPHS) |
| 2165 | if (previous != NULL) |
| 2166 | { |
| 2167 | int i; |
| 2168 | |
| 2169 | for (i = 0; header_table[i].dg_header != NULL; ++i) |
| 2170 | if (*previous < header_table[i].dg_start |
| 2171 | && dp->result >= header_table[i].dg_start |
| 2172 | && dp->result < header_table[i + 1].dg_start) |
| 2173 | { |
| 2174 | digraph_header(_(header_table[i].dg_header)); |
| 2175 | break; |
| 2176 | } |
| 2177 | *previous = dp->result; |
| 2178 | } |
| 2179 | #endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2180 | if (msg_col > Columns - list_width) |
| 2181 | msg_putchar('\n'); |
| 2182 | if (msg_col) |
| 2183 | while (msg_col % list_width != 0) |
| 2184 | msg_putchar(' '); |
| 2185 | |
| 2186 | p = buf; |
| 2187 | *p++ = dp->char1; |
| 2188 | *p++ = dp->char2; |
| 2189 | *p++ = ' '; |
Bram Moolenaar | eae8ae1 | 2018-12-14 18:53:02 +0100 | [diff] [blame] | 2190 | *p = NUL; |
| 2191 | msg_outtrans(buf); |
| 2192 | p = buf; |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2193 | if (has_mbyte) |
| 2194 | { |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 2195 | // add a space to draw a composing char on |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2196 | if (enc_utf8 && utf_iscomposing(dp->result)) |
| 2197 | *p++ = ' '; |
| 2198 | p += (*mb_char2bytes)(dp->result, p); |
| 2199 | } |
| 2200 | else |
Bram Moolenaar | 0ab2a88 | 2009-05-13 10:51:08 +0000 | [diff] [blame] | 2201 | *p++ = (char_u)dp->result; |
Bram Moolenaar | eae8ae1 | 2018-12-14 18:53:02 +0100 | [diff] [blame] | 2202 | *p = NUL; |
| 2203 | msg_outtrans_attr(buf, HL_ATTR(HLF_8)); |
| 2204 | p = buf; |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2205 | if (char2cells(dp->result) == 1) |
| 2206 | *p++ = ' '; |
Bram Moolenaar | 0ab2a88 | 2009-05-13 10:51:08 +0000 | [diff] [blame] | 2207 | vim_snprintf((char *)p, sizeof(buf) - (p - buf), " %3d", dp->result); |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2208 | msg_outtrans(buf); |
| 2209 | } |
| 2210 | } |
| 2211 | |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 2212 | #endif // FEAT_DIGRAPHS |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2213 | |
| 2214 | #if defined(FEAT_KEYMAP) || defined(PROTO) |
| 2215 | |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 2216 | // structure used for b_kmap_ga.ga_data |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2217 | typedef struct |
| 2218 | { |
| 2219 | char_u *from; |
| 2220 | char_u *to; |
| 2221 | } kmap_T; |
| 2222 | |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 2223 | #define KMAP_MAXLEN 20 // maximum length of "from" or "to" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2224 | |
Bram Moolenaar | f28dbce | 2016-01-29 22:03:47 +0100 | [diff] [blame] | 2225 | static void keymap_unload(void); |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2226 | |
| 2227 | /* |
Bram Moolenaar | 0ab2a88 | 2009-05-13 10:51:08 +0000 | [diff] [blame] | 2228 | * Set up key mapping tables for the 'keymap' option. |
| 2229 | * Returns NULL if OK, an error message for failure. This only needs to be |
| 2230 | * used when setting the option, not later when the value has already been |
| 2231 | * checked. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2232 | */ |
Bram Moolenaar | f9e3e09 | 2019-01-13 23:38:42 +0100 | [diff] [blame] | 2233 | char * |
Bram Moolenaar | 7454a06 | 2016-01-30 15:14:10 +0100 | [diff] [blame] | 2234 | keymap_init(void) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2235 | { |
| 2236 | curbuf->b_kmap_state &= ~KEYMAP_INIT; |
| 2237 | |
| 2238 | if (*curbuf->b_p_keymap == NUL) |
| 2239 | { |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 2240 | // Stop any active keymap and clear the table. Also remove |
| 2241 | // b:keymap_name, as no keymap is active now. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2242 | keymap_unload(); |
Bram Moolenaar | bf44417 | 2007-07-07 11:58:28 +0000 | [diff] [blame] | 2243 | do_cmdline_cmd((char_u *)"unlet! b:keymap_name"); |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2244 | } |
| 2245 | else |
| 2246 | { |
| 2247 | char_u *buf; |
Bram Moolenaar | 0ab2a88 | 2009-05-13 10:51:08 +0000 | [diff] [blame] | 2248 | size_t buflen; |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2249 | |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 2250 | // Source the keymap file. It will contain a ":loadkeymap" command |
| 2251 | // which will call ex_loadkeymap() below. |
Bram Moolenaar | 1350597 | 2019-01-24 15:04:48 +0100 | [diff] [blame] | 2252 | buflen = STRLEN(curbuf->b_p_keymap) + STRLEN(p_enc) + 14; |
Bram Moolenaar | 964b374 | 2019-05-24 18:54:09 +0200 | [diff] [blame] | 2253 | buf = alloc(buflen); |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2254 | if (buf == NULL) |
| 2255 | return e_outofmem; |
| 2256 | |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 2257 | // try finding "keymap/'keymap'_'encoding'.vim" in 'runtimepath' |
Bram Moolenaar | 0ab2a88 | 2009-05-13 10:51:08 +0000 | [diff] [blame] | 2258 | vim_snprintf((char *)buf, buflen, "keymap/%s_%s.vim", |
| 2259 | curbuf->b_p_keymap, p_enc); |
Bram Moolenaar | 7f8989d | 2016-03-12 22:11:39 +0100 | [diff] [blame] | 2260 | if (source_runtime(buf, 0) == FAIL) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2261 | { |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 2262 | // try finding "keymap/'keymap'.vim" in 'runtimepath' |
Bram Moolenaar | 0ab2a88 | 2009-05-13 10:51:08 +0000 | [diff] [blame] | 2263 | vim_snprintf((char *)buf, buflen, "keymap/%s.vim", |
| 2264 | curbuf->b_p_keymap); |
Bram Moolenaar | 7f8989d | 2016-03-12 22:11:39 +0100 | [diff] [blame] | 2265 | if (source_runtime(buf, 0) == FAIL) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2266 | { |
| 2267 | vim_free(buf); |
Bram Moolenaar | f9e3e09 | 2019-01-13 23:38:42 +0100 | [diff] [blame] | 2268 | return N_("E544: Keymap file not found"); |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2269 | } |
| 2270 | } |
| 2271 | vim_free(buf); |
| 2272 | } |
| 2273 | |
| 2274 | return NULL; |
| 2275 | } |
| 2276 | |
| 2277 | /* |
| 2278 | * ":loadkeymap" command: load the following lines as the keymap. |
| 2279 | */ |
| 2280 | void |
Bram Moolenaar | 7454a06 | 2016-01-30 15:14:10 +0100 | [diff] [blame] | 2281 | ex_loadkeymap(exarg_T *eap) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2282 | { |
| 2283 | char_u *line; |
| 2284 | char_u *p; |
| 2285 | char_u *s; |
| 2286 | kmap_T *kp; |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 2287 | #define KMAP_LLEN 200 // max length of "to" and "from" together |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2288 | char_u buf[KMAP_LLEN + 11]; |
| 2289 | int i; |
| 2290 | char_u *save_cpo = p_cpo; |
| 2291 | |
| 2292 | if (!getline_equal(eap->getline, eap->cookie, getsourceline)) |
| 2293 | { |
Bram Moolenaar | f9e3e09 | 2019-01-13 23:38:42 +0100 | [diff] [blame] | 2294 | emsg(_("E105: Using :loadkeymap not in a sourced file")); |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2295 | return; |
| 2296 | } |
| 2297 | |
| 2298 | /* |
| 2299 | * Stop any active keymap and clear the table. |
| 2300 | */ |
| 2301 | keymap_unload(); |
| 2302 | |
| 2303 | curbuf->b_kmap_state = 0; |
| 2304 | ga_init2(&curbuf->b_kmap_ga, (int)sizeof(kmap_T), 20); |
| 2305 | |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 2306 | // Set 'cpoptions' to "C" to avoid line continuation. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2307 | p_cpo = (char_u *)"C"; |
| 2308 | |
| 2309 | /* |
| 2310 | * Get each line of the sourced file, break at the end. |
| 2311 | */ |
| 2312 | for (;;) |
| 2313 | { |
Bram Moolenaar | e96a249 | 2019-06-25 04:12:16 +0200 | [diff] [blame] | 2314 | line = eap->getline(0, eap->cookie, 0, TRUE); |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2315 | if (line == NULL) |
| 2316 | break; |
| 2317 | |
| 2318 | p = skipwhite(line); |
| 2319 | if (*p != '"' && *p != NUL && ga_grow(&curbuf->b_kmap_ga, 1) == OK) |
| 2320 | { |
| 2321 | kp = (kmap_T *)curbuf->b_kmap_ga.ga_data + curbuf->b_kmap_ga.ga_len; |
| 2322 | s = skiptowhite(p); |
Bram Moolenaar | df44a27 | 2020-06-07 20:49:05 +0200 | [diff] [blame] | 2323 | kp->from = vim_strnsave(p, s - p); |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2324 | p = skipwhite(s); |
| 2325 | s = skiptowhite(p); |
Bram Moolenaar | df44a27 | 2020-06-07 20:49:05 +0200 | [diff] [blame] | 2326 | kp->to = vim_strnsave(p, s - p); |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2327 | |
| 2328 | if (kp->from == NULL || kp->to == NULL |
Bram Moolenaar | 57657d8 | 2006-04-21 22:12:41 +0000 | [diff] [blame] | 2329 | || STRLEN(kp->from) + STRLEN(kp->to) >= KMAP_LLEN |
| 2330 | || *kp->from == NUL || *kp->to == NUL) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2331 | { |
Bram Moolenaar | 57657d8 | 2006-04-21 22:12:41 +0000 | [diff] [blame] | 2332 | if (kp->to != NULL && *kp->to == NUL) |
Bram Moolenaar | f9e3e09 | 2019-01-13 23:38:42 +0100 | [diff] [blame] | 2333 | emsg(_("E791: Empty keymap entry")); |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2334 | vim_free(kp->from); |
| 2335 | vim_free(kp->to); |
| 2336 | } |
| 2337 | else |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2338 | ++curbuf->b_kmap_ga.ga_len; |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2339 | } |
| 2340 | vim_free(line); |
| 2341 | } |
| 2342 | |
| 2343 | /* |
| 2344 | * setup ":lnoremap" to map the keys |
| 2345 | */ |
| 2346 | for (i = 0; i < curbuf->b_kmap_ga.ga_len; ++i) |
| 2347 | { |
Bram Moolenaar | 555b280 | 2005-05-19 21:08:39 +0000 | [diff] [blame] | 2348 | vim_snprintf((char *)buf, sizeof(buf), "<buffer> %s %s", |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2349 | ((kmap_T *)curbuf->b_kmap_ga.ga_data)[i].from, |
| 2350 | ((kmap_T *)curbuf->b_kmap_ga.ga_data)[i].to); |
| 2351 | (void)do_map(2, buf, LANGMAP, FALSE); |
| 2352 | } |
| 2353 | |
| 2354 | p_cpo = save_cpo; |
| 2355 | |
| 2356 | curbuf->b_kmap_state |= KEYMAP_LOADED; |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2357 | status_redraw_curbuf(); |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2358 | } |
| 2359 | |
| 2360 | /* |
| 2361 | * Stop using 'keymap'. |
| 2362 | */ |
| 2363 | static void |
Bram Moolenaar | 7454a06 | 2016-01-30 15:14:10 +0100 | [diff] [blame] | 2364 | keymap_unload(void) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2365 | { |
| 2366 | char_u buf[KMAP_MAXLEN + 10]; |
| 2367 | int i; |
| 2368 | char_u *save_cpo = p_cpo; |
Bram Moolenaar | 8c8de83 | 2008-06-24 22:58:06 +0000 | [diff] [blame] | 2369 | kmap_T *kp; |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2370 | |
| 2371 | if (!(curbuf->b_kmap_state & KEYMAP_LOADED)) |
| 2372 | return; |
| 2373 | |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 2374 | // Set 'cpoptions' to "C" to avoid line continuation. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2375 | p_cpo = (char_u *)"C"; |
| 2376 | |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 2377 | // clear the ":lmap"s |
Bram Moolenaar | 8c8de83 | 2008-06-24 22:58:06 +0000 | [diff] [blame] | 2378 | kp = (kmap_T *)curbuf->b_kmap_ga.ga_data; |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2379 | for (i = 0; i < curbuf->b_kmap_ga.ga_len; ++i) |
| 2380 | { |
Bram Moolenaar | 8c8de83 | 2008-06-24 22:58:06 +0000 | [diff] [blame] | 2381 | vim_snprintf((char *)buf, sizeof(buf), "<buffer> %s", kp[i].from); |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2382 | (void)do_map(1, buf, LANGMAP, FALSE); |
| 2383 | } |
Bram Moolenaar | 5013832 | 2018-01-28 17:05:16 +0100 | [diff] [blame] | 2384 | keymap_clear(&curbuf->b_kmap_ga); |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2385 | |
| 2386 | p_cpo = save_cpo; |
| 2387 | |
| 2388 | ga_clear(&curbuf->b_kmap_ga); |
| 2389 | curbuf->b_kmap_state &= ~KEYMAP_LOADED; |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2390 | status_redraw_curbuf(); |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2391 | } |
| 2392 | |
Bram Moolenaar | 5013832 | 2018-01-28 17:05:16 +0100 | [diff] [blame] | 2393 | void |
| 2394 | keymap_clear(garray_T *kmap) |
| 2395 | { |
| 2396 | int i; |
| 2397 | kmap_T *kp = (kmap_T *)kmap->ga_data; |
| 2398 | |
| 2399 | for (i = 0; i < kmap->ga_len; ++i) |
| 2400 | { |
| 2401 | vim_free(kp[i].from); |
| 2402 | vim_free(kp[i].to); |
| 2403 | } |
| 2404 | } |
Bram Moolenaar | 5d18efe | 2019-12-01 21:11:22 +0100 | [diff] [blame] | 2405 | #endif // FEAT_KEYMAP |