Skip to content

Unified Diff: Disable when opening the file again / Reusing editor should disable unified diff #2950

Description

@danthe1st

Suggestion

When I view a diff using the new unified diff option, don't close the file and then open the file in some way, the unfied diff is still shown.

From a fresh installation and clean workspace:

  • Enable Window > Preferences > Compare/Patch > Use Unified diff ...
  • Create a project with two files, e.g. Test.txt and Test2.txt with some difference
  • Select both and right click > Compare With > Each other

It then shows the diff between the files as intended:

Image

If I then double-click the file in the project/package explorer, I still see the editor with the diff.

When trying to open the file again, Eclipse shouldn't show me the diff any more but only the file.

Considered approaches

I could see the following possibilities of implementing this

  • When a file is opened and reused, the unified diff is cleared if possible
  • When an editor is opened using the unified diff, it is not reusing an existing editor but opening a new one and making sure that one isn't reused. When opening another editor in the unified diff, it may be a good idea to close/replace the old unified diff editor (I think there's also a preference for reusing the 2-way compare editor?)

This should be ensured when opening the file via the project/package explorer or via other ways (e.g. Ctrl+Shift+T for Java types).

Community

  • I understand suggesting an enhancement doesn't mandate anyone to implement it. Other contributors may consider this suggestion, or not, at their own convenience. The most efficient way to get it fixed is that I implement it myself and contribute it back as a good quality patch to the project.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions