Skip to content

Hyperlink bounds do not take folded code into account #52

Closed

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.

Activity

  1. added this to the 3.2 milestone on Oct 19, 2018
  2. self-assigned this
    on Oct 19, 2018
  3. modified the milestones: 3.2, 3.1.1 on Nov 6, 2018
  4. RobertZenz commented on Nov 6, 2018

    @RobertZenz
    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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions