Skip to content

Ctrl + S on yarn_editor.gd not limited to focus causing file to be compiled when working on other scripts/resources/scenes, including when the tab is not showing #3

@Vanthium

Description

@Vanthium

Ctrl + S on yarn_editor.gd is not limited to focus (or to when the control is visible) causing the yarn file to be compiled when working on other scripts/resources/scenes, including when the tab is not showing.

More importantly it blocks those other things from saving as the event is accepted. It also makes things less responsive.

I think the issue is this in yarn_editor.gd:

func _shortcut_input(event: InputEvent) -> void:
	if event is InputEventKey and event.pressed:
		if event.ctrl_pressed and event.keycode == KEY_S:
			if not _current_path.is_empty():
				_save_file()
				accept_event()

Adding in a focus check fixes it:

func _shortcut_input(event: InputEvent) -> void:
	var focus := self.get_viewport().gui_get_focus_owner()
	if not is_ancestor_of(focus):
		return
	
	
	if event is InputEventKey and event.pressed:
		if event.ctrl_pressed and event.keycode == KEY_S:
			if not _current_path.is_empty():
				_save_file()
				accept_event()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions