You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
curses - new window methods: addchstr and addchnstr #45165
This patch add two window methods: addchstr and addchnstr and also module attribute chtype_size. Methods use addstr convention i.e. calling with/without new cursors coords is allowed.
Methods accept any buffer-object (string, array, ctypes string buffer) of length n*chtype_size.
I'm doubtful about passing strings of characters that contain characters
+ attrs. The usual convention used by the curses module is to allow
strings containing attributeless characters to display, or integers that
can include an attribute value.
Perhaps these functions can take an iterable containing either
1-character strings or integers, and assemble them into a C-level array.
BreamoreBoy commented on Sep 17, 2010
BreamoreBoymannequin
Mannequin
More actions
Doc additions haven't been included with the patches.
Bump, I just found out addchstr() is unsupported, which is unfortunate as there doesn't seem to be any other easy way to prevent line wrapping if you submit too long strings to addstr() without keeping track of the x location and/or the string length by hand.
Superseded by the complex-character API (gh-152233).
addchstr/addchnstr add nothing over addstr with a complexstr argument, which writes the cells via waddchnstr — i.e. without wrapping, covering the line-overflow use case raised here:
window.addstr([y, x,] complexstr([complexchar(ch, attr) for ...]))
The read side inchstr/inchnstr is likewise covered by in_wchstr. Closing as out of date.
Activity
wmula commentedon Jul 10, 2007
This patch add two window methods: addchstr and addchnstr and also module attribute chtype_size. Methods use addstr convention i.e. calling with/without new cursors coords is allowed.
Methods accept any buffer-object (string, array, ctypes string buffer) of length n*chtype_size.
wmula commentedon Jul 10, 2007
File Added: test_addchstr.py
akuchling commentedon Jan 19, 2008
I'm doubtful about passing strings of characters that contain characters
+ attrs. The usual convention used by the curses module is to allow
strings containing attributeless characters to display, or integers that
can include an attribute value.
Perhaps these functions can take an iterable containing either
1-character strings or integers, and assemble them into a C-level array.
BreamoreBoy commentedon Sep 17, 2010
Doc additions haven't been included with the patches.
vegard commentedon Jul 4, 2017
Bump, I just found out addchstr() is unsupported, which is unfortunate as there doesn't seem to be any other easy way to prevent line wrapping if you submit too long strings to addstr() without keeping track of the x location and/or the string length by hand.
serhiy-storchaka commentedon Jun 28, 2026
Superseded by the complex-character API (gh-152233).
addchstr/addchnstradd nothing overaddstrwith acomplexstrargument, which writes the cells viawaddchnstr— i.e. without wrapping, covering the line-overflow use case raised here:The read side
inchstr/inchnstris likewise covered byin_wchstr. Closing as out of date.