I use Insert by Pasting a lot when doing text expansion which won't invoke Alfred like Insert by Typing does.
Last time I was using KM8, I upgrade to KM10 a few months ago. I find 【insert by Pasting】simulate deletes seems have a bug or something:
It always delete one character more than expected. For example:
I'm editing in the beginning of Line 3, and trigger the macro, it deletes what I inputs (expected) with text expansion, and delete the LineBreak which makes the cursor moves to the End of Line2.
In TextEdit and MacVim the macro work properly
But in CotEditor Obsidian and Visual Studio Code, it delete one more character
Maybe I should ask for their developer to get some help.
For me, both Obsidian and VS error with "No file associated..." -- but that's probably an OS or app version thing. They both do apply the correct number of deletes before erroring, however.
Since all KM is doing is simulating the Backspace keypress the appropriate number of times, I think you've something else going on. Does this only happen when editing Markdown? Does it happen in the middle of a line or only when fm= are the only characters on a line? What if you change the trigger so it doesn't delete, and instead put three "Keystroke Backspace" actions in the macro (and also try with a decent pause between each action)?
I changed the trigger from lj= to =lj, the problem disappears.
Because the - and = is not only a normal key, but also used to choose Chinese character from list after typing English letters.
This situation may only be encountered by CJK users like me.