Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

substructing a diff in caretPos to support connected languages #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ilanbm
Copy link

@ilanbm ilanbm commented Aug 28, 2013

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.

@amasad
Copy link
Contributor

amasad commented Aug 30, 2013

That's great. But can we only turn this on for dir=rtl?

@ilanbm
Copy link
Author

ilanbm commented Aug 30, 2013

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.

@amasad
Copy link
Contributor

amasad commented Aug 30, 2013

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?

@ilanbm
Copy link
Author

ilanbm commented Aug 31, 2013

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.

@amasad
Copy link
Contributor

amasad commented Apr 19, 2014

Hey sorry this pull request got stale, are you still interested in getting this in?

@CLAassistant
Copy link

CLAassistant commented Nov 11, 2019

CLA assistant check
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants