Non standard cut / paste behavior

Dear Theia IDE framework developers and community.

Recently I found myself trying out the Arduino 2.0 IDE which uses your framework. I have to say it seems very flexible and has a lot going for it.

In windows 10:

I also encountered an issue which to the knowledge of a very nice person handling support on the arduino forum is something that isn’t configurable. He/she suggested I ask it here. I downloaded the TheiaBlueprint demo and saw the same behavior.

I’d like to know what you think of this and if it has a hidden option somewhere to disable/change it.

When you select a piece of text, then cut it ctrl-x then after that make sure you selected nothing or nothing extra you cut again “cut nothing” then paste, you paste nothing.

In all other editors, from text editor to even art programs cutting “nothing” doesn’t result in the clipboard being emptied.

Yes, this happens even if I disable the “empty selection clipboard” setting in the ui preferences.

Let me recap.

Disable “empty selection clipboard”

Type something.
Select it.
Press ctrl-x
Press ctrl-x again
Press ctrl-v

result: nothing appears.
expected result: the cut text reappears.

Friendly regards and thank you for taking the time to reply.

@Phoenixxl thank you for the discussion, I believe the behavior actually comes from the monaco editor which we make use of, as well as vscode. I believe I reproduced it in the playground if you’d like to give it a try as well.


I believe cutting nothing or copying nothing will result in the same behavior across applications (which is what I experienced).

Thank you for taking the time mr vince-fugnitto.
Yes I see, you seem to be having the “cut/copy an empty line when nothing is selected” option enabled as well. Which is indeed non standard but remains a valid option to put in an editor. ( see image)
My question is specifically for when even that option is disabled.
Not even an empty line is cut/copied and put in clipboard.

The question remains.
Does this non standard behavior for an editor in general deserve a preferences option “cutting / copying nothing does nothing to the clipboard” ?
^^^ EDIT2: After double checking in VS-Code, this should probably not happen in the first place.

Friendly regards.

EDIT: PS: I am making a video as a reply, bare with me.
EDIT2: Video has been added

To eliminate potential PEBKAC issues on this side of the connection, here is a video showing VS-Code and Theia-Blueprint side by side.

Firstly I disabled the “Editor: Empty Selection Clipboard” option in SHIFT-CTRL-P “Preferences: Open Settings (UI)” on both the theia Blueprint and the VS-Code editors.

The video:
In VS-Code you can see CTRL-x CTRL-x CTRL-v of a selection results in the selection reappearing.
In contrast on the Theia Blueprint side the same action results in nothing reappearing and the clipboard having been emptied with the second CTRL-x.

Empty selections being copied should not result in clipboards being emptied.

Thank you for investigating this.

Thank you for the follow up!

I confirm that in vscode they handle the preference well, but from what I can identify the bug happens in the monaco editor (you can try by turning that preference on as well in the example). It is likely that vscode adds extra handling to prevent the cut/copy for empty lines when the preference is on.

I believe some further investigations are necessary, and if anyone is interested in providing a fix they are most welcome to!

1 Like

When the added option to cut the line the cursor is currently on when nothing is selected is turned off nod.

Right, so enabling/disabling the option emptySelectionClipboard had no effect when I tried the monaco playground (which is what theia would experience). It is likely that vscode handles the option specifically to provide you with the behavior you were looking for (ex: vscode cut).

So basically this is what’s missing…