Write a line of text in ide 2.0
Select it
Press ctrl-x to cut
Make sure nothing is selected
Press ctrl-x again
press ctrl-v
Nothing appears.
Expected behavior: written text should reappear.
Do the same thing in any other text editor for comparison. Any other application that edits anything.
Cutting again, when nothing is selected should not empty the clipboard.
Friendly regards.
EDIT
Windows 10.
Added a video to make this absolutely clear.
(The second half of the video is doing exactly the same thing in Notepad but it could very well be any other editor.)
This was a misinterpretation of your observations.
A "Cut" operation when nothing is selected does not empty the clipboard. Instead, what it does is cuts the entire line the cursor is at, placing the cut content in the clipboard. "Copy" operations have the equivalent behavior (entire line is copied). Because the line you had the cursor on was blank, it placed an empty line in the clipboard, which gave the appearance of having emptied it. If you try it again with a non-empty line selected, the true behavior will become clear.
This capability comes from the open source Eclipse Theia IDE framework the Arduino IDE 2.x, is built on, which inherits it in turn from VS Code. If you have default settings in VS Code, you will see the same behavior (it is controlled by editor.emptySelectionClipboard).
If you don't like this behavior, you can disable it in the Arduino IDE advanced settings. I'll provide instructions for that:
Use the Ctrl/โ+Shift+P keyboard shortcut to open the "Command Palette" in the Arduino IDE.
Select the "Preferences: Open Settings (UI)" command from the "Command Palette".
The "Preferences" tab will now open in the editor panel.
In the "Search Settings" field, type Empty Selection Clipboard
Uncheck the box under the "Editor: Empty Selection Clipboard" setting.
I do still believe this should not be the default behavior though.
My observation was correct, selecting nothing cut an empty line placing it in clipboard where the standard behavior for windows is , when nothing is selected a cut does not overwrite a clipboard.
I'm not averse to using ctrl-k in the likes of nano etc. But this does not feel "normal".
The fact it can be disabled makes this fixable. It is still non standard behavior for cutting and pasting. I believe disabling it by default when it comes to arduino ide 2.0 ( not the Eclipse Theia framework) should be considered.
PS: thank you for pointing me in this direction, i also found the fix I had with automatic closing brackets and quotes in there.
Have a nice day, and thank you again for providing a solution.
That is probably a fair assessment, but when the world's most popular editor has the behavior by default, it can't be considered too unusual.
You are welcome to submit a formal proposal to the developers for that change to be made:
I personally don't have strong feelings either way about the feature. I never use it, but I also think it is reasonable behavior and I haven't stumbled over it yet.
I do have it disabled in my VS Code settings (which might explain why I never use it). However, that is only because at the time I migrated from the more minimal Notepad++ I was so overwhelmed with the number of features of a default VS Code installation that I went through the settings and disabled everything I didn't explicitly need at that time. I didn't have any specific reason for disabling that setting.
You are welcome. I'm glad if I was able to be of some assistance.
Ok..
I blame myself tbh. Seeing the words "Arduino Team" must have made me somewhat think you'd actually test this "solution" of yours.
I shouldn't have done that.
The problem is still there. minus the empty line being cut.
With the changes in preferences you suggested:
Mark part of text.
CTRL-x
CTRL-x (again)
CTRL-v
Text does not reappear.
Thank you in advance for not forcing me to make another video.
Come on... LOL!
Cutting an empty selection, even with " Editor: Empty Selection Clipboard" disabled clears the clipboard. This should not happen. This is not flavour or frill, this is a fundamental flaw and should be addressed.
I do understand moderating this board takes a lot out of people, and yes, thank you for your help earlier this week. Do please understand this is just about objectively trying to indicate this is happening and showing this needs a fix, nothing more. All the work you do on here is appreciated, my automatically closing of quotes/brackets thing I found in the preferences, thanks to you showing those preferences existed, is still working fine!
I'm sorry if my support has not met your standards @Phoenixxl. I will strive to do better in the future.
This handling of redundant Cut operations comes from the free open source Eclipse Theia IDE framework. There is nothing that can be done in the Arduino IDE code base to change it. Please submit a request to the Theia developers. Once they have resolved that, it will automatically be inherited by Arduino IDE on the next update of the dependency.
Either you tested your solution or you didn't. There is no emotional baggage nor guilt attached to all this. Please don't make it into something it isn't. Your solution fixed something else , an empty line being cut when nothing is selected which would also have been an issue for me.
But the actual problem isn't about my preferences, it's about standard cut / paste behavior.
As a last hurrah i'll have a look at other projects which use Theia.
Regards and thank you for taking the time to reply.