substructing a diff in caretPos to support connected languages
Some languages, such as arabic or persian, have characters that automatically connect to each other. example: ىىىىىىىىىىىىىىىىىىىىىىىىى while each letter separated is: ى ى ى ى ى ى. that makes the mirror div look like that, seperated in the middle where the caret position is: ىىىىىىىىىىىىى ىىىىىىىىىىىى and causing the 'caretPos' method return false results.
My changes are: adding another mirror div, "mirrorfull", this time a full one without the caret span in the middle, subtracting the width of mirrorfull and mirror to result the difference caused because of the caret span.
That's great. But can we only turn this on for dir=rtl?
That would cover all the Arabic alphabet languages. Not sure if that's the best practice, since it might be happening with some asian or african LTR languages or with accent marks and diacritics... And not all RTL languages have connected chars.
And also, you can use such arabic chars also when the textarea is set to LTR.
The only problem is adding another mirror is taxing on performance. It's already a bit performance intensive (try it on a mobile device).
Another option is passing a flag to the plugin. Thoughts?
Well assuming that in utf8 there is a small amount of connected chars with different width on connection, another option would be to do a one time check of all possible chars in UTF8 and save an array of them in the code - and activate the second mirror mechanism only when spotted one of this chars.
Hey sorry this pull request got stale, are you still interested in getting this in?
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.