You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You will notice the caret positioning itself in the beginning of the second line of the non-arabic pane after undoing all arabic pane changes. However this is counter intuitive and can make users confused when the add text again after undoing.
Focus should be always in the panel where we are undoing.
This can probably be fixed by explicitly putting the focus in the correct panel in the override undo() method of AtfAreaController.
The text was updated successfully, but these errors were encountered:
Ok, this is extremely tricky. I'm going to report here some of my attempts so far in case I come up with the same ideas in the coming days.
It's not clear to me who sets the position of the caret when undoing: AtfAreaController.undo() doesn't do much apart from calling self.undo_manager.undo(). The call to self.syntax_highlight() is not the culprit, I just removed it in my tests but I am still able to reproduce the issue. Apparently the position of the caret is controlled by swing.
Helped by Anastasis, I wrote this class, mostly for debugging:
classNewEdit(CompoundEdit):
# override protected method with this weird secret thingdeflastEdit(self):
returnself.super__lastEdit()
# add a getter for a protected fielddefgetEdits(self):
field=CompoundEdit.getDeclaredField("edits")
field.setAccessible(True)
returnfield.get(self)
deffirstEdit(self):
returnself.getEdits()[0]
The firstEdit should give us the first edit of the compound, so hopefully the first edit to be undone. The idea was that by calling this method in AtfAreaController.undo() we can get information about what is the StyledDocument where the next edit to be undone is, and perhaps the position of the edit in order to move the caret there. However, calling this method in AtfAreaController.undo() shows that this is always the same edit until the undo stack is cleared.
Replicate:
You will notice the caret positioning itself in the beginning of the second line of the non-arabic pane after undoing all arabic pane changes. However this is counter intuitive and can make users confused when the add text again after undoing.
Focus should be always in the panel where we are undoing.
This can probably be fixed by explicitly putting the focus in the correct panel in the override
undo()
method of AtfAreaController.The text was updated successfully, but these errors were encountered: