SublimeDebugger icon indicating copy to clipboard operation
SublimeDebugger copied to clipboard

UI displayed with Sublime Text 4

Open carolusquintus opened this issue 4 years ago • 15 comments

After upgrading to Sublime Text 4 it could not load the plugin, so I had to remove and install it once again. I re-installed adapters & updated them to the new configuration but UI it's not displaying correctly. In the second picture, it can be seen that tab variables it's showing in the middle of scrolling.

29-Jun-2021_210957 29-Jun-2021_210951 29-Jun-2021_210937

carolusquintus avatar Jun 30 '21 02:06 carolusquintus

I have this exact display problem since ST3

devnix avatar Jul 09 '21 13:07 devnix

Just find out the same, on windows, if that matters.

I've also found out that if I change the UI scaling in the settings, from 10, the default, to 9, it fixes this problem, but I also wonder if it is dependandant by the font I'm using in Sublime.

daniele-niero avatar Aug 30 '21 08:08 daniele-niero

This problem also bothers me

Straw94 avatar Nov 29 '21 09:11 Straw94

Just find out the same, on windows, if that matters.

I've also found out that if I change the UI scaling in the settings, from 10, the default, to 9, it fixes this problem, but I also wonder if it is dependandant by the font I'm using in Sublime.

When I tried this method, it didn't work

Straw94 avatar Nov 29 '21 09:11 Straw94

I believe this is fixed already but not released yet.

rchl avatar Nov 29 '21 10:11 rchl

I don't think I did anything specifically to fix this issue. I don't currently have a Windows setup to test on but there was always an issue with figuring out what the width of a character is on Windows/Linux.

The calculation is done here

https://github.com/daveleroy/sublime_debugger/blob/8f8bbd3273a77ff8b3c4fb09526bac7ef29c0d80/modules/ui/layout_view.py#L148

daveleroy avatar Nov 29 '21 17:11 daveleroy

I was thinking https://github.com/daveleroy/sublime_debugger/commit/b6827cfde5bf457146de42a698fd24d10ae5e48a

rchl avatar Nov 29 '21 17:11 rchl

I was thinking b6827cf

Oh yeah its probably broken for everyone on the latest dev versions (I'll make a release tonight). I still think there is an issue with the width calculation for some people such as @daniele-niero though.

daveleroy avatar Nov 29 '21 18:11 daveleroy

I was thinking b6827cf

Oh yeah its probably broken for everyone on the latest dev versions (I'll make a release tonight). I still think there is an issue with the width calculation for some people such as @daniele-niero though.

I still have this problem.

image

Straw94 avatar Jan 16 '22 04:01 Straw94

@Straw94 did you try adjusting the value here https://github.com/daveleroy/sublime_debugger/blob/8f8bbd3273a77ff8b3c4fb09526bac7ef29c0d80/modules/ui/layout_view.py#L148 mentioned above?

daveleroy avatar Jan 16 '22 21:01 daveleroy

@Straw94 did you try adjusting the value here

https://github.com/daveleroy/sublime_debugger/blob/8f8bbd3273a77ff8b3c4fb09526bac7ef29c0d80/modules/ui/layout_view.py#L148

mentioned above?

I have never adjusted this configuration as I have no experience with python. Can you provide a recommended configuration?

Straw94 avatar Jan 19 '22 07:01 Straw94

I have never adjusted this configuration as I have no experience with python. Can you provide a recommended configuration?

I would try increasing it a bit and see if the ui width is calculated better so it doesn't wrap the ui

daveleroy avatar Jan 23 '22 21:01 daveleroy

I found that reducing the width a bit, e.g.

if width > 10:
	width -= 10

in modules/ui/layout_view.py (line 160) fixes the layout.

Maybe the width calculation isn't accounting for a scroll bar or something and the layout engine finds that there isn't enough room for the third panel and puts it at the bottom.

khvorov45 avatar Feb 04 '22 02:02 khvorov45

I found that reducing the width a bit, e.g.

if width > 10:
	width -= 10

in modules/ui/layout_view.py (line 160) fixes the layout.

Maybe the width calculation isn't accounting for a scroll bar or something and the layout engine finds that there isn't enough room for the third panel and puts it at the bottom.

That might work around the issue but rendering the UI at the correct scale is a lot more complicated than it seems like it would be and likely the reason things are not working correctly.

If everything is working correctly we can control the size in characters widths of all the html elements and calculate the actual width in characters that a html element is going to take up. If all of that is working correctly the UI will be reactive and correctly size itself to the given space. To do that requires converting the units used in the generated html and css so they are based on character width instead of height.

If the calculations are off then things take up more or less space than we think in which case some elements will be sized incorrectly and things will not align quite right and in some cases make the phantom (which is sized based on the content inside of it) too large to fit in the given space.

daveleroy avatar Feb 05 '22 20:02 daveleroy

So I spent quite a lot of time on this issue the past weekend and I have workaround that should work well enough.

The root of the issue here is not calculating the width of the panel in characters since that works correctly (I checked). The issue is that to size the UI all of the css/html units need to be converted to character widths and calculating the value to scale those units does not work on Windows/Linux and I do not know why its wrong but it is...

The current calculation (that works on macOS) can be found here if anyone knows why it does not work let me know... https://github.com/daveleroy/sublime_debugger/blob/a9378fcc706d5d0f18670b023862b3a088632ea6/modules/ui/layout.py#L249

The following is the workaround...

Since we know that if the conversion is done correctly the UI will fit pretty much exactly into the space given we can actually just check that it is doing that by comparing the layout and viewport extent of the panel.

If the layout is bigger than the viewport then our conversion value needs to be decreased since the UI is overflowing and if the layout is smaller than the viewport then we need to increase the value. This workaround might take a few iterations before converging on an almost correct value.

The code for adjusting the value can be found here https://github.com/daveleroy/sublime_debugger/blob/a9378fcc706d5d0f18670b023862b3a088632ea6/modules/panel.py#L189

daveleroy avatar Feb 08 '22 07:02 daveleroy

You have to close all files and folders. Then configure view -> layout -> Single. I recommend uninstalling and reinstalling after that process. Reinstall the debugger and accompanying adapter(s). Close and reload sublime text.

Namean avatar Aug 20 '22 03:08 Namean

I believe this layout issue should be fixed in 0.8.0 but if people still have issues re-open

daveleroy avatar Oct 09 '22 04:10 daveleroy