Closed mtygesen closed 7 months ago
I think you are right the code can be removed, but it will make it so two undo events are added to the stack when a new note is added: I suggest removed the snippet in this code + changing to something like the following:
if (!newText.equals(oldText) && !isFirstEdit) {
// Text has been changed
TAPAALGUI.getCurrentTab().getUndoManager().addNewEdit(
new AnnotationTextEditCommand(this, oldText, newText)
);
updateBounds();
return true;
} else if (isFirstEdit && !newText.isBlank()) {
return true;
}
in function enableEditMode around line 200. This way we are not adding a NewAnnotionCommand + a edit annotaion command.
see addAnnotationNote(DataLayer c, Point p) {
in GuiModelManager
for where annotation is added.
The redo/undo stack should now be working correctly
Fixes NPE when creating a new annotation and trying to close it immediately.