-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Fix ctrl z textfield #11421
Fix ctrl z textfield #11421
Conversation
This was working until recently. I wonder what happend to it. I would suggest adding a text field to the reproducer and try it out |
ctrl + y still produces exception when I play around with multiple crtl+z and ctrl+y in comment field
|
This is not the original issue. The original issue is an NPE. - I will look into that nevertheless. Update: The thing triggered according to the exception is a menu item; not through the text field. |
Nice find! Was because of my OO refactoring. I did not copy the full branch for |
Follow up:
|
Please do not verschlimmbesser the undoredo stuff anymore. Small refactorings ok, but the whole concept of undo/redo has to be redone. |
Aim for this PR: Get it working for users. Do as less changes as possible. Keep changes local. If new code is required, add clean code. Do not add hacky code. -- Therefore, I needed to make |
You can probably remove the now abstract undoredo class anyway and make the undo and the redo class directly extend simplecommand. |
Done in |
Discussed with @calixtus: Very hard. -- I also tried it locally, but the dependency of tab -> undomanger -> canUndo drives me crazy. I was searching for |
I checked in this branch. Works. |
@LoayGhreeb I reply to your comment #11420 (comment) here to be able to track the progress w.r.t. to the code commits. (The commits and the comments are sorted by time in a pull request. Thus, one sees, whether a comment was made before a commit or after one).
This is good 😅
I tested it with the latst commit here. Works.
Works here without exception. Maybe, you can re-check? 😅 |
The build for this PR is no longer available. Please visit https://builds.jabref.org/main/ for the latest build. |
I tried it, and it works without exceptions. However, can we do some checks before doing the undo/redo to see if the change is related to the focused field and selected entry or not? |
Why? I was thinking that there should be one line of redo/undo changes and not some local textfield ones and some "global" ones not realted to the textfield ones? I think, the behavior of the last release was that an undo of a text field (JavaFX behavior) was recorded as new change event in JabRef's global undo/redo. And then pressing undo from the menu lead to strange effects. Now, there is only one global undo/redo chain. For sure, if one changes a text field, does somewhere else somethings, than goes back to the text field, types a letter, presses ctrl+Z twice, then the "somethings" are undone.
This is the effect of a single global undo/redo stack. Alternatively, we could "jump" in the undo chain and search for the last action regarding the text field and undo/redo that. -- I would stay back from using JavaFX textfield's local undo/redo (put aside for now that there is an NPE and we are in the need of fix JavaFX again). |
I'm okay with the current approach. |
private final EventBus eventBus = new EventBus(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😍
This can be resolved maybe by making undo actions in an event stream mergeable. So related edits (like entering a character) can be merged to larger undoables und be undone and redone as a compund (like now) |
In addition, I meant:
Loay expects F1 being empty. Current behavior: F1 contains a and F2 contains nothing. |
i see. |
OK, Loay is asking for "Objektbezogenes Undo". The text there does not fully explain how it works with hierarchical objects. It also does not link real-world examples (which makes it a "pattern candidate") |
We need to craft this. As you outlined. - But maybe we should only append if it is the same operation: add / delete. Replace should be in a new thing. Meaning:
|
Fixes #11420
However, this is a hard one. Do we need to implement undo/redo for textfields for ourselves?
Mandatory checks
CHANGELOG.md
described in a way that is understandable for the average user (if applicable)