Skip to content

Commit 5ebe0c2

Browse files
Simplify the inch() comment and drop the versionchanged note
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent aa5aa4d commit 5ebe0c2

2 files changed

Lines changed: 4 additions & 12 deletions

File tree

Doc/library/curses.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,9 +1327,6 @@ Reading window contents
13271327
not fit in a single byte, or a color pair outside the :func:`color_pair`
13281328
range; use :meth:`in_wch` for those, which returns it as a :class:`complexchar`.
13291329

1330-
.. versionchanged:: next
1331-
On a wide build, a non-ASCII character is returned as its locale-encoded byte.
1332-
13331330
.. method:: window.in_wch([y, x])
13341331

13351332
Return the complex character at the given position in the window as a

Modules/_cursesmodule.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -774,15 +774,10 @@ curses_getcchar(const cchar_t *wcval, wchar_t *wstr, attr_t *attrs, int *pair)
774774
return rtn;
775775
}
776776

777-
/* winch() is the X/Open single-byte reader: it returns only the low 8 bits of a
778-
cell's character. On a wide build that low byte is the low byte of the wide
779-
code point, which for a character representable in the locale's single-byte
780-
encoding differs from the locale byte the string readers (instr()) return --
781-
e.g. U+20AC under ISO-8859-15 yields 0xAC here but its locale byte is 0xA4.
782-
Recover the locale byte from the wide cell when the character maps to exactly
783-
one byte, preserving the attribute and color bits already in RTN. A
784-
character with no single-byte form (a combining cell, or anything multibyte
785-
in the locale) is left as winch() reported it; in_wch() reads those in full. */
777+
/* winch() returns the low 8 bits of the character's code point with no locale
778+
conversion, unlike instr(), so recover the locale byte from the wide cell
779+
when the character maps to exactly one byte, keeping the attribute and color
780+
bits in RTN. A character with no single-byte form is left to winch(). */
786781
static chtype
787782
curses_cell_locale_byte(chtype rtn, const cchar_t *cell)
788783
{

0 commit comments

Comments
 (0)