Auto-completion introduces new line/carriage return on item select

Dear all,

I noticed these past couple of days (I don’t know if it has been there before) that when using macro auto-completion with the script editor, whenever I select something from the available list, it will always introduce a new line.

Is this intended?
Or is it just me?

I have Fiji updated.

Cheers,
Nuno

1 Like

Hey @NPMartins,

hm, I cannot reproduce what you describe:
auto-complete

But it sounds like a charset related issue we recently received:

Would you mind sharing details on your Fiji version, operating system and language settings?

Thanks!

Cheers,
Robert

1 Like

Hey Robert,

Sure.
Windows 10 Home 64-bit, version 1903, OS Build 18362.418
ImageJ 1.52 with Java 1.8.0_172

I did some quick testing and with a clean install it does not happen.

When I add Clij (which I had installed when I noticed it), the issue shows up again.
Don’t know if it is really due to this or not.

I will try recording the screen later to show what happens.

Cheers,
Nuno

2 Likes

Ok, I tried exactly this:

  • Download Fiji
  • Update it (with converting all URLs to https) - it was up to date
  • Restart Fiji
  • Activated/installed clij update site
  • Restart Fiji

And can still not reproduce the problem.

I use (Fiji is Just) ImageJ 2.0.0-rc-60/1.52p; Java 1.8.0_172 [64 bit] on Windows 10 build 18362…

1 Like

Sorry for the late reply guys, but here is a small gif of the behavior which seems to be inconsistent.
If I autocomplete “run(…” commands, it seems to not do it, but with others it does.

Cheers,
Nuno

2 Likes

Hi @NPMartins and @haesleinhuepf,

I can confirm the same behaviour in my install. Indeed, the new-line-after-completition behavior seems to happen only in some cases:

  • All [one-word] built-in functions (pulled straight from functions.html), e.g. getPixel(x,y), etc.
  • All extended versions of built-in functions and snippets (i.e. everything coming from functions_extd.html) e.g. break, for (i = 0; i < 10; i++) {, etc

but not in others:

  • Built-in functions that belong to a “domain name”: Array. , Dialog. , String. , Table. , etc. (Including Ext. commands like Ext.CLIJ_xxxx)
  • User defined functions (including additional/external ones)
  • User defined variables
  • Menu commands (all the run("Some random command") stuff)

I think I managed to trace this difference to this single line:

Which should read:

			.replace("<br>", "");

As there’s currently an open PR on this same component, I’d like to have @haesleinhuepf’s opinion on this. What’s the best way to proceed? Should I open a separate issue?

Thanks,

Cheers!
Nico

1 Like

This was really helpful and I was having that impression but could not find a reasonable explanation to it besides the [one-word] built-in functions.

Thanks a bunch for looking into it!

Cheers,
Nuno

Hey @NicoDF,

have you tried this? I’d be afraid that auto-completing code snippets such as this one wouldn’t work anymore:

Before you suggest a PR, I would ask you to try that.

Please file it as a separate issue as it is a separate issue :wink:

Thaaaanks for your support to you both @NicoDF and @NPMartins ! I’m a bit busy these days - thanks for your patience regarding merges. =-)

Cheers,
Robert

1 Like

Hi @haesleinhuepf!

I did some preliminary testing, but I clearly missed this case (and the whole point of keeping <br> to allow for multiline autocompletions :blush: ).

I should have better started off by laying out a clear diagnosis: the problem stems from the fact that a large amount of function entries in the html file follow this structure:

<b>someFunctions(params)</b><br>.

That last <br> is the one showing up after inserting the suggestion, thanks to the line that I pointed out. Now, by looking at the git blame, I realize this recent line was there for a very specific reason: multine snippets. :laughing:

So I guess it’s simply going back to my first gut instinct to fix this problem: to trim any trailing \n in the text before creating the completion entry.

That’s what I thought. Issue filed. :+1:

No worries! Thanks to you!

Cheers!
Nico