gh-152233: Add curses complexchar type and wide-character cell reads#152250
Open
serhiy-storchaka wants to merge 2 commits into
Open
gh-152233: Add curses complexchar type and wide-character cell reads#152250serhiy-storchaka wants to merge 2 commits into
serhiy-storchaka wants to merge 2 commits into
Conversation
Documentation build overview
|
04b9e7a to
d466257
Compare
…reads 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 stored separately from the packed chtype). Add the window methods in_wch() and getbkgrnd(), the wide-character counterparts of inch() and getbkgd(), which return a complexchar. The character-cell methods (addch, insch, echochar, bkgd, bkgdset, border, box, hline, vline) now also accept a complexchar; combining one with an explicit attr argument raises TypeError. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
d466257 to
2af5076
Compare
The complexchar constructor accepts attr and pair as argument keywords, whose interned string identifiers were missing from the generated global-object tables. Regenerate them so the module builds. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add the immutable
curses.complexchartype: 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 achtypeviaCOLOR_PAIR(), so it is not limited to the values that fit alongside the attribute bits.str(cc)returns the text; the read-onlyattrandpairattributes return its rendition.Add the window methods
in_wch()andgetbkgrnd()— the wide-character counterparts ofinch()andgetbkgd()— which return acomplexchar. (inch()/getbkgd()can only return a packedchtype, so these fill a real gap; this resolves the long-standing gh-83395 request forin_wch.)The existing character-cell methods (
addch,insch,echochar,bkgd,bkgdset,border,box,hline,vline) now also accept acomplexchar. Acomplexcharalready carries its own rendition, so passing one together with an explicitattrargument raisesTypeError.Only the reads get a dedicated wide method: a read returns a
complexcharinstead of a packedchtype, which is a genuine behavioural difference (mirroringgetch()/get_wch()). Writes do not differ, so rather than adding paralleladd_wch/ins_wch/… methods, the existing writers simply accept acomplexchar.This is the first of two changes for the cchar_t API (gh-152233); a follow-up adds the
complexstrcell-array type and the array read/write methods.