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 commented on 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 commented on Jul 10, 2007
File Added: test_addchstr.py
akuchling commented on 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 commented on Sep 17, 2010
Doc additions haven't been included with the patches.
vegard commented on 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 commented on Jun 28, 2026
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:
The read side inchstr/inchnstr is likewise covered by in_wchstr. Closing as out of date.