【insert by Pasting】simulate deletes bug?

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.

Is it a bug or something wrong with my config?

Sample Macro Below:
Front-Matter.kmmacros (7.2 KB)

Works as expected for me in TextEdit, with

I am some text

...changing to:

I am some text
title: "Untitled 3"
date: 2022-09-22 19:26:50 +0100

What app are you seeing this behaviour in? Does it work properly for you in TextEdit?

1 Like

In TextEdit and MacVim the macro work properly :astonished:
But in CotEditor Obsidian and Visual Studio Code, it delete one more character :joy:
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)?

1 Like

For Obsidian and VS Code, I'm using another simple macro:

I will follow your way try to figure out whether it's OS error or App error :grimacing:

It seems an InputMethod Switching problem :joy:

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.

:joy: This situation may only be encountered by CJK users like me.

1 Like