Thanks. That and megane-kun’s solutions work, now that I know about the backslash key.
BTW, IDK about Kcalc 22, but Kcalc 23 rocks because they added history to it. If you type Ctrl+h, it opens a panel that shows all the past results since the last AC. That’s why I’m using the flatpak to get it. It makes the calculator much easier to use and when I get ridiculous results, it shows me what I actually typed instead of what I meant to type.
I’ve got it working, but I have to use it a while to see if it’s stable.
Sometimes asking a question makes you think of an answer.
I think I have a good workaround for now.
I’m writing an AutoKey script to do it using a Python regex. The added benefit of doing it this way is that it will work almost anywhere, not just in Kate.
Filed kcalc bug https://bugs.kde.org/show_bug.cgi?id=492518