Arabic diacritics make the letters after them triggerable in Auto-Replace Topic is solved

Report problems with documented functionality
barkoosh
Posts: 6
Joined: 12 Apr 2017, 01:16

Arabic diacritics make the letters after them triggerable in Auto-Replace

12 Apr 2017, 01:46

Hello

Arabic language has diacritics which are some sort of short vowels. When used, they appear above or under the letters. On keyboards, they are typed with SHIFT. (Their unicode character codes are: 064B, 064C, 064D, 064E, 064F, 0650, 0651, 0652) The problem is that if a word has a diacritic, AHK considers the letters after it as if they are a new word and triggers an Auto-Replace.

Here's an example. If I have the following hotstring in my AHK script:
::اح::مع جزيل الاحترام
(which replaces اح with مع جزيل الاحترام)
AHK won't trigger an Auto-Replace if I type an ending character after the word سياح which has no diacritics, but it will after سيّاح. (That's because there's a diacritic above the second letter to the right, followed by اح).

Is there a way to avoid this?
PS: Breevy has the same problem.

Thanks
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: Arabic diacritics make the letters after them triggerable in Auto-Replace

13 Apr 2017, 03:31

I think that I would need to modify the hotstring recogniser to check for non-spacing marks. I suppose that if a hotstring trigger is directly preceded by a non-spacing mark, that effectively modifies the (appearance of the) trigger's first character, so it should be treated as a different word.

If there is a hotstring trigger starting with a non-spacing mark, and an alphanumeric character is typed before it, it should already be correctly recognised as within another word. (The hotstring recogniser only checks the preceding character, not the first character of the hotstring trigger. Rather than "inside a word", it's "touching a word".)

I'm not really sure whether this change would be correct for all non-spacing marks, or all non-spacing diacritic marks, or neither, as I know very little about the use of non-spacing marks in any language.

This should produce the same result as the check internal to the hotstring recogniser (requires Unicode):

Code: Select all

; c := chr(0x62d)
c := chr(0x651)
StringCaseSense Locale
if c is alnum
    MsgBox alnum
else
    MsgBox not alnum
StringCaseSense Locale causes if var is type to use the "locale-friendly" IsCharAlphaNumeric function, which is actually independent of locale; i.e. I believe it produces the same results on every system, regardless of locale settings.

This shows how we can classify the character (Ctype 3 shows 0x0003, a combination of C3_NONSPACING and C3_DIACRITIC- see MSDN):

Code: Select all

c := 0x651
o := chr(c)
Loop 3
    if DllCall("GetStringTypeW", "uint", 1<<(A_Index-1), "int*", c, "int", 1, "int*", t)
        o .= format("`nCtype {}: 0x{:04x}", A_Index, t)
MsgBox % o
(This code is for information only; I do not think you can use it to solve your problem.)
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: Arabic diacritics make the letters after them triggerable in Auto-Replace

13 May 2017, 02:58

Please try this test build and let me know whether it solves the problem.
barkoosh
Posts: 6
Joined: 12 Apr 2017, 01:16

Re: Arabic diacritics make the letters after them triggerable in Auto-Replace  Topic is solved

15 May 2017, 12:44

The test build works perfectly. All the Arabic diacritics have no effect on Auto-Replace. They are now recognized as within the word.

Thanks a lot lexikos.

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 20 guests