Copy Paste is not working as expected in Delphi 10.2

I am using Delphi 10.2. I select a piece of code, I have already some text in my clipboard. I press Ctrl+V to overwrite the selected piece of code and Delphi 10.2 appends the new text to the code I wanted to overwrite. This is getting infuriating. Is there some setting that controls this. Notepad++ works as expected, i.e… the selected text gets overwritten. Has anyone got any ideas.

That’s not a known problem that I am aware of.

Does it happen with a brand new project? I’m just wondering if it’s some kind of ASCII/BOM sort of thing.

I think, insert key toggles between overwrite and append

Check Tools/Options/Editor Options/Key Mappings or whatever the equivalent is in your version of Delphi.

This Delphi system I inherited.

I don’t know what any of these options mean

Did you mean to say “I searched for a piece of code and it looks selected”?

If yes, then that default behaviour when pasting is WAD in Delphi. But yes, still irritating.

No, I meant what I said. I select a piece of code, I press Ctrl+V with my clipboard saved code, it appends rather then overwrites it.

1 Like
  1. I just tested on Delphi 11. It used t work fine. Delphi 12 has a bug.
  2. The options are key mappings. IDE Classic is what I use, which is wordstar like commands, that I have been using since the 80s. Default is windows style commands.
  3. The right hand side are modules that are adding to the shortcuts, you can turn them off.
  4. And what I said before was how it used to work. The insert used to toggle over-write and append mode. But it has been munted since before Delphi 11.
1 Like

There is a long standing bug in Delphi (maybe since 2007 or so) which may be causing this, which is the persistent blocks setting. Occasionally, seemingly randomly, this setting gets enabled in some internal state but isn’t reflected in Tools, Options. I used to think that it was triggered by accidentially pressing some option key sequence but I’m pretty sure that isn’t the case (and it would/should be reflected as enabled in the Options but isn’t).

That causes strange things like selecting code and moving the cursor the code stays enabled, and pasting behaves differently.

The fix is to go into Tools, Options, Editor Options and enable persistent blocks, save/close the settings dialog, and go back and disable persistent blocks. Give that a go to see if it helps.

In regards to Insert/Overwrite, the current state is displayed at the bottom of the editor window so you should be able to see if that is the cause.

I’ve always thought that this is a threading issue in the editor

@Jarrod, you are on the right track. I never really understood these settings.

Since I migrated my settings from 11 to 12, they should both work the same, but they don’t. So you are probably correct about this bug.

The settings in question

The help (it wont let me copy paste as text)

01.04.2025_01.56.21_REC