Closed JRJurman closed 10 years ago
That's a bug.
Steph
Sent from my iPad
On May 6, 2014, at 5:57 PM, Jesse Jurman notifications@github.com wrote:
If I open a file that was loaded into JBrick, and then click the undo button, it clears all the text in the file.... If I save, it will actually remove all the text from the file and leave you with nothing... Is this a bug, or has this been documented anywhere?
— Reply to this email directly or view it on GitHub.
Lindsey's pseudo stacktrace:
Undo Action calls undoAction() on a JBricxTabItem which, if you follow the subclassing hierarchy, is ultimately a subclass of RTextArea which contains the undoAction() method that calls RUndoManager's canUndo() and undo() methods. RUndoManager is a subclass of Swing's UndoManager, and it calls super.undo() and it's own UpdateActions() method.
I doubt the problem is in Swing's UndoManager, so that just leaves UpdateActions. I'll poke around at it, but I wanted to document my thought process here in case anyone else takes a look.
After further thought, I think this might be an issue with how we're telling the newly opened JBricxTabItem what its text is. I'm guessing that the way we load in the text initially isn't the correct way. If we're adding the text instead of calling JTextarea(filePath) somewhere, then it'd make sense that pressing undo would remove all of the text.
I verified that just leaving in super.undo() still results in this issue, so the text is definitely being undone by JTextArea's code, but I think the reason why that's happening might be because we're initially loading the text improperly.
If I open a file that was loaded into JBrick, and then click the undo button, it clears all the text in the file.... If I save, it will actually remove all the text from the file and leave you with nothing... Is this a bug, or has this been documented anywhere?