Skip to content

TextEditor.createNewDocument fails to check for extensions in provided filenames #78

Description

@hinerm

When using the ImageJ macro recorder’s Create button, the resulting script is named Macro.ijm.ijm instead of Macro.ijm.

The recorder supplies Macro.ijm as the document title. That title passes through imagej-legacy to TextEditor.createNewDocument(...). In createNewDocument, the editor filename is set before the language is detected. Once ImageJ Macro becomes the active language, the editor appends its .ijm extension to the already-suffixed filename.

Expected result:
Macro.ijm

Actual result:
Macro.ijm.ijm

The method should either detect the language before normalizing the filename, or avoid appending an extension when the supplied filename already ends with the language extension. A regression test around createNewDocument("Macro.ijm", ...) would be useful.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions