Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ctrl+Shift+Z action not triggering #71911

Open
nezvers opened this issue Jan 23, 2023 · 9 comments
Open

Ctrl+Shift+Z action not triggering #71911

nezvers opened this issue Jan 23, 2023 · 9 comments

Comments

@nezvers
Copy link

nezvers commented Jan 23, 2023

Godot version

4, Beta 14

System information

Windows 10

Issue description

Physical and non-physical Ctrl+Shift+Z does NOT work.
Physical and non-physical Ctrl+Y works

ui_redo is triggering with Ctrl+Y but not with Ctrl+Shift+Z
I tried to:

  • Redefine the existing Ctrl+Shift+Z event. Note - it stayed non-physical.
  • Delete the Ctrl+Y event
  • Delete and create a new event with a Ctrl+Shift+Z. Note - it was created as physical.

PS. It works for the Godot editor itself, it doesn't work for a game.

Steps to reproduce

Create a script that uses the action Ctrl+Shift+Z

Minimal reproduction project

Currently both actions as Physical from my QWERTY layout.
Discovered while making this project. The action is used in the main.gd.
DIY UndoRedo.zip

@Vilcrow
Copy link
Contributor

Vilcrow commented Jan 23, 2023

@nezvers have you redefined the event ui_undo? The combination Ctrl+Shift+Z is set there. I redefine it and it works.

@nezvers
Copy link
Author

nezvers commented Jan 24, 2023

@Vilcrow As I wrote in the description.
I tried to:

  • Redefine the existing Ctrl+Shift+Z event. Note - it stayed non-physical.
  • Delete the Ctrl+Y event
  • Delete and create a new event with a Ctrl+Shift+Z. Note - it was created as physical.

It works for the Godot editor itself, it doesn't work for a game.

@Calinou
Copy link
Member

Calinou commented Jan 24, 2023

This is due to non-QWERTY keyboard layouts being broken currently, possibly by #70052. cc @bruvzg

I can reproduce this in the editor on 4.0.beta 4fa6edc (French AZERTY layout on Linux). I have to press Ctrl + W instead of Ctrl + Z for undo to work.

@bruvzg bruvzg self-assigned this Jan 24, 2023
@bruvzg
Copy link
Member

bruvzg commented Jan 24, 2023

#70052 should not change behavior of shortcuts like this.

Tested on X11 and macOS with current master and beta 14 using QWERTY and AZERTY layouts, everything works in editor (undo/redo in the script editor).
When running the project:

  • On X11 Ctrl+Y seems to work fine, Shift+Ctrl+Z is not triggering with AZERTY.
  • On macOS both shortcuts works with Ctrl instead of Command.

Seems like there is physical keycode Ctrl+Y and physical Shift+Ctrl+Z actions saved in the project.godot.

@nezvers
Copy link
Author

nezvers commented Jan 24, 2023

Yes there is a physical keycode, because:
Physical and non-physical Ctrl+Shift+Z does NOT work. At least on my QWERTY Windows machine. In the editor, it works.
Physical and non-physical Ctrl+Y works

@bruvzg
Copy link
Member

bruvzg commented Jan 24, 2023

OK, found unrelated issue with a #70052 (will fix in a moment).

It works if it's done like this. Default behavior is exact_match = false, without exact_match = true it was matching Ctrl+Z to Ctrl+Shift+Z and triggering ui_undo first:

func _unhandled_input(event:InputEvent)->void:
	if event.is_action_pressed("ui_undo", false, true): # action name, allow echo, exact match
		print("Undo")
		undoRedoResource.undo()
	if event.is_action_pressed("ui_redo", false, true):
		print("Redo")
		undoRedoResource.redo()

So it's a feature, but I do not think it's a good thing to have by default.

@bruvzg bruvzg removed their assignment Jan 24, 2023
@nezvers
Copy link
Author

nezvers commented Jan 24, 2023

That seems extra frustrating either way - when action is pressed and it doesn't work or action gets triggered when there are held extra optional keys.
Still, thank you, @bruvzg, for your help!

@git2013vb
Copy link

I have similar problem with different shortcuts setting a new one
For example for Show in Filesystem
If I set Ctrl+e as shortcut it will not trigger, instead it will write e in editor

v4.0.rc2.official [d2699dc]
Debian 11

@Rindbee
Copy link
Contributor

Rindbee commented Mar 7, 2023

I have similar problem with different shortcuts setting a new one For example for Show in Filesystem If I set Ctrl+e as shortcut it will not trigger, instead it will write e in editor

Similar to #74181.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants