Skip to content

curses "insstr" does not handle newline properly on Mac OS #107267

Closed
@yzhanglbto

Description

@yzhanglbto

Bug report

import curses

def bug(scr):
    scr.addstr("first line\n")
    scr.addstr("second line")
    scr.refresh()
    scr.getch()
    scr.insstr(0, 5, "X\nXX")
    scr.refresh()
    scr.getch()

curses.wrapper(bug)

Using Python 3.11.3 and 3.11.4 on Apple M2 Mac (Mac OS Ventura 13.4, iTerm and Terminal.app), Python 3.10.6 on Intel Mac (Mac OS Monterey 12.6, iTerm) produce:
python_curses_bug_maxos

Python 3.11.2 on Intel Ubuntu 22.04 (in GNOME terminal) produces correct behavior. An equivalent C program using ncurses directly on the above Macs (in the same terminal) also produces correct behavior.
python_curses_correct

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-mactype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions