It was working on very old versions of Kate but not anymore. This behaviour is fairly standard across applications. Thanks
https://invent.kde.org/utilities/kate/-/merge_requests/120
Fixed with https://invent.kde.org/utilities/kate/-/commit/8abfd5105ddc2185009b3e203698859525b150ae - thanks for the patch!