Commit 8a01d28
Add the immutable `curses.complexchar` type: a styled wide-character cell — a spacing character optionally followed by combining characters, plus attributes and a color pair. The color pair is stored separately rather than packed into a `chtype` via `COLOR_PAIR()`, so it is not limited to the values that fit alongside the attribute bits. `str(cc)` returns the text; the read-only `attr` and `pair` attributes return its rendition.
Add the window methods `in_wch()` and `getbkgrnd()` — the wide-character counterparts of `inch()` and `getbkgd()` — which return a `complexchar`. (`inch()`/`getbkgd()` can only return a packed `chtype`, so these fill a real gap; this resolves the long-standing gh-83395 request for `in_wch`.)
The existing character-cell methods (`addch`, `insch`, `echochar`, `bkgd`, `bkgdset`, `border`, `box`, `hline`, `vline`) now also accept a `complexchar`. A `complexchar` already carries its own rendition, so passing one together with an explicit `attr` argument raises `TypeError`.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 285d96d commit 8a01d28
10 files changed
Lines changed: 968 additions & 150 deletions
File tree
- Doc
- library
- whatsnew
- Include/internal
- Lib/test
- Misc/NEWS.d/next/Library
- Modules
- clinic
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
941 | 941 | | |
942 | 942 | | |
943 | 943 | | |
944 | | - | |
| 944 | + | |
| 945 | + | |
945 | 946 | | |
946 | 947 | | |
947 | 948 | | |
| |||
1051 | 1052 | | |
1052 | 1053 | | |
1053 | 1054 | | |
1054 | | - | |
| 1055 | + | |
| 1056 | + | |
1055 | 1057 | | |
1056 | 1058 | | |
1057 | 1059 | | |
| |||
1064 | 1066 | | |
1065 | 1067 | | |
1066 | 1068 | | |
1067 | | - | |
| 1069 | + | |
| 1070 | + | |
1068 | 1071 | | |
1069 | 1072 | | |
1070 | 1073 | | |
| |||
1100 | 1103 | | |
1101 | 1104 | | |
1102 | 1105 | | |
1103 | | - | |
| 1106 | + | |
| 1107 | + | |
1104 | 1108 | | |
1105 | 1109 | | |
1106 | 1110 | | |
| |||
1110 | 1114 | | |
1111 | 1115 | | |
1112 | 1116 | | |
1113 | | - | |
| 1117 | + | |
| 1118 | + | |
1114 | 1119 | | |
1115 | 1120 | | |
1116 | 1121 | | |
| |||
1182 | 1187 | | |
1183 | 1188 | | |
1184 | 1189 | | |
1185 | | - | |
| 1190 | + | |
| 1191 | + | |
1186 | 1192 | | |
1187 | 1193 | | |
1188 | 1194 | | |
| |||
1221 | 1227 | | |
1222 | 1228 | | |
1223 | 1229 | | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
1224 | 1244 | | |
1225 | 1245 | | |
1226 | 1246 | | |
| |||
1325 | 1345 | | |
1326 | 1346 | | |
1327 | 1347 | | |
1328 | | - | |
| 1348 | + | |
| 1349 | + | |
1329 | 1350 | | |
1330 | 1351 | | |
1331 | 1352 | | |
| |||
1356 | 1377 | | |
1357 | 1378 | | |
1358 | 1379 | | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
1359 | 1394 | | |
1360 | 1395 | | |
1361 | 1396 | | |
| |||
1365 | 1400 | | |
1366 | 1401 | | |
1367 | 1402 | | |
1368 | | - | |
| 1403 | + | |
| 1404 | + | |
1369 | 1405 | | |
1370 | 1406 | | |
1371 | 1407 | | |
| |||
1776 | 1812 | | |
1777 | 1813 | | |
1778 | 1814 | | |
1779 | | - | |
| 1815 | + | |
| 1816 | + | |
1780 | 1817 | | |
1781 | 1818 | | |
1782 | 1819 | | |
| |||
1833 | 1870 | | |
1834 | 1871 | | |
1835 | 1872 | | |
| 1873 | + | |
| 1874 | + | |
| 1875 | + | |
| 1876 | + | |
| 1877 | + | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
| 1883 | + | |
| 1884 | + | |
| 1885 | + | |
| 1886 | + | |
| 1887 | + | |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
| 1891 | + | |
| 1892 | + | |
| 1893 | + | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
1836 | 1916 | | |
1837 | 1917 | | |
1838 | 1918 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
141 | 151 | | |
142 | 152 | | |
143 | 153 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
| 323 | + | |
323 | 324 | | |
324 | 325 | | |
325 | 326 | | |
| |||
702 | 703 | | |
703 | 704 | | |
704 | 705 | | |
| 706 | + | |
705 | 707 | | |
706 | 708 | | |
707 | 709 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
345 | 345 | | |
346 | 346 | | |
347 | 347 | | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
348 | 378 | | |
349 | 379 | | |
350 | 380 | | |
| |||
355 | 385 | | |
356 | 386 | | |
357 | 387 | | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
358 | 472 | | |
359 | 473 | | |
360 | 474 | | |
| |||
0 commit comments