Skip to content

Hyperlink bounds do not take folded code into account #52

@helospark

Description

@helospark

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.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions