Update: The Ditto developers fixed this in Ditto Beta version 3.21.248! You can download it at https://ditto-cp.sourceforge.io/beta/
For more info see https://sourceforge.net/p/ditto-cp/discussion/287511/thread/6c5ae56a/#a80b
I have found the reason why Ditto is not properly excluding KeePassXC text, but unfortunately I have not found how to fix it yet:
Ditto is not able see the KeePassXC application.
Since it can't see the KeePassXC application when it is open, Ditto doesn't know to ignore text copied from within it even if it is in the exclude list.
I figured this out by enabling Ditto's log. I excluded all KeePassXC processes I saw in task manager, as well as notepad to test both and see what happens when I try to copy text from within both applications. (Ditto options screenshot)
(To enable logging, open Ditto, then ctrl + F5 to start/stop log. Log file can be found in C:\Users\ user name \AppData\Roaming\Ditto)
When I tried to copy text from within notepad, the log below shows what is supposed to happen when text is copied from an application that has been added to the Ditto exclude list. Notice that Ditto recognized notepad as the active app (highlighted in this screenshot).
[2018/8/4 01:30:03.533 - ClipboardViewer.cpp 241] OnClipboardChange - Start
[2018/8/4 01:30:03.540 - ClipboardViewer.cpp 320] INCLUDE app names: *, Active App: notepad.exe
[2018/8/4 01:30:03.547 - ClipboardViewer.cpp 333] Inlclude app names Found Match * - notepad.exe
[2018/8/4 01:30:03.554 - ClipboardViewer.cpp 347] EXCLUDE app names keepassxc.exe;keepassxc-proxy.exe;keepassxc-cli.exe;keepass.exe;*.kdbx;notepad.exe;, Active App: notepad.exe
[2018/8/4 01:30:03.559 - ClipboardViewer.cpp 357] Exclude app names Found Match notepad.exe - notepad.exe - NOT SAVING COPY
[2018/8/4 01:30:03.566 - ClipboardViewer.cpp 243] OnClipboardChange - End
However, the log below shows what happens when I copy text from within KeePassXC. Notice that the "Active app" is blank (highlighted in this screenshot). If Ditto can not see KeePassXC, then it can not know that it should ignore the text copied from within the program.
[2018/8/4 01:29:44.999 - ClipboardViewer.cpp 241] OnClipboardChange - Start
[2018/8/4 01:29:45.007 - ClipboardViewer.cpp 320] INCLUDE app names: *, Active App:
[2018/8/4 01:29:45.013 - ClipboardViewer.cpp 333] Inlclude app names Found Match * -
[2018/8/4 01:29:45.018 - ClipboardViewer.cpp 347] EXCLUDE app names keepassxc.exe;keepassxc-proxy.exe;keepassxc-cli.exe;keepass.exe;*.kdbx;notepad.exe;, Active App:
[2018/8/4 01:29:45.021 - ClipboardViewer.cpp 266] OnDrawClipboard:: *** SetTimer *** 455056375
[2018/8/4 01:29:45.024 - ClipboardViewer.cpp 243] OnClipboardChange - End
[2018/8/4 01:29:45.135 - ClipboardViewer.cpp 392] OnDrawClipboard::OnTimer 455056500
[2018/8/4 01:29:45.141 - CopyThread.cpp 56] OnClipboardChange - Start
[2018/8/4 01:29:45.147 - CopyThread.cpp 109] LoadFromClipboard - Before
[2018/8/4 01:29:45.157 - Clip.cpp 435] Tried to set description from cf_unicode text, Set: 1, Desc: [keepassxc test]
I am not an expert on KeePassXC or Ditto, so I'm not sure if this a problem with Ditto or with KeePassXC. I wonder if this bug may actually be some sort of security "feature" of KeePassXC - maybe it tries to hide itself from other programs?
If we can get Ditto to see KeePassXC as an active app, then it should work properly. Unfortunately I haven't figured out how to do that yet.
I know this is only a half answer, sorry. I have identified why Ditto isn't properly excluding KeePassXC, but I have no idea how to fix it. I am having the same problem as you, so I hope this info helps someone else smarter than me to come up with a fix.