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

LineEdit Right-Click clearing selection #59808

Closed
madmiraal opened this issue Apr 2, 2022 · 5 comments
Closed

LineEdit Right-Click clearing selection #59808

madmiraal opened this issue Apr 2, 2022 · 5 comments

Comments

@madmiraal
Copy link
Contributor

Godot version

3.x (99c07c9)

System information

Ubuntu 21.10

Issue description

In LineEdit, when text is selected, you can no longer right-click and cut or copy the selected text, because, when right-clicking, the selection is cleared.

This affects 3.5-beta2 and beta3, it works fine in 3.4.4, 3.5-beta1 and master.

Steps to reproduce

In a LineEdit, select some text, then try right-click and cut or copy the selected text.

Minimal reproduction project

RightClickCut.zip

@madmiraal
Copy link
Contributor Author

Git bisect points to 0ffacff #54353 cc @ConteZero

@ConteZero
Copy link
Contributor

When right-clicking a NOTIFICATION_FOCUS_EXIT is received and this code is executed:

if (deselect_on_focus_loss_enabled) {
	deselect();
}

This does not happens on master branch, so I don't know if this is a bug on 3.x branch or not.

I think that the correct behavior is to NOT send the NOTIFICATION_FOCUS_EXIT when right-clicking, all the program that I've tested do not lose field focus when you right click on it.

@madmiraal
Copy link
Contributor Author

LineEdit receives a NOTIFICATION_FOCUS_EXIT, because the PopupMenu that the right-click creates grabs the focus:

focusable->grab_focus();

So receiving a NOTIFICATION_FOCUS_EXIT is not a bug in 3.x. It just works very differently than in 4.0.

If this isn't easily fixable, we should revert 0ffacff.

@ConteZero
Copy link
Contributor

I've already tried to comment line 187 on popup.cpp but the the NOTIFICATION_FOCUS_EXIT continues to be received from LineEdit when right-clicking.

Anyway I've coded a workaround that should avoid the text deselection.

@akien-mga
Copy link
Member

Fixed by #59827.

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

5 participants