Skip to content

A combining mark in a Textbox's last cell loses the base character #157210

Open

Description

@fedonman

Bug description:

Typing a combining mark into the lower-right cell of a curses.textpad.Textbox puts the mark in a cell of its own and pushes the character it should attach to off the window edge, so that character is lost. The same keystrokes one column earlier attach the mark correctly. Doc/library/curses.rst says of Textbox that "Entering and reading back the full Unicode range, including combining characters, is now supported when curses is built with wide-character support".

import curses, sys
from curses.textpad import Textbox

def typed(ncols):
    win = curses.newwin(1, ncols, 0, 0)
    box = Textbox(win)
    for ch in 'abe\u0301':      # COMBINING ACUTE ACCENT after the 'e'
        box.do_command(ch)
    return win.instr(0, 0, 40).decode()

out = curses.wrapper(lambda stdscr: (typed(3), typed(10)))
print('3 columns:  %a\n10 columns: %a' % out, file=sys.stderr)

Output:

3 columns:  'ab\u0301'
10 columns: 'abe\u0301       '

Expected 'abe\u0301' from both windows: the mark should join the e instead of taking its cell.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    stdlibStandard Library Python modules in the Lib/ directory
    on Sep 9, 2026
  2. added a commit that references this issue on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytopic-cursestype-bugAn unexpected behavior, bug, or error

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions