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

cut command (ctrl+x) deletes whole line even if nothing selected #59441

Closed
tavurth opened this issue Mar 23, 2022 · 10 comments
Closed

cut command (ctrl+x) deletes whole line even if nothing selected #59441

tavurth opened this issue Mar 23, 2022 · 10 comments

Comments

@tavurth
Copy link
Contributor

tavurth commented Mar 23, 2022

Godot version

v3.5.beta2.official [7a4f9df]

System information

Mac OSX (Intel 2019)

Issue description

When in the script editor, press Ctrl+x (Cmd+x on mac).

The whole current line will be deleted. This often leads to annoyances if you are working in Emacs as Ctrl+x is such a common keybinding.

I often find myself accidentally deleting one line and then trying to run the game.

Steps to reproduce

When in the script editor, press Ctrl+x (Cmd+x on mac).

Minimal reproduction project

No response

@timothyqiu
Copy link
Member

Many editors have behaviors like this, i.e. copy/cut the whole line when nothing is selected. e.g. VSCode and JetBrains IDEs.

@tavurth
Copy link
Contributor Author

tavurth commented Mar 23, 2022

Perhaps then a way to disable this behaviour?

For me I rarely type anything in the script editor (rather using it as a separate screen), so this just causes an annoyance.

@Calinou
Copy link
Member

Calinou commented Mar 23, 2022

This is done by design, and I don't think this should be made into an option. I don't remember VS Code or JetBrains IDEs offering an option to disable this either.

In master, you can change the Cut shortcut globally in the editor:

image

@tavurth
Copy link
Contributor Author

tavurth commented Mar 23, 2022

Cut can be useful, so the answer to cripple the script editor in some way (by moving the default cut key) doesn't sound great to me.

Since there is now a control for normal cut, perhaps adding a second shortcut for cut line (defaulting to ctr+x) when nothing is selected would fix this issue.

In that way I can unbind that shortcut, and still leave usual cut behaviour in place.

@tavurth
Copy link
Contributor Author

tavurth commented Mar 23, 2022

I think there is also an important difference in godot from most editors.

In godot you spend 90% of your time in other UI (inspector) whereas in VSCode you spent 90% of the time in the text editor.

@tavurth
Copy link
Contributor Author

tavurth commented Mar 25, 2022

Another problem here is that when I accidentally cut something, I can press Ctrl + z to undo, but the lines are then selected. This causes other development flow issues.

For me these are not huge issues but something I see every day at least a few times and breaks my immersion as I struggle to get Godot to do what I feel it should be doing.

@BeayemX, I see you are downvoting all of my posts, is there some reason you believe this should not be a feature?

@BeayemX
Copy link
Contributor

BeayemX commented Mar 25, 2022

Sure, the following explanations are just my opinion, no offense meant.

The whole current line will be deleted. This often leads to annoyances if you are working in Emacs as Ctrl+x is such a common keybinding

This is only true for people who are used to Emacs. For people who use VSCode or similar software, they would expect the behavior how it is currently implemented.
I am guessing here, but I think there are more users that are used to VSCode or similar as compared to Emacs.

I often find myself accidentally deleting one line and then trying to run the game.

This feels more like a user error and while changing it may be beneficial to you, it certainly would cripple the experience for others.

perhaps adding a second shortcut for cut line (defaulting to ctr+x) when nothing is selected would fix this issue.

I don't think adding a second keybinding for cut is a good way.

In godot you spend 90% of your time in other UI (inspector) whereas in VSCode you spent 90% of the time in the text editor.

This is just not true and heavily depends on the user. For me I would say that the percentages could be switched because I spend most of my time in Godot writing code.

Another problem here is that when I accidentally cut something, I can press Ctrl + z to undo, but the lines are then selected. This causes other development flow issues.

I agree with this, but I don't think this has anything to do with the original issue and it should probably be made an issue of its own.

Conclusion
I certainly would be glad if Godot would work for everyone and the problem could be solved for you, but I think the current implementation is superior to your suggestion for the majority of the users.

@tavurth
Copy link
Contributor Author

tavurth commented Mar 26, 2022

I think the current implementation is superior to your suggestion for the majority of the users.

Thanks for the in depth reply. OK it makes sense that a lot of people want to keep their flow as similar to VSCode as possible.

What about adding a single toggle somewhere in the editor settings which enabled or disabled this feature?

@TheSofox
Copy link
Contributor

I have made a pull request that solves this by adding a Project Settings checkbox that can disable this behaviour (it's on by default so no changes for most people).

Another problem here is that when I accidentally cut something, I can press Ctrl + z to undo, but the lines are then selected

If this is still an issue, make a separate bug report. You may tag me when doing so.

@YeldhamDev YeldhamDev added this to the 4.x milestone Nov 26, 2023
@KoBeWi
Copy link
Member

KoBeWi commented Oct 21, 2024

Resolved by #90743

@KoBeWi KoBeWi closed this as completed Oct 21, 2024
@KoBeWi KoBeWi modified the milestones: 4.x, 4.4 Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants