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

Add redo to Undoer #3447

Closed
YgorSouza opened this issue Oct 7, 2023 · 1 comment · Fixed by #3478
Closed

Add redo to Undoer #3447

YgorSouza opened this issue Oct 7, 2023 · 1 comment · Fixed by #3478

Comments

@YgorSouza
Copy link
Contributor

Is your feature request related to a problem? Please describe.

The Undoer does not have a redo functionality, and thus neither does the TextEdit. most text boxes that have undo also have redo, and there is a TODO for it in the source code.

} if modifiers.command && !modifiers.shift => {
// TODO(emilk): redo

Describe the solution you'd like

The Undoer should push undone states to a redo stack, and have a redo() method that can be called to revert the undo() call, as well as a has_redo() method to help set the enabled/disable state for the corresponding UI button.

Describe alternatives you've considered

It might be possible to check the state of has_undo() before and after calling feed_state() or add_undo(), and push a state to a redo stack stored separately, but that seems complicated and error-prone, and this feature is needed for the TextEdit anyway, so it may as well be provided by the Undoer.

Additional context

I am willing to try to implement this feature myself, but I would like to know if there are any pitfalls I should consider, that might have prevented it from being implemented until now.

YgorSouza added a commit to YgorSouza/egui that referenced this issue Oct 7, 2023
YgorSouza added a commit to YgorSouza/egui that referenced this issue Oct 11, 2023
LoganDark added a commit to LoganDark/egui that referenced this issue Oct 17, 2023
LoganDark added a commit to LoganDark/egui that referenced this issue Oct 17, 2023
LoganDark added a commit to LoganDark/egui that referenced this issue Oct 17, 2023
LoganDark added a commit to LoganDark/egui that referenced this issue Oct 17, 2023
emilk pushed a commit that referenced this issue Nov 10, 2023
* Closes #3447
* Closes #3448

Better implementation than #3448. (by accident since I did not see that
PR)
@LoganDark
Copy link
Contributor

LoganDark commented Nov 10, 2023

any pitfalls I should consider, that might have prevented it from being implemented until now

I'm the author of the PR that just landed to close this. Seems like just laziness :)

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 a pull request may close this issue.

2 participants