custom keyboard and rightToLeft direction

I'm developping a hebrew custom keyboard (the way the wovels are handled in the apple hebrew keyboard is not satisfying for me).

As the hebrew language is from right to left, I expect that when I type a letter the cursor position moves to the left of the text, but it is not the case: it stays on the right, while new typed caharcters will be correctly positionned (on the left of the last character).

if I manually position the cursor on the left of the last character entered (using adjustTextPosition of textDocumentProxy) the next character whill not be on the left position, as expected but on the right position.

how can I fix the problem, and have the cursor on the left after typing a character?