Closed ThexXTURBOXx closed 2 years ago
After looking through the existing issues, I noticed that #441 looks very much just like this one right here. Maybe they are related?
Adding an empty Hyperlink listener fixes the issue. Thus, the issue lies most likely in this change: https://github.com/bobbylight/RSyntaxTextArea/commit/9bc9f187b84e3fad5000970267360bf843d422bb#diff-04814d39a10acb9fcadce1be9b81a60c97ea2070b99a3af1ff6bbabc0daa2ab7R926
Better late than never! Thanks @ThexXTURBOXx ! You hit the nail on the head. That code was lazily creating the HyperlinkEvent only if there were HyperlinkListeners registered, but that caused LinkGeneratorResult
s to not be executed. It wasn't taking into account the contract that they could handle click events themselves. The fix was simply to not lazily evaluate the LinkGeneratorResult
.
Thank you very much for the update and the fix! :)
Description Using RSTA 3.0.8, hyperlinks in Luyten were working properly. However, when updating to 3.1.0 (or even 3.2.0), using the same code, they are not working correctly anymore.
Steps to Reproduce Specific steps to reproduce the behavior:
LinkGenerator
to aRSyntaxTextArea
and enable hyperlinksExpected behavior The
LinkGeneratorResult#execute
function should be executedActual behavior The
LinkGeneratorResult#execute
function is not executed in RSTA >=3.1.0Java version Tested with Java 8 and Java 17
Additional context From what I can gather using some debugging code,
RSyntaxTextArea#hoveredOverLinkOffset
gets reset to-1
when the hyperlink is clicked, probably throughRSyntaxTextArea#stopScanningForLinks
(however I am not sure!). Because of this,RSyntaxTextAreaMutableCaretEvent#mouseClicked
will not fire theACTIVATED
event. I am unsure if I am correct, but I think, this is what's going wrong there. Relevant code can be found here: https://github.com/ThexXTURBOXx/Luyten/blob/main/src/main/java/us/deathmarine/luyten/OpenFile.java#L131