With the smallest possible delay (a setting of 0), the result is incorrect. With a larger delay, the result is correct. The only difference between the two settings is the length of delay. 0 is therefore too fast.
That "a window sometimes can't keep up with a rapid flood of keystrokes" is not the only explanation for why a delay might be necessary; just the easiest and most generally applicable one. An application might discard buffered keyboard events at times or handle them differently depending on timing. Handling of different keyboard events generally implies performing a different function, which means executing different code, and perhaps taking a different length of time to do it.
If you are typing into a console window and your input is merely being buffered and displayed, one might think that any given printable character should be handled equally; but
something must be causing the difference, and I am confident that something is not AutoHotkey. By process of elimination, I assume it must be MINGW, console window keyboard handling, or some external factor I am not aware of. Have you tested with a different console application or GUI application?
I have reviewed the code used to perform key delays and confirmed that it does not in any way differentiate between keys. Different
characters may require a different combination of modifiers, but by default (
PressDuration is -1) these changes in modifier key state do not cause a delay. There is no special handling for any given character in the Raw mode, or for "_" in any mode.
Putting aside whether this is a "bug", I believe there is nothing that can be done to work around the issue
other than the mechanisms already available to you: increase the delay or try a different method of sending text (clipboard-paste, Send {Text}, ControlSend, ConsoleSend(), ...).
SendRaw did not make much of a difference vs Send
If you used
Send %str% rather than
Send {Raw}%str%, there would certainly be a difference. Without Raw,
this++is++a+test would rightly produce
thisIsATest, since
+ means Shift.