Skip to content
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

Hyperlink bounds do not take folded code into account #52

Closed
helospark opened this issue Oct 19, 2018 · 1 comment
Closed

Hyperlink bounds do not take folded code into account #52

helospark opened this issue Oct 19, 2018 · 1 comment
Assignees
Labels
Milestone

Comments

@helospark
Copy link

Background

Eclipse allow folding (collapsing) of code, often license headers are collapsed, however when some code is collapsed in the decompiler file editor which contains a link, the links bound do not change so clicking outside of collapsed region and seemingly not on a link opens the link.

See image for details (clicking in the cursor position on the image causes link to open):

eclipse_hyperlink_problem

This tend to get annoying especially when the license header is large in which case the link's position get into the actual decompiled code (ex. double clicking on the classname opens the license of the library twice instead of selecting the classname, if the license header is such size).

Cause

The problem is in JavaDecompilerClassFileEditor:

  • text.getCaretOffset( ) is used to get the current position of the caret on mouseUp event. This returns offset excluding collapsed region
  • This is checked if in bounds of links[j].getHyperlinkRegion( ).getOffset( );, this returns position including the collapsed regions

Solution

They must both either include or exclude collapsed region.

@RobertZenz RobertZenz added the bug label Oct 19, 2018
@RobertZenz RobertZenz added this to the 3.2 milestone Oct 19, 2018
@RobertZenz RobertZenz self-assigned this Oct 19, 2018
@RobertZenz RobertZenz modified the milestones: 3.2, 3.1.1 Nov 6, 2018
@RobertZenz
Copy link
Collaborator

Looks good to me as far as I can tell. Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants