pkulchenko / ZeroBraneStudio

Lightweight Lua-based IDE for Lua with code completion, syntax highlighting, live coding, remote debugger, and code analyzer; supports Lua 5.1, 5.2, 5.3, 5.4, LuaJIT and other Lua interpreters on Windows, macOS, and Linux
http://studio.zerobrane.com/
Other
2.61k stars 519 forks source link

Wrong position for drop down list #1055

Open moteus opened 4 years ago

moteus commented 4 years ago

On my Ubuntu system, I have a problem with drop-down auto-complete lists. This list may show in the wrong position. I have 2 monitors (in fact it is a laptop with the external monitor). image I have the same issues with the hints (e.g. show values during debugging or show function arguments) Also, I have a problem with positioning the command bar like navigate to the line. It can show in some random place on the screen.

pkulchenko commented 4 years ago

I haven't seen this with tooltips and autocomplete dropdowns, but I've seen it on a couple of occasions with the commandbar. I'm not sure what to make of this, as the coordinates are set explicitly, so this looks like some sort of bug in the window manager. I don't have better ideas. In my case the position for the commandbar wasn't random, as it was occasionally positioned shifted, but always horizontally by some number of pixels. I've never seen it shifted vertically.

If this happens regularly for you, I can provide some troubleshooting hints (what code to add where) to check on what coordinates are being sent to Scintilla methods.

pkulchenko commented 4 years ago

Is there anything else that may be special about your setup? I called the commandbar two dozen times or so (as I was debugging another issue), but it was always shown correctly. Does it happen with any regularity for you?

moteus commented 4 years ago

At first, I use Ubuntu 18.04.4 LTS with Gnome shell 3.28.2 on a laptop with the external monitor. I think there 2 separate issues.

  1. Command bar - showed on the screen where the mouse cursor is. Also, it shows on the left side most of the time, but in some cases, it shows on the right side. On my Ubuntu 16 system, it shows on the right side all the time. image

  2. With autocomplete I think the problem on the wxWidgets side because I got the problem with the position even when I call ide:GetEditor():AutoCompShow(2, "print") from the console (I type pr in the editor and then call a command from the console). It happens almost all the time when I maximize a window on the external monitor. When the editor placed on the main screen (monitor of the laptop) all works as expected. All this happens on the wxWidgets 3.1.4, wxLua 3.0.0.8. When I replace binaries to the wxWidgets 3.1.1, wxLua 2.8.12.3 all starts working correctly.

pkulchenko commented 4 years ago

@moteus, apologies, missed your response.

  1. I've seen this happening with the commandbar, but still not sure what contributes to it, as when I debug it, it seems to return correct window position, even when the position "looks" wrong. Not sure what to make of this.

I think you are correct with respect to it showing where the mouse cursor is, but the mouse position is not taken into account in the calculations (showCommandBar function in commandbar.lua). The position should be based on the position of the notebook and nothing else.

What may be happening is the screen position for the notebook not being reported correctly (ide:GetEditorNotebook():GetScreenPosition()); or possibly positions for individual pages.

There is a related comment for tabs (may report 0 as their screen position on Linux, which is incorrect.), which is addressed by comparing with the notebook position, but maybe there are corner cases that still pass the check.

  1. I still can't reproduce the auto-complete issue (although I'm on 16.04). I do suspect it's wxwidgets issue, but it would be still useful to try to track it down. Does ide:GetEditor():AutoCompPosStart() return correct position when the popup is shown?

It could be directly related to the external monitor (as I don't have one in my setup, but will try to connect to see if I can reproduce it this way).

pkulchenko commented 4 years ago

@moteus, is there any additional information for the screen position?

moteus commented 4 years ago

I did not investigate it further. Maybe you have some hint to where I can start E.g. how to check Does ide:GetEditor():AutoCompPosStart() return correct position when the popup is shown.

PS. I switched back to the gtk2 on my Ubuntu system an has no problem with drop-down lists. I have only problem with the command bar position, but i can live with that.