Skip to content

Incorrect undo behavior following a code block #826

Open
@rybarczykj

Description

@rybarczykj

If i type this into bpython:
>>> for i in range(10):
... print(i)
And then do a rewind/undo after it prints the numbers 0-9, it removes only the 9. Pressing undo again undoes the rest.

I'm pretty sure this is due to the trailing blank lines in the buffer. So in curtsiesfrontend/repl.py, prompt_undo() sees the last input line as blank (self.history) even though the last output line (self.display_lines) is not blank. So it calls take_back_empty_line().

The trailing blank lines are definitely nice, so I think the goal behavior here is to undo the print and take you back to the buffer.

I might be able to fix this with the PR I'm working on right now, but I'm not exactly sure how yet, so I wanted to document it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions