Thanks to visit codestin.com
Credit goes to github.com

Skip to content

REPL doesn't handle blocks larger than the console window on some terminals #129220

Open
@encukou

Description

@encukou

Bug report

Bug description:

On Windows, if the currently edited block does not fit in the console (the lines are too long and there are too many lines), and the cursor is moved around, the REPL's state gets corrupted: lines are overwritten with parts of other lines, parts of the prompt appear in places, the cursor behaviour doesn't match the text around it.

For example, in a small console window, I pressed Up to go back in history to this piece of colorsys:

def yiq_to_rgb(y, i, q):
    # r = y + (0.27*q + 0.41*i) / (0.74*0.41 + 0.27*0.48)
    # b = y + (0.74*q - 0.48*i) / (0.74*0.41 + 0.27*0.48)
    # g = y - (0.30*(r-y) + 0.11*(b-y)) / 0.59

    r = y + 0.9468822170900693*i + 0.6235565819861433*q
    g = y - 0.27478764629897834*i - 0.6356910791873801*q
    b = y - 1.1085450346420322*i + 1.7090069284064666*q

    if r < 0.0:
        r = 0.0
    if g < 0.0:
        g = 0.0
    if b < 0.0:
        b = 0.0
    if r > 1.0:
        r = 1.0
    if g > 1.0:
        g = 1.0
    if b > 1.0:
        b = 1.0
    return (r, g, b)

and then pressed some arrow keys to get:

Image

CPython versions tested on:

CPython main branch

Operating systems tested on:

Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic-replRelated to the interactive shelltype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions