godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.07k stars 69 forks source link

Add text editor option to prevent copying current line without a selection #9527

Open snoopdouglas opened 2 months ago

snoopdouglas commented 2 months ago

Describe the project you are working on

Platformer. (this is relevant to any project though)

Describe the problem or limitation you are having in your project

When pasting, I sometimes accidentally hit Ctrl-C instead of Ctrl-V on a blank line. This clears the clipboard and I have to go back to copy what I had before. I want to have the option to turn this off.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Similar to VS Code's editor.emptySelectionClipboard option, I'd like to be able to do nothing when copying without a selection.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Add an editor settings option for this, probably under Text Editor > Behaviour.

If this enhancement will not be used often, can it be worked around with a few lines of script?

Not to my knowledge (I've not tried to alter the text editor's behaviour in this way).

Is there a reason why this should be core and not an add-on in the asset library?

It's a common feature for text editors. (can provide more examples if needed.)

aXu-AP commented 2 months ago

I too sometimes do the same mistake, altough I use copy/cut line command all the time so this option isn't for me. As a workaround when accidents happen, I use clipboard history to paste the correct snippet (Win + V on Windows, I presume other os's have something similiar available).

snoopdouglas commented 2 months ago

Oh yeah, I'm 100% on board with clipboard managers - it's just that not everyone will have them installed (or be aware of them), and this felt like a relatively small feature request (in my naive opinion)