Skip to content

Instantiate a Buffer that does not use undo and redo stacks #1465

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dgalaktionov
Copy link

I have noticed that, under the current implementation, the undo stack gets appended a copy of the whole text at every new input, which results on unacceptable memory waste for my intended application, in which I plan to edit potentially large (up to 1MB) texts, and will handle undo/redo my own way.

My change simply consists in adding a enable_undo_redo parameter on the instantiation on Buffer and PromptSession (since it always creates its own internal buffer), and using it as a flag to prevent the stacks from being populated in Buffer.undo, Buffer.redo and Buffer.save_to_undo_stack.

PromptSession was also accordingly modified in order to pass the parameter to the internal buffer it creates.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant