Skip to content

curses - new window methods: addchstr and addchnstr #45165

Closed

Description

@wmula
mannequin
BPO 1751519
Nosy @serhiy-storchaka
Files
  • _cursesmodule.diff: patch
  • test_addchstr.py: simple addchstr test
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/serhiy-storchaka'
    closed_at = None
    created_at = <Date 2007-07-10.22:48:41.000>
    labels = ['extension-modules', 'type-feature', '3.7']
    title = 'curses - new window methods: addchstr and addchnstr'
    updated_at = <Date 2017-11-01.18:52:54.580>
    user = 'https://bugs.python.org/wmula'

    bugs.python.org fields:

    activity = <Date 2017-11-01.18:52:54.580>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = False
    closed_date = None
    closer = None
    components = ['Extension Modules']
    creation = <Date 2007-07-10.22:48:41.000>
    creator = 'wmula'
    dependencies = []
    files = ['8077', '8078']
    hgrepos = []
    issue_num = 1751519
    keywords = ['patch']
    message_count = 5.0
    messages = ['52824', '52825', '60240', '116703', '297631']
    nosy_count = 3.0
    nosy_names = ['wmula', 'serhiy.storchaka', 'vegard']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue1751519'
    versions = ['Python 3.7']

    Activity

    1. wmula commented on Jul 10, 2007

      wmulamannequin
      MannequinAuthor

      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.

    2. wmula commented on Jul 10, 2007

      wmulamannequin
      MannequinAuthor

      File Added: test_addchstr.py

    3. akuchling commented on Jan 19, 2008

      @akuchling
      Contributor

      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.

    4. BreamoreBoy commented on Sep 17, 2010

      BreamoreBoymannequin
      Mannequin

      Doc additions haven't been included with the patches.

    5. vegard commented on Jul 4, 2017

      vegardmannequin
      Mannequin

      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.

    6. transferred this issue fromon Apr 10, 2022
    7. serhiy-storchaka commented on Jun 28, 2026

      @serhiy-storchaka
      Member

      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.

    8. moved this from Features to Done in Curses issueson Jun 28, 2026
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Labels

    extension-modulesC modules in the Modules dirtype-featureA feature request or enhancement

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions