Nasller / CodeGlancePro

Minimap run on jetbrains platform.
Apache License 2.0
201 stars 22 forks source link

[BUG] Stretched / very low resolution map in some files #123

Closed mumbleskates closed 6 months ago

mumbleskates commented 6 months ago
  1. Which Glance version and IDEA version?

Latest stable IDEA & latest rustrover. codeglance pro 1.8.0 and 1.8.1 at least.

  1. Could you show Glance config picture and minimap picture?

Bug: image image

Settings: image

  1. What steps will reproduce the issue?

This bug commonly seems to appear in consistently in certain files, usually files with more lines. It happens across multiple machines and jetbrains IDEs.

When the bug is occurring, the codemap may render correctly for a moment when the file is first opened, or when codeglance is toggled. When the editor is next focused it will switch back to the stretched, broken appearance. Sometimes while typing the minimap will flicker between several different "resolutions", smearing the minimap's pixels across smaller or larger heights.

Nasller commented 6 months ago

Please provide the complete settings page and the file type where the problem occurs. It would be better to provide the corresponding text.

mumbleskates commented 6 months ago

Sorry, the settings page was indeed cut off on the top line. Setting is 3 pixels per line, editor size proportional, alignment right, and render style accurate. When render style and pixels per line are changed the bug still occurs. "Experimental: Use FastMinimap For Main Editor" does not prevent the bug in either setting. Disabling markers render, markup highlight, filter markup highlight, syntax highlight, and vcs highlight does not prevent the bug.

Screenshot from 2024-02-23 14-06-09

File types vary. I have had this happen for source files in Rust, C++, and golang. The files it happens on are typically more than 2,000 lines long, sometimes 15,000+. One example of a file that has the problem when I view it is this one; on the laptop that has the problem with this file, the minimap works perfectly until the editor has finished coloring the syntax on startup. As soon as all symbols are colored, the minimap becomes broken and stays that way.

mumbleskates commented 6 months ago

This reproduces very reliably on at least one of my machines, and if there's something I can do to get more debugging info for you I'd be happy to help.

Nasller commented 6 months ago

Thank you for the information. I'll check it later.

Nasller commented 6 months ago

https://github.com/Nasller/CodeGlancePro/assets/26132153/2dc45bd0-157b-4c72-8a47-8ee9bbcbd8e5

hello, i have tried to reproduce the problem, but it did not occur. What should I do to reproduce the problem

mumbleskates commented 6 months ago

I don't know, it only reproduces reliably on a given machine. I have an ~8000 line source file that does it in IDEA on my desktop, and the file you are looking at there has the problem every time i open it on my old thinkpad. If it's possible for me to help debug the problem when it reproduces for me I'm willing to do that.

Nasller commented 6 months ago

If you can develop plugin, you can try to debug by yourself to find the problem, about develop plugin you can contact me through discord.

mumbleskates commented 6 months ago

I've reached out there. I've also started looking at the source code a little bit, but I'm not familiar with JWT and am not confident in finding where the images are buffered and then drawn.

I've determined that the minimap, when it is corrupted, is showing a very stretched out version of the top few pixels of the correct image of the colored text, stretched out to many times its correct height. Markup, selection, and character position are then drawn in what would have been the correct locations on top of that background. The bug only happens in "editor size: proportional" mode, not in "fit".

mumbleskates commented 6 months ago

Here you can see, I've inserted a distinctive looking brightly colored line of text on line 12; we just see the very bottom of it, very stretched out, when we scroll to the very bottom of the file. Screenshot from 2024-02-25 16-11-16 Screenshot from 2024-02-25 16-12-56

mumbleskates commented 6 months ago

Here's a recording of its behavior, with all extra markup and highlighting disabled: Screencast from 02-25-2024 04:26:11 PM.webm

mumbleskates commented 6 months ago

I can make this happen even on my bigger desktop, merely by copying and pasting the contents of a file to make it longer: Screencast from 2024-02-25 16-53-53.webm

Nasller commented 6 months ago

i have contact you by discord

mumbleskates commented 6 months ago

So summary of this: Lots of debugging, nothing was found; everything seemed right up until the draw call was sent to java.awt.Graphics#drawImage and the wrong image just shows up anyway.

Turns out that most current jetbrains IDEs, and JDK17 in general, don't yet support Wayland desktop. And the draw call itself is, indeed, bugged.

Solutions right now seem to be to either "not use Wayland, again, for the 15th year in a row" or "use a newer JDK with jetbrains IDEs". At present there is in fact a jdk21 build of their custom fork that's bundled, or at least probably available to you, and this fixes the problem for me as well.

Screenshot from 2024-02-26 01-04-05

mumbleskates commented 6 months ago

well. doesn't quite fix it. but maybe it will. someday soon...