godot icon indicating copy to clipboard operation
godot copied to clipboard

Shortcuts in code editor stop working (saving with CTRL+S, script navigation with ALT+ARROW)

Open AntonioDell opened this issue 1 year ago • 10 comments

Godot version

4.0.stable

System information

Pop!_OS 22.04

Issue description

When writing gdscript code for extended periods of time (~10 min) some keyboard shortcuts stop working and only start working again, if I navigate away from the godot editor, the shortcuts start working again for a time and then stop again (usually after less than a minute).

This is possibly related to https://github.com/godotengine/godot/issues/63888.

Steps to reproduce

I haven't found out, what actions exactly causes the shortcuts to stop working, so I cannot provide steps to reproduce sadly, but I know that this is an issue since at least RC 1.

But on this screencast you can see the issue. You can't see the buttons I am pressing, but I try to navigate with ALT+Left and ALT+Right between the opened scripts history and it only works unreliably. Screencast from 03-01-2023 08:28:08 PM.webm

Also using CTRL+S to save only prints the letter S into the code editor instead of saving sometimes. You can see it on the following screencast. The first time I use CTRL+S it saves, but after writing a little, it only prints s: Screencast from 03-01-2023 08:39:35 PM.webm

Minimal reproduction project

Any project will do as far as I know.

AntonioDell avatar Mar 01 '23 19:03 AntonioDell

(for those unfamiliar STRG is CTRL)

Edit: this wasn't aimed as a correction I'm sorry if it came across as such

AThousandShips avatar Mar 01 '23 19:03 AThousandShips

I haven´t used Godot 3 in a while, but i can confirm that I get this problem at least since Godot4 RC2, this problem also fixes itself when triggering save with mouse clicks.

Don´t know how relevant, but it happens to me on Fedora 37 with Gnome wayland

Edit: BTW, I also lose Ctrl + W Edit2: I recover the shortcuts when I click on 'Scene -> Save Scene', though not for long

ddelvall avatar Mar 03 '23 19:03 ddelvall

I do have those problems too on ubuntu.

(EDIT: removed a few things, since the issue seem to only happen after a few minutes of use (as mentioned above), which made me think I had solved it.)

And this looks related: my shortcut to show the script editor is Ctrl+1 (Ctrl+& on my french keyboard layout) and when pressing this while in the script editor, it types the & character. Or in general it types the character as if it wasn't a shortcut.

Also I remember trying the Ctrl+Alt+S (save script) shortcut as a workaround when Ctrl+S was not working, and it too ended up being not working and typing S instead of saving the script.

mieldepoche avatar Mar 04 '23 01:03 mieldepoche

also: #73978 is possibly related ?

mieldepoche avatar Mar 04 '23 02:03 mieldepoche

Is this a Linux problem? I haven´t seen windows users complaining about it. For all other users, are you using Wayland or Xorg?.

ddelvall avatar Mar 05 '23 13:03 ddelvall

I am using Xorg (x11)

AntonioDell avatar Mar 05 '23 14:03 AntonioDell

x11 too here

mieldepoche avatar Mar 05 '23 16:03 mieldepoche

CC @bruvzg

akien-mga avatar Mar 05 '23 17:03 akien-mga

After switching to Chinese input, using the shortcut key Ctrl + S multiple times may reproduce this issue.

https://user-images.githubusercontent.com/30386067/223110855-9f7d7830-531b-450a-a04a-36ed2868dd8c.mp4

During attempts to reproduce this issue, the Ctrl key is held down and only the S key is released/repressed. After the issue appears, the shortcut key will only take effect on the first attempt after the editor loses focus and regains focus, otherwise it will be invalid. At this point, releasing all keys will not improve the situation.

Might be related to the following code. https://github.com/godotengine/godot/blob/2267646bf4c29acf1342951d8726626817c742bd/platform/linuxbsd/x11/display_server_x11.cpp#L3252-L3257

When the issue occurs, echo is set to true. It may be that Input::keys_pressed is not properly cleaned up when the key is released.

Rindbee avatar Mar 06 '23 12:03 Rindbee

https://github.com/godotengine/godot/blob/2267646bf4c29acf1342951d8726626817c742bd/platform/linuxbsd/x11/display_server_x11.cpp#L2927-L2932

Seems to be a regression of #70052. After this issue occurs, the above code will cause the corresponding event to fail to be generated when the key is released. This caused Input::keys_pressed to end up not clearing the previous keys correctly.

Rindbee avatar Mar 06 '23 15:03 Rindbee