-
Notifications
You must be signed in to change notification settings - Fork 236
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
caret and anchor stale after selectRange with listeners #874
Comments
In my production code i have both the caret and anchor positions as 0, 0 after calling |
I've had a look and it appears that this happens when a listener is added to the val dontCare = Bindings.createStringBinding
(
() -> "binded", underTest.caretPositionProperty()
); Will look further into this ..... |
Thanks @Jugen , I can confirm this fixes the SSCCE and my problem in production. Any idea when this will make it into maven? thanks again for the fix! |
I published to maven on Wed so hopefully today or tomorrow .... |
@Jugen Unfortunatly while this now makes it through our tests we discovered the problem is better but still bad in production. Is it possible the same or a similar problem is happening to the anchor position? |
Umm, did you maybe mean caret position and not anchor position ? |
@Jugen No I did mean anchor position. The caret appears to be working correctly. Firstly: the use case is to have a richTextFX text area, with a couple of labels bound to metadata about that text areas selection --a pretty common thing if you look at gedit or notepad++. I've found that if I leave my selection-listeners on the text area it changes the behaviour of the text area. Text selection with the mouse becomes stunted and heavily prone to artificially moving the caret to the end of the document or the anchor to the beginning of the document. This is what lead to the original report. Since your fix the behaviour got better but it is not corrected. If I leave my selection-listeners on the text area, I still find it selecting the wrong ranges frequently. I have tried to get this down to an SSCCE but have had difficulty. But I have found a workaround: rather than bind to the I still need to do some work here, I'll let you know when I've got something reasonably actionable for you, but this one is tricky to run down. probably what an "SSCCE" is going to look like is a live UI with some console output, and then a statement that "this console output should not be here". |
If you attempt to use
selectRange
to update caret and anchor positions that have attached listeners, the caret and anchor potitions will be stale.The text was updated successfully, but these errors were encountered: