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

Issue with text window #44

Open
LauLauThom opened this issue Dec 7, 2020 · 6 comments
Open

Issue with text window #44

LauLauThom opened this issue Dec 7, 2020 · 6 comments

Comments

@LauLauThom
Copy link

LauLauThom commented Dec 7, 2020

Hi all,
very nice project, I just noticed a minor issue with the text window used to open macro/scripts.
I could not type any text in a new text window open by the menu File > New > Text Window.

Opening a local macro file works though, and editing the code of the newly open file is also possible.
However the window shows 2 vertical scroll bar, and it seems like the text panel is displayed twice (once per scrollbar).
Indeed, one of the scrollbar move the background text which can be seen at the bottom, see below.

The original macro code is from https://raw.githubusercontent.com/LauLauThom/ObjectDetectionExamples-ImageJ.JS/main/LocalMinimaEmbryos.ijm

image

Tested on windows with google chrome 87.0.4280.88 and microsoft edge 87.0.664.55 (the last version relying on chromium)

@oeway
Copy link
Contributor

oeway commented Dec 7, 2020

Thank you @LauLauThom

We will need to fix this by using another syntax highlighting library, one of the candidate is prism.

Please expect some delay on this issue, but I have started testing.

@oeway
Copy link
Contributor

oeway commented Dec 7, 2020

I started this branch a while ago, the goal is to use prism-live to replace codemirror.

@gywgithub could you take a look at this issue?

@gywgithub
Copy link
Collaborator

@LauLauThom The problem fixed. #46 (comment)

@oeway
Copy link
Contributor

oeway commented Dec 15, 2020

I made a new code editor here: https://ij.imjoy.io/?plugin=https://gist.github.com/oeway/9c78d23c101f468e723888d05b6fac6d#
Screenshot 2020-12-15 at 22 55 4

Our previous solution was to use js/css/html to patch the generated code editor, it's really painful to work. Despite a lot of efforts being made, the code editor is till buggy.

Now I think we can just go for an ImJoy plugin based editor and if that works we can replace the java implementation entirely.

@mutterer @LauLauThom @gywgithub Could you please test it and let me know what you think? If you click the above link, after loaded, you can go to the imjoy icon and choose the "ImageJScriptEditor" option. We can add it into the ImageJ plugin menu later.

@LauLauThom
Copy link
Author

@gywgithub thanks for fixing the issue with the original text editor !

@oeway I did some quick testing of the new editor, I like it especially with the line numbering and black background.
It also worked as expected with my testing. It's just missing a File > New menu to create a new script (or did I miss it ?).

I think replacing the original code editor is ok, Fiji is also doing it right ?
Just make sure to keep the TextWindow class, which is used by this original code editor but also the results tables and macro recorder windows if I'm not mistaking.

@oeway
Copy link
Contributor

oeway commented Dec 18, 2020

@LauLauThom Thanks for testing. Thanks for pointing out, I just added the New menu as suggested.

For replacing the code editor, more work need to be done, because the new editor is completely different from the java implementation, it's actually an ImJoy plugin calls the api of imagej. So replacing it means we will need to expose more api from imagej, for example to be able to support the imagej debugger ( @mutterer reminded me that many users would like use that).

Therefore, I think a short term solution is to just add this editor to the imagej menu as an additional option, while keeping the original one. We can use it as the default editor for loading a macro from an URL for example, perhaps also add a menu item for "Open in the imagej code editor".

Any better suggestion are welcome!

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

No branches or pull requests

3 participants