Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect undo behavior following a code block #826

Open
rybarczykj opened this issue Jul 17, 2020 · 1 comment
Open

Incorrect undo behavior following a code block #826

rybarczykj opened this issue Jul 17, 2020 · 1 comment

Comments

@rybarczykj
Copy link
Contributor

@rybarczykj rybarczykj commented Jul 17, 2020

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.

@thomasballinger
Copy link
Member

@thomasballinger thomasballinger commented Jul 18, 2020

Oh nice find

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.