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.62k stars 518 forks source link

CTRL+U not working on Linux #1028

Closed hollunder closed 4 years ago

hollunder commented 4 years ago

Hi Paul.

I have a weird issue where CTRL+U is not working on either of my machines using my installed package (cloned from git, 190d branch, but also with c, built myself rather than using the shipped binaries).

Weirdly using the shipped binaries (just using zbstudio.sh) it works.

Other keyboard shortcuts seem to work just fine. Any clue what I could try?

pkulchenko commented 4 years ago

built myself rather than using the shipped binaries

@hollunder, what exactly do you mean by this? Do you build the binaries using the scripts in the build/ folder or do you build them using your own process? What OS are you on?

The only thing that comes to mind is that you may need to add ide:Print("here 1") calls or something like that to menu_edit.lua file around line 223 where the function that handles the comments starts. This will allow you to figure out where the process breaks.

hollunder commented 4 years ago

I'm on Linux. I still build it the same way I did previously, just using the 190d branch now: https://github.com/pkulchenko/wxlua/issues/47 Sorry, can't link to the actual post since github doesn't work well for me and doesn't just show a the URL. One thing I forgot to mention: it works via menu, simply not via shortcut. Those prints don't show if I press the shortcut but do show via the menu, so the function simply doesn't get called for some reason.

pkulchenko commented 4 years ago

@hollunder, very strange. Does the menu item show Ctrl-U as the shortcut on it?

It looks like the shortcut is simply not working. In terms of your build process, you are using Lua 5.3 with all the recent changes, right?

There are couple of things you can try to narrow down the reason for this: (1) assign Ctrl-U to something else and (2) assign some other shortcut to comment/uncomment to see if it still works.

[ID.COMMENT]          = "Ctrl-F1"
[ID.COMPILE]          = "Ctrl-U",

This should associate comments with Ctrl-F1 and compilation with Ctrl-U. Do both of these work?

If Ctrl-U still doesn't work, do you have something in the config that would override Ctrl-U (although probably not if launching the prepackaged binaries work).

hollunder commented 4 years ago

I'm using Lua 5.3 and wxlua from your git branch as well. Built with wxWidgets 3.0.4, wxLua 3.0.0.6. I think the currently installed version is built against GTK2, but I switched back and forth so much that I don't know for certain.

I switched the bindings in zbstudio/src/editor/keymap.lua, F7 comments the lines just fine, CTRL-U doesn't compile as far as I can tell. I also tried other bindings, like Ctrl-H, which triggers the comment. So it seems the problem is something about the U.

I will try to rule out something in my environment, but I noticed several other odd things.

A working comment-binding toggles the red dot, the run symbol.

Not all bindings are in this file either, Ctrl-D duplicates a line but is not listed there.

pkulchenko commented 4 years ago

So it seems the problem is something about the U.

Interesting; can you also try Alt-U and Ctrl-Shift-U? Maybe there is a global shortcut in your environment?

A working comment-binding toggles the red dot, the run symbol.

I didn't get this one; can you explain?

Not all bindings are in this file either, Ctrl-D duplicates a line but is not listed there.

That's correct; some of the shortcuts are handled directly by Scintilla and are documented here: https://studio.zerobrane.com/doc-editor-keyboard-shortcuts

Actually, I see Ctrl-Shift-U on that list, which may somewhat explain this. I think there was an issue in wxwidgets on Linux that handled "local" shortcuts in components before the global shortcuts are handled (which is done in the opposite way on Windows/macOS). So in this case Scintilla probably "eats" Ctrl-U before it gets to trigger the global shortcut. I think it was addressed in the latter version (3.1 perhaps). You can confirm if you try assigning a global shortcut to Ctrl-D (or Ctrl-Shift-D), as it will probably not work either.

So, the workaround is to assign it to a different shortcut that doesn't conflict with Scintilla ones.

hollunder commented 4 years ago

Alt-U works, Ctrl-Shift-U doesn't. Ctrl-D duplicates the line, as mentioned before. Ctrl-Shift-D works (toggles comment). Upgrading from wxgtk 3.0.4 to 3.1.3 didn't help unfortunately. WXlua-git failed to link against the gtk3 version but fortunately linked against the GTK2 version. Ctrl-U still doesn't toggle comments.

2019-12-20-143456_1366x768_scrot

pkulchenko commented 4 years ago

I'm not sure what to make of this. I tested on Ubuntu 16.04 (this is the one I'm using to compile Linux versions) and don't see any issue (Ctrl-U un/comments for me as expected). I've also tested with 190d branch with the same result. What exact version of Linux are you using?

I can only recommend to switch to a different shortcut or use the menu; I don't think there is anything else I can do for this one ;(

pkulchenko commented 4 years ago

@hollunder, I'm closing this, as I'm not sure what to do about it, but feel free to update this with any new information, as it may help with tracking the issue down.