*** empty log message ***
authornisikimi <nisikimi>
Thu, 10 Sep 2009 08:33:44 +0000 (08:33 +0000)
committernisikimi <nisikimi>
Thu, 10 Sep 2009 08:33:44 +0000 (08:33 +0000)
MIM/si-wijesekera.mimx

index 3fec74e..145cdaa 100644 (file)
@@ -6,9 +6,19 @@
   </tags>
   <description>Sinhala input method based on SLS 1134 Rev. 2:2004.
   &lt;http://www.fonts.lk/doc/sin-kbd-layout4.pdf&gt;
-This input method requires surrounding text support.
+This input method uses surrounding text if possible, or a preedit
+buffer otherwise.
 </description>
   <title>සි</title>
+  <variable-list>
+    <variable id="use-surrounding-text">
+      <description>
+      <get-text>Surrounding text vs. preedit If 1, try to use surrounding text.  Otherwise, use preedit.</get-text>
+    </description><value type="integer">1</value><variable-value-candidate>
+      <c-value type="integer">1</c-value>
+      <c-value type="integer">0</c-value>
+    </variable-value-candidate></variable>
+  </variable-list>
   <macro-list>
     <macro id="macro-forward">
       <set id="cc3">
@@ -124,1514 +134,2376 @@ This input method requires surrounding text support.
     </macro>
   </macro-list>
   <map-list>
-    <map id="map-consonant">
+    <map id="map-starter">
       <rule>
-        <keyseq keys="l"/>
-        <insert string="ක"/>
+        <keyseq keys="A"/>
       </rule>
       <rule>
-        <keyseq keys="L"/>
-        <insert string="ඛ"/>
+        <keyseq keys="B"/>
       </rule>
       <rule>
-        <keyseq keys="."/>
-        <insert string="ග"/>
+        <keyseq keys="C"/>
       </rule>
       <rule>
-        <keyseq keys="&gt;"/>
-        <insert string="ඝ"/>
+        <keyseq keys="D"/>
       </rule>
       <rule>
-        <keyseq keys="X"/>
-        <insert string="ඞ"/>
+        <keyseq keys="E"/>
       </rule>
       <rule>
-        <keyseq>
-          <key-event>A-.</key-event>
-        </keyseq>
-        <insert string="ඟ"/>
+        <keyseq keys="F"/>
       </rule>
       <rule>
-        <keyseq keys="p"/>
-        <insert string="ච"/>
+        <keyseq keys="G"/>
       </rule>
       <rule>
-        <keyseq keys="P"/>
-        <insert string="ඡ"/>
+        <keyseq keys="H"/>
       </rule>
       <rule>
-        <keyseq keys="c"/>
-        <insert string="ජ"/>
+        <keyseq keys="I"/>
       </rule>
       <rule>
-        <keyseq keys="C"/>
-        <insert string="ඣ"/>
+        <keyseq keys="J"/>
       </rule>
       <rule>
-        <keyseq keys="["/>
-        <insert string="ඤ"/>
+        <keyseq keys="K"/>
       </rule>
       <rule>
-        <keyseq keys="{"/>
-        <insert string="ඥ"/>
+        <keyseq keys="L"/>
       </rule>
       <rule>
-        <keyseq>
-          <key-event>A-c</key-event>
-        </keyseq>
-        <insert string="ඦ"/>
+        <keyseq keys="M"/>
       </rule>
       <rule>
-        <keyseq keys="g"/>
-        <insert string="ට"/>
+        <keyseq keys="N"/>
       </rule>
       <rule>
-        <keyseq keys="G"/>
-        <insert string="ඨ"/>
+        <keyseq keys="O"/>
       </rule>
       <rule>
-        <keyseq keys="v"/>
-        <insert string="ඩ"/>
+        <keyseq keys="P"/>
       </rule>
       <rule>
-        <keyseq keys="V"/>
-        <insert string="ඪ"/>
+        <keyseq keys="Q"/>
       </rule>
       <rule>
-        <keyseq keys="K"/>
-        <insert string="ණ"/>
+        <keyseq keys="R"/>
       </rule>
       <rule>
-        <keyseq>
-          <key-event>A-v</key-event>
-        </keyseq>
-        <insert string="ඬ"/>
+        <keyseq keys="S"/>
       </rule>
       <rule>
-        <keyseq keys=";"/>
-        <insert string="ත"/>
+        <keyseq keys="T"/>
       </rule>
       <rule>
-        <keyseq keys=":"/>
-        <insert string="ථ"/>
+        <keyseq keys="U"/>
       </rule>
       <rule>
-        <keyseq keys="o"/>
-        <insert string="ද"/>
+        <keyseq keys="V"/>
       </rule>
       <rule>
-        <keyseq keys="O"/>
-        <insert string="ධ"/>
+        <keyseq keys="W"/>
       </rule>
       <rule>
-        <keyseq keys="k"/>
-        <insert string="න"/>
+        <keyseq keys="X"/>
       </rule>
       <rule>
-        <keyseq>
-          <key-event>A-o</key-event>
-        </keyseq>
-        <insert string="ඳ"/>
+        <keyseq keys="Y"/>
       </rule>
       <rule>
-        <keyseq keys="m"/>
-        <insert string="ප"/>
+        <keyseq keys="Z"/>
       </rule>
       <rule>
-        <keyseq keys="M"/>
-        <insert string="ඵ"/>
+        <keyseq keys="a"/>
       </rule>
       <rule>
-        <keyseq keys="n"/>
-        <insert string="බ"/>
+        <keyseq keys="b"/>
       </rule>
       <rule>
-        <keyseq keys="N"/>
-        <insert string="භ"/>
+        <keyseq keys="c"/>
       </rule>
       <rule>
-        <keyseq keys="u"/>
-        <insert string="ම"/>
+        <keyseq keys="d"/>
       </rule>
       <rule>
-        <keyseq keys="U"/>
-        <insert string="ඹ"/>
+        <keyseq keys="e"/>
       </rule>
       <rule>
-        <keyseq keys="h"/>
-        <insert string="ය"/>
+        <keyseq keys="f"/>
       </rule>
       <rule>
-        <keyseq keys="r"/>
-        <insert string="ර"/>
+        <keyseq keys="g"/>
       </rule>
       <rule>
-        <keyseq keys=","/>
-        <insert string="ල"/>
+        <keyseq keys="h"/>
       </rule>
       <rule>
-        <keyseq keys="j"/>
-        <insert string="ව"/>
+        <keyseq keys="i"/>
       </rule>
       <rule>
-        <keyseq keys="Y"/>
-        <insert string="ශ"/>
+        <keyseq keys="j"/>
       </rule>
       <rule>
-        <keyseq keys="I"/>
-        <insert string="ෂ"/>
+        <keyseq keys="k"/>
       </rule>
       <rule>
-        <keyseq keys="i"/>
-        <insert string="ස"/>
+        <keyseq keys="l"/>
       </rule>
       <rule>
-        <keyseq keys="y"/>
-        <insert string="හ"/>
+        <keyseq keys="m"/>
       </rule>
       <rule>
-        <keyseq keys="&lt;"/>
-        <insert string="ළ"/>
+        <keyseq keys="n"/>
       </rule>
       <rule>
-        <keyseq keys="F"/>
-        <insert string="ෆ"/>
+        <keyseq keys="o"/>
       </rule>
-    </map>
-    <map id="map-misc">
       <rule>
-        <keyseq keys="x"/>
-        <insert string="ං"/>
+        <keyseq keys="p"/>
       </rule>
       <rule>
-        <keyseq>
-          <key-event>A-x</key-event>
-        </keyseq>
-        <insert string="ඃ"/>
+        <keyseq keys="q"/>
       </rule>
       <rule>
-        <keyseq keys="w"/>
-        <insert string="අ"/>
+        <keyseq keys="r"/>
       </rule>
       <rule>
-        <keyseq keys="b"/>
-        <insert string="ඉ"/>
+        <keyseq keys="s"/>
       </rule>
       <rule>
-        <keyseq keys="B"/>
-        <insert string="ඊ"/>
+        <keyseq keys="t"/>
       </rule>
       <rule>
-        <keyseq keys="W"/>
-        <insert string="උ"/>
+        <keyseq keys="u"/>
       </rule>
       <rule>
-        <keyseq keys="R"/>
-        <insert string="ඍ"/>
+        <keyseq keys="v"/>
       </rule>
       <rule>
-        <keyseq>
-          <key-event>A-,</key-event>
-        </keyseq>
-        <insert string="ඏ"/>
+        <keyseq keys="w"/>
       </rule>
       <rule>
-        <keyseq keys="T"/>
-        <insert string="ඔ"/>
+        <keyseq keys="x"/>
       </rule>
       <rule>
-        <keyseq keys="s"/>
-        <insert string="ි"/>
+        <keyseq keys="y"/>
       </rule>
       <rule>
-        <keyseq keys="S"/>
-        <insert string="ී"/>
+        <keyseq keys="z"/>
       </rule>
       <rule>
-        <keyseq keys="q"/>
-        <insert string="ු"/>
+        <keyseq keys="`"/>
       </rule>
       <rule>
-        <keyseq keys="Q"/>
-        <insert string="ූ"/>
+        <keyseq keys="~"/>
       </rule>
       <rule>
-        <keyseq>
-          <key-event>A-a</key-event>
-        </keyseq>
-        <insert string="ෳ"/>
+        <keyseq keys="["/>
       </rule>
       <rule>
-        <keyseq>
-          <key-event>A-'</key-event>
-        </keyseq>
-        <insert string="෴"/>
+        <keyseq keys="{"/>
       </rule>
       <rule>
         <keyseq keys="]"/>
-        <insert string=";"/>
       </rule>
       <rule>
         <keyseq keys="}"/>
-        <insert string=":"/>
+      </rule>
+      <rule>
+        <keyseq keys="\"/>
+      </rule>
+      <rule>
+        <keyseq keys="|"/>
+      </rule>
+      <rule>
+        <keyseq keys=";"/>
+      </rule>
+      <rule>
+        <keyseq keys=":"/>
       </rule>
       <rule>
         <keyseq keys="&apos;"/>
-        <insert string="."/>
       </rule>
       <rule>
         <keyseq keys="&quot;"/>
-        <insert string=","/>
       </rule>
       <rule>
-        <keyseq keys="z"/>
-        <insert string="&apos;"/>
+        <keyseq keys=","/>
       </rule>
       <rule>
-        <keyseq keys="Z"/>
-        <insert string="&quot;"/>
+        <keyseq keys="&lt;"/>
       </rule>
       <rule>
-        <keyseq keys="|"/>
-        <insert string="‍්"/>
+        <keyseq keys="."/>
       </rule>
       <rule>
-        <keyseq keys="J"/>
-        <insert string="ළු"/>
+        <keyseq keys="&gt;"/>
+      </rule>
+      <rule>
+        <keyseq>
+          <key-event>A-o</key-event>
+        </keyseq>
+      </rule>
+      <rule>
+        <keyseq>
+          <key-event>A-.</key-event>
+        </keyseq>
+      </rule>
+      <rule>
+        <keyseq>
+          <key-event>A-v</key-event>
+        </keyseq>
+      </rule>
+      <rule>
+        <keyseq>
+          <key-event>A-c</key-event>
+        </keyseq>
+      </rule>
+      <rule>
+        <keyseq>
+          <key-event>A-x</key-event>
+        </keyseq>
       </rule>
       <rule>
         <keyseq>
           <key-event>S- </key-event>
         </keyseq>
-        <insert string=" "/>
       </rule>
       <rule>
         <keyseq>
           <key-event>A- </key-event>
         </keyseq>
-        <insert string="‌"/>
       </rule>
       <rule>
-        <keyseq keys="t"/>
-        <set id="c">
-          <predefined-nth-previous-or-following-character position="-2"/>
-        </set>
-        <conditional>
-          <case>
-            <expr operator="=">
-              <predefined-nth-previous-or-following-character position="-1"/>
-              <int-val>0x0DD9</int-val>
-            </expr>
-            <conditional>
-              <case>
-                <expr operator="=">
-                  <variable-reference id="c"/>
-                  <int-val>0x200C</int-val>
-                </expr>
-                <delete-n-characters n="-2"/>
-                <insert character="0x0D93"/>
-              </case>
-              <case>
-                <expr operator="|">
-                  <expr operator="&lt;">
-                    <variable-reference id="c"/>
-                    <int-val>0x0D9A</int-val>
-                  </expr>
-                  <expr operator="&gt;">
-                    <variable-reference id="c"/>
-                    <int-val>0x0DC6</int-val>
-                  </expr>
-                </expr>
-                <delete-n-characters n="-1"/>
-                <insert character="0x0D93"/>
-              </case>
-              <case>
-                <int-val>1</int-val>
-                <insert character="0x0D91"/>
-              </case>
-            </conditional>
-          </case>
-          <case>
-            <int-val>1</int-val>
-            <insert character="0x0D91"/>
-          </case>
-        </conditional>
+        <keyseq>
+          <key-event>A-,</key-event>
+        </keyseq>
       </rule>
       <rule>
-        <keyseq keys="a"/>
-        <set id="c">
-          <predefined-nth-previous-or-following-character position="-1"/>
-        </set>
-        <conditional>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0D91</int-val>
-            </expr>
-            <delete-n-characters n="-1"/>
-            <insert character="0x0D92"/>
-          </case>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0D94</int-val>
-            </expr>
-            <delete-n-characters n="-1"/>
-            <insert character="0x0D95"/>
-          </case>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0DD9</int-val>
-            </expr>
-            <delete-n-characters n="-1"/>
-            <insert character="0x0DDA"/>
-          </case>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0DDC</int-val>
-            </expr>
-            <delete-n-characters n="-1"/>
-            <insert character="0x0DDD"/>
-          </case>
-          <case>
-            <int-val>1</int-val>
-            <insert character="0x0DCA"/>
-          </case>
-        </conditional>
+        <keyseq>
+          <key-event>A-a</key-event>
+        </keyseq>
       </rule>
       <rule>
-        <keyseq keys="d"/>
-        <set id="c">
-          <predefined-nth-previous-or-following-character position="-1"/>
-        </set>
-        <conditional>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0D85</int-val>
-            </expr>
-            <delete-n-characters n="-1"/>
-            <insert character="0x0D86"/>
-          </case>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0DD9</int-val>
-            </expr>
-            <delete-n-characters n="-1"/>
-            <insert character="0x0DDC"/>
-          </case>
-          <case>
-            <int-val>1</int-val>
-            <insert character="0x0DCF"/>
-          </case>
-        </conditional>
+        <keyseq>
+          <key-event>A-'</key-event>
+        </keyseq>
       </rule>
       <rule>
-        <keyseq keys="e"/>
-        <conditional>
-          <case>
-            <expr operator="=">
-              <predefined-nth-previous-or-following-character position="-1"/>
-              <int-val>0x0D85</int-val>
-            </expr>
-            <delete-n-characters n="-1"/>
-            <insert character="0x0D87"/>
-          </case>
-          <case>
-            <int-val>1</int-val>
-            <insert character="0x0DD0"/>
-          </case>
-        </conditional>
+        <keyseq>
+          <key-event>A-z</key-event>
+        </keyseq>
       </rule>
       <rule>
-        <keyseq keys="E"/>
-        <set id="c">
-          <predefined-nth-previous-or-following-character position="-1"/>
-        </set>
-        <conditional>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0D85</int-val>
-            </expr>
-            <delete-n-characters n="-1"/>
-            <insert character="0x0D88"/>
-          </case>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0DD4</int-val>
-            </expr>
-            <conditional>
-              <case>
-                <expr operator="=">
-                  <predefined-nth-previous-or-following-character position="-2"/>
-                  <int-val>0x0DC5</int-val>
-                </expr>
-                <delete-n-characters n="-1"/>
-                <insert character="0x0DD6"/>
-              </case>
-              <case>
-                <int-val>1</int-val>
-                <insert character="0x0DD1"/>
-              </case>
-            </conditional>
-          </case>
-          <case>
-            <int-val>1</int-val>
-            <insert character="0x0DD1"/>
-          </case>
-        </conditional>
+        <keyseq>
+          <key-event>BackSpace</key-event>
+        </keyseq>
       </rule>
       <rule>
-        <keyseq keys="D"/>
-        <set id="c">
-          <predefined-nth-previous-or-following-character position="-1"/>
-        </set>
-        <conditional>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0D8D</int-val>
-            </expr>
-            <delete-n-characters n="-1"/>
-            <insert character="0x0D8E"/>
-          </case>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0DD8</int-val>
-            </expr>
-            <delete-n-characters n="-1"/>
-            <insert character="0x0DF2"/>
-          </case>
-          <case>
-            <int-val>1</int-val>
-            <insert character="0x0DD8"/>
-          </case>
-        </conditional>
+        <keyseq>
+          <key-event>Delete</key-event>
+        </keyseq>
       </rule>
+    </map>
+    <map id="map-consonant">
       <rule>
-        <keyseq keys="A"/>
-        <set id="c">
-          <predefined-nth-previous-or-following-character position="-1"/>
-        </set>
-        <conditional>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0D8B</int-val>
-            </expr>
-            <delete-n-characters n="-1"/>
-            <insert character="0x0D8C"/>
-          </case>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0D8F</int-val>
-            </expr>
-            <delete-n-characters n="-1"/>
-            <insert character="0x0D90"/>
-          </case>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0D94</int-val>
-            </expr>
-            <delete-n-characters n="-1"/>
-            <insert character="0x0D96"/>
-          </case>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0DD9</int-val>
-            </expr>
-            <delete-n-characters n="-1"/>
-            <insert character="0x0DDE"/>
-          </case>
-          <case>
-            <int-val>1</int-val>
-            <insert character="0x0DDF"/>
-          </case>
-        </conditional>
+        <keyseq keys="l"/>
+        <insert string="ක"/>
       </rule>
       <rule>
-        <keyseq keys="f"/>
-        <set id="c">
-          <predefined-nth-previous-or-following-character position="+1"/>
-        </set>
-        <conditional>
-          <case>
-            <expr operator="&amp;">
-              <expr operator="&gt;=">
-                <variable-reference id="c"/>
-                <int-val>0x0D9A</int-val>
-              </expr>
-              <expr operator="&lt;=">
-                <variable-reference id="c"/>
-                <int-val>0x0DC6</int-val>
-              </expr>
-            </expr>
-            <delete-n-characters n="+1"/>
-            <insert character-or-string="variable">
-              <variable-reference id="c"/>
-            </insert>
-            <macro-reference id="macro-forward"/>
-            <set id="c">
-              <predefined-nth-previous-or-following-character position="+1"/>
-            </set>
-            <conditional>
-              <case>
-                <expr operator="=">
-                  <variable-reference id="c"/>
-                  <int-val>0x0DCA</int-val>
-                </expr>
-                <delete-n-characters n="+1"/>
-                <insert character="0x0DDA"/>
-              </case>
-              <case>
-                <expr operator="=">
-                  <variable-reference id="c"/>
-                  <int-val>0x0DD9</int-val>
-                </expr>
-                <delete-n-characters n="+1"/>
-                <insert character="0x0DDB"/>
-              </case>
-              <case>
-                <expr operator="=">
-                  <variable-reference id="c"/>
-                  <int-val>0x0DCF</int-val>
-                </expr>
-                <delete-n-characters n="+1"/>
-                <insert character="0x0DDC"/>
-              </case>
-              <case>
-                <expr operator="=">
-                  <variable-reference id="c"/>
-                  <int-val>0x0DDF</int-val>
-                </expr>
-                <delete-n-characters n="+1"/>
-                <insert character="0x0DDE"/>
-              </case>
-              <case>
-                <int-val>1</int-val>
-                <insert character="0x0DD9"/>
-              </case>
-            </conditional>
-          </case>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0D91</int-val>
-            </expr>
-            <delete-n-characters n="+1"/>
-            <insert character="0x0D93"/>
-          </case>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0DD9</int-val>
-            </expr>
-            <delete-n-characters n="+1"/>
-            <insert character="0x0DDB"/>
-          </case>
-          <case>
-            <expr operator="&amp;">
-              <expr operator="=">
-                <variable-reference id="c"/>
-                <int-val>0x200C</int-val>
-              </expr>
-              <expr operator="=">
-                <predefined-nth-previous-or-following-character position="+2"/>
-                <int-val>0x0DD9</int-val>
-              </expr>
-            </expr>
-            <delete-n-characters n="+2"/>
-            <insert character="0x200C"/>
-            <insert character="0x0DDB"/>
-          </case>
-          <case>
-            <expr operator="&amp;">
-              <expr operator="=">
-                <predefined-nth-previous-or-following-character position="-1"/>
-                <int-val>0x0DD9</int-val>
-              </expr>
-              <expr operator="|">
-                <expr operator="&lt;">
-                  <predefined-nth-previous-or-following-character position="-2"/>
-                  <int-val>0x0D9A</int-val>
-                </expr>
-                <expr operator="&gt;">
-                  <predefined-nth-previous-or-following-character position="-2"/>
-                  <int-val>0x0DC6</int-val>
-                </expr>
-              </expr>
-            </expr>
-            <delete-n-characters n="-1"/>
-            <insert character="0x0DDB"/>
-          </case>
-          <case>
-            <expr operator="&amp;">
-              <expr operator="&gt;=">
-                <predefined-nth-previous-or-following-character position="-1"/>
-                <int-val>0x0D9A</int-val>
-              </expr>
-              <expr operator="&lt;=">
-                <predefined-nth-previous-or-following-character position="-1"/>
-                <int-val>0x0DC6</int-val>
-              </expr>
-            </expr>
-            <insert character="0x200C"/>
-            <insert character="0x0DD9"/>
-          </case>
-          <case>
-            <int-val>1</int-val>
-            <insert character="0x0DD9"/>
-          </case>
-        </conditional>
+        <keyseq keys="L"/>
+        <insert string="ඛ"/>
+      </rule>
+      <rule>
+        <keyseq keys="."/>
+        <insert string="ග"/>
+      </rule>
+      <rule>
+        <keyseq keys="&gt;"/>
+        <insert string="ඝ"/>
+      </rule>
+      <rule>
+        <keyseq keys="X"/>
+        <insert string="ඞ"/>
       </rule>
       <rule>
         <keyseq>
-          <key-event>A-z</key-event>
+          <key-event>A-.</key-event>
         </keyseq>
-        <set id="c">
-          <predefined-nth-previous-or-following-character position="-1"/>
-        </set>
-        <conditional>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0DAF</int-val>
-            </expr>
-            <delete-n-characters n="-1"/>
-            <insert character="0x0DB3"/>
-          </case>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0D9C</int-val>
-            </expr>
-            <delete-n-characters n="-1"/>
-            <insert character="0x0D9F"/>
-          </case>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0DA9</int-val>
-            </expr>
-            <delete-n-characters n="-1"/>
-            <insert character="0x0DAC"/>
-          </case>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0DA2</int-val>
-            </expr>
-            <delete-n-characters n="-1"/>
-            <insert character="0x0DA6"/>
-          </case>
-        </conditional>
+        <insert string="ඟ"/>
       </rule>
       <rule>
-        <keyseq keys="H"/>
-        <set id="c">
-          <predefined-nth-previous-or-following-character position="-1"/>
-        </set>
-        <conditional>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0DD9</int-val>
-            </expr>
-            <delete-n-characters n="-1"/>
-          </case>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0DDB</int-val>
-            </expr>
-            <delete-n-characters n="-1"/>
-          </case>
-          <case>
-            <int-val>1</int-val>
-            <set id="c">
-              <int-val>0</int-val>
-            </set>
-          </case>
-        </conditional>
-        <conditional>
-          <case>
-            <expr operator="&amp;">
-              <expr operator="&gt;=">
-                <predefined-nth-previous-or-following-character position="-1"/>
-                <int-val>0x0D9A</int-val>
-              </expr>
-              <expr operator="&lt;=">
-                <predefined-nth-previous-or-following-character position="-1"/>
-                <int-val>0x0DC6</int-val>
-              </expr>
-            </expr>
-            <insert character="0x0DCA"/>
-            <insert character="0x200D"/>
-            <insert character="0x0DBA"/>
-          </case>
-        </conditional>
-        <conditional>
-          <case>
-            <expr operator="&gt;">
-              <variable-reference id="c"/>
-              <int-val>0</int-val>
-            </expr>
-            <insert character-or-string="variable">
-              <variable-reference id="c"/>
-            </insert>
-          </case>
-        </conditional>
+        <keyseq keys="p"/>
+        <insert string="ච"/>
       </rule>
       <rule>
-        <keyseq keys="`"/>
-        <set id="c">
-          <predefined-nth-previous-or-following-character position="-1"/>
-        </set>
-        <conditional>
-          <case>
-            <expr operator="|">
-              <expr operator="=">
-                <variable-reference id="c"/>
-                <int-val>0x0DD9</int-val>
-              </expr>
-              <expr operator="=">
-                <variable-reference id="c"/>
-                <int-val>0x0DDB</int-val>
-              </expr>
-              <expr operator="=">
-                <variable-reference id="c"/>
-                <int-val>0x0DD2</int-val>
-              </expr>
-              <expr operator="=">
-                <variable-reference id="c"/>
-                <int-val>0x0DD3</int-val>
-              </expr>
-            </expr>
-            <delete-n-characters n="-1"/>
-          </case>
-          <case>
-            <int-val>1</int-val>
-            <set id="c">
-              <int-val>0</int-val>
-            </set>
-          </case>
-        </conditional>
-        <conditional>
-          <case>
-            <expr operator="&amp;">
-              <expr operator="&gt;=">
-                <predefined-nth-previous-or-following-character position="-1"/>
-                <int-val>0x0D9A</int-val>
-              </expr>
-              <expr operator="&lt;=">
-                <predefined-nth-previous-or-following-character position="-1"/>
-                <int-val>0x0DC6</int-val>
-              </expr>
-            </expr>
-            <insert character="0x0DCA"/>
-            <insert character="0x200D"/>
-            <insert character="0x0DBB"/>
-          </case>
-        </conditional>
-        <conditional>
-          <case>
-            <expr operator="&gt;">
-              <variable-reference id="c"/>
-              <int-val>0</int-val>
-            </expr>
-            <insert character-or-string="variable">
-              <variable-reference id="c"/>
-            </insert>
-          </case>
-        </conditional>
+        <keyseq keys="P"/>
+        <insert string="ඡ"/>
       </rule>
       <rule>
-        <keyseq keys="~"/>
-        <set id="c">
-          <predefined-nth-previous-or-following-character position="-1"/>
-        </set>
-        <conditional>
-          <case>
-            <expr operator="|">
-              <expr operator="=">
-                <variable-reference id="c"/>
-                <int-val>0x0DD9</int-val>
-              </expr>
-              <expr operator="=">
-                <variable-reference id="c"/>
-                <int-val>0x0DDB</int-val>
-              </expr>
-            </expr>
-            <delete-n-characters n="-1"/>
-          </case>
-          <case>
-            <int-val>1</int-val>
-            <set id="c">
-              <int-val>0</int-val>
-            </set>
-          </case>
-        </conditional>
-        <macro-reference id="macro-backward"/>
-        <conditional>
-          <case>
-            <expr operator="&amp;">
-              <expr operator="&gt;=">
-                <predefined-nth-previous-or-following-character position="-1"/>
-                <int-val>0x0D9A</int-val>
-              </expr>
-              <expr operator="&lt;=">
-                <predefined-nth-previous-or-following-character position="-1"/>
-                <int-val>0x0DC6</int-val>
-              </expr>
-            </expr>
-            <set id="c1">
-              <predefined-nth-previous-or-following-character position="-1"/>
-            </set>
-            <delete-n-characters n="-1"/>
-            <insert character-or-string="variable">
-              <variable-reference id="c1"/>
-            </insert>
-            <move-to-marker position="@first"/>
-            <insert character="0x0DBB"/>
-            <insert character="0x0DCA"/>
-            <insert character="0x200D"/>
-          </case>
-        </conditional>
-        <conditional>
-          <case>
-            <expr operator="&gt;">
-              <variable-reference id="c"/>
-              <int-val>0</int-val>
-            </expr>
-            <move-to-marker position="@last"/>
-            <insert character-or-string="variable">
-              <variable-reference id="c"/>
-            </insert>
-          </case>
-        </conditional>
+        <keyseq keys="c"/>
+        <insert string="ජ"/>
+      </rule>
+      <rule>
+        <keyseq keys="C"/>
+        <insert string="ඣ"/>
+      </rule>
+      <rule>
+        <keyseq keys="["/>
+        <insert string="ඤ"/>
+      </rule>
+      <rule>
+        <keyseq keys="{"/>
+        <insert string="ඥ"/>
       </rule>
       <rule>
         <keyseq>
-          <key-event>BackSpace</key-event>
+          <key-event>A-c</key-event>
         </keyseq>
-        <macro-reference id="macro-delete-preceding-zw"/>
-        <set id="c">
-          <predefined-nth-previous-or-following-character position="-1"/>
-        </set>
-        <conditional>
-          <case>
-            <expr operator="&lt;">
-              <variable-reference id="c"/>
-              <int-val>0</int-val>
-            </expr>
-            <unhandle/>
-          </case>
-        </conditional>
-        <delete-n-characters n="-1"/>
-        <conditional>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0D86</int-val>
-            </expr>
-            <insert character="0x0D85"/>
-          </case>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0D87</int-val>
-            </expr>
-            <insert character="0x0D85"/>
-          </case>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0D88</int-val>
-            </expr>
-            <insert character="0x0D85"/>
-          </case>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0D8C</int-val>
-            </expr>
-            <insert character="0x0D8B"/>
-          </case>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0D8E</int-val>
-            </expr>
-            <insert character="0x0D8D"/>
-          </case>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0D90</int-val>
-            </expr>
-            <insert character="0x0D8F"/>
-          </case>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0D92</int-val>
-            </expr>
-            <insert character="0x0D8F"/>
-          </case>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0D93</int-val>
-            </expr>
-            <conditional>
-              <case>
-                <expr operator="&amp;">
-                  <expr operator="&gt;=">
-                    <predefined-nth-previous-or-following-character position="-1"/>
-                    <int-val>0x0D9A</int-val>
-                  </expr>
-                  <expr operator="&lt;=">
-                    <predefined-nth-previous-or-following-character position="-1"/>
-                    <int-val>0x0DC6</int-val>
-                  </expr>
-                </expr>
-                <insert character="0x200C"/>
-              </case>
-            </conditional>
-            <insert character="0x0DD9"/>
-          </case>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0D95</int-val>
-            </expr>
-            <insert character="0x0D94"/>
-          </case>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0D96</int-val>
-            </expr>
-            <insert character="0x0D94"/>
-          </case>
-          <case>
-            <expr operator="&amp;">
-              <expr operator="&gt;=">
-                <variable-reference id="c"/>
-                <int-val>0x0D9A</int-val>
-              </expr>
-              <expr operator="&lt;=">
-                <variable-reference id="c"/>
-                <int-val>0x0DC6</int-val>
-              </expr>
-              <expr operator="=">
-                <predefined-nth-previous-or-following-character position="-2"/>
-                <int-val>0x0DCA</int-val>
-              </expr>
-              <expr operator="=">
-                <predefined-nth-previous-or-following-character position="-1"/>
-                <int-val>0x200D</int-val>
-              </expr>
-            </expr>
-            <conditional>
-              <case>
-                <expr operator="=">
-                  <predefined-nth-previous-or-following-character position="-3"/>
-                  <int-val>0x0DBB</int-val>
-                </expr>
-                <delete-n-characters n="-3"/>
-                <insert character-or-string="variable">
-                  <variable-reference id="c"/>
-                </insert>
-              </case>
-              <case>
-                <int-val>1</int-val>
-                <delete-n-characters n="-2"/>
-              </case>
-            </conditional>
-          </case>
-          <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0DD9</int-val>
-            </expr>
-            <conditional>
+        <insert string="ඦ"/>
+      </rule>
+      <rule>
+        <keyseq keys="g"/>
+        <insert string="ට"/>
+      </rule>
+      <rule>
+        <keyseq keys="G"/>
+        <insert string="ඨ"/>
+      </rule>
+      <rule>
+        <keyseq keys="v"/>
+        <insert string="ඩ"/>
+      </rule>
+      <rule>
+        <keyseq keys="V"/>
+        <insert string="ඪ"/>
+      </rule>
+      <rule>
+        <keyseq keys="K"/>
+        <insert string="ණ"/>
+      </rule>
+      <rule>
+        <keyseq>
+          <key-event>A-v</key-event>
+        </keyseq>
+        <insert string="ඬ"/>
+      </rule>
+      <rule>
+        <keyseq keys=";"/>
+        <insert string="ත"/>
+      </rule>
+      <rule>
+        <keyseq keys=":"/>
+        <insert string="ථ"/>
+      </rule>
+      <rule>
+        <keyseq keys="o"/>
+        <insert string="ද"/>
+      </rule>
+      <rule>
+        <keyseq keys="O"/>
+        <insert string="ධ"/>
+      </rule>
+      <rule>
+        <keyseq keys="k"/>
+        <insert string="න"/>
+      </rule>
+      <rule>
+        <keyseq>
+          <key-event>A-o</key-event>
+        </keyseq>
+        <insert string="ඳ"/>
+      </rule>
+      <rule>
+        <keyseq keys="m"/>
+        <insert string="ප"/>
+      </rule>
+      <rule>
+        <keyseq keys="M"/>
+        <insert string="ඵ"/>
+      </rule>
+      <rule>
+        <keyseq keys="n"/>
+        <insert string="බ"/>
+      </rule>
+      <rule>
+        <keyseq keys="N"/>
+        <insert string="භ"/>
+      </rule>
+      <rule>
+        <keyseq keys="u"/>
+        <insert string="ම"/>
+      </rule>
+      <rule>
+        <keyseq keys="U"/>
+        <insert string="ඹ"/>
+      </rule>
+      <rule>
+        <keyseq keys="h"/>
+        <insert string="ය"/>
+      </rule>
+      <rule>
+        <keyseq keys="r"/>
+        <insert string="ර"/>
+      </rule>
+      <rule>
+        <keyseq keys=","/>
+        <insert string="ල"/>
+      </rule>
+      <rule>
+        <keyseq keys="j"/>
+        <insert string="ව"/>
+      </rule>
+      <rule>
+        <keyseq keys="Y"/>
+        <insert string="ශ"/>
+      </rule>
+      <rule>
+        <keyseq keys="I"/>
+        <insert string="ෂ"/>
+      </rule>
+      <rule>
+        <keyseq keys="i"/>
+        <insert string="ස"/>
+      </rule>
+      <rule>
+        <keyseq keys="y"/>
+        <insert string="හ"/>
+      </rule>
+      <rule>
+        <keyseq keys="&lt;"/>
+        <insert string="ළ"/>
+      </rule>
+      <rule>
+        <keyseq keys="F"/>
+        <insert string="ෆ"/>
+      </rule>
+    </map>
+    <map id="map-misc">
+      <rule>
+        <keyseq keys="x"/>
+        <insert string="ං"/>
+      </rule>
+      <rule>
+        <keyseq>
+          <key-event>A-x</key-event>
+        </keyseq>
+        <insert string="ඃ"/>
+      </rule>
+      <rule>
+        <keyseq keys="w"/>
+        <insert string="අ"/>
+      </rule>
+      <rule>
+        <keyseq keys="b"/>
+        <insert string="ඉ"/>
+      </rule>
+      <rule>
+        <keyseq keys="B"/>
+        <insert string="ඊ"/>
+      </rule>
+      <rule>
+        <keyseq keys="W"/>
+        <insert string="උ"/>
+      </rule>
+      <rule>
+        <keyseq keys="R"/>
+        <insert string="ඍ"/>
+      </rule>
+      <rule>
+        <keyseq>
+          <key-event>A-,</key-event>
+        </keyseq>
+        <insert string="ඏ"/>
+      </rule>
+      <rule>
+        <keyseq keys="T"/>
+        <insert string="ඔ"/>
+      </rule>
+      <rule>
+        <keyseq keys="s"/>
+        <insert string="ි"/>
+      </rule>
+      <rule>
+        <keyseq keys="S"/>
+        <insert string="ී"/>
+      </rule>
+      <rule>
+        <keyseq keys="q"/>
+        <insert string="ු"/>
+      </rule>
+      <rule>
+        <keyseq keys="Q"/>
+        <insert string="ූ"/>
+      </rule>
+      <rule>
+        <keyseq>
+          <key-event>A-a</key-event>
+        </keyseq>
+        <insert string="ෳ"/>
+      </rule>
+      <rule>
+        <keyseq>
+          <key-event>A-'</key-event>
+        </keyseq>
+        <insert string="෴"/>
+      </rule>
+      <rule>
+        <keyseq keys="]"/>
+        <insert string=";"/>
+      </rule>
+      <rule>
+        <keyseq keys="}"/>
+        <insert string=":"/>
+      </rule>
+      <rule>
+        <keyseq keys="&apos;"/>
+        <insert string="."/>
+      </rule>
+      <rule>
+        <keyseq keys="&quot;"/>
+        <insert string=","/>
+      </rule>
+      <rule>
+        <keyseq keys="z"/>
+        <insert string="&apos;"/>
+      </rule>
+      <rule>
+        <keyseq keys="Z"/>
+        <insert string="&quot;"/>
+      </rule>
+      <rule>
+        <keyseq keys="|"/>
+        <insert string="‍්"/>
+      </rule>
+      <rule>
+        <keyseq keys="J"/>
+        <insert string="ළු"/>
+      </rule>
+      <rule>
+        <keyseq>
+          <key-event>S- </key-event>
+        </keyseq>
+        <insert string=" "/>
+      </rule>
+      <rule>
+        <keyseq>
+          <key-event>A- </key-event>
+        </keyseq>
+        <insert string="‌"/>
+      </rule>
+      <rule>
+        <keyseq keys="t"/>
+        <set id="c">
+          <predefined-nth-previous-or-following-character position="-2"/>
+        </set>
+        <conditional>
+          <case>
+            <expr operator="=">
+              <predefined-nth-previous-or-following-character position="-1"/>
+              <int-val>0x0DD9</int-val>
+            </expr>
+            <conditional>
+              <case>
+                <expr operator="=">
+                  <variable-reference id="c"/>
+                  <int-val>0x200C</int-val>
+                </expr>
+                <delete-n-characters n="-2"/>
+                <insert character="0x0D93"/>
+              </case>
               <case>
                 <expr operator="|">
                   <expr operator="&lt;">
-                    <predefined-nth-previous-or-following-character position="-1"/>
+                    <variable-reference id="c"/>
                     <int-val>0x0D9A</int-val>
                   </expr>
                   <expr operator="&gt;">
-                    <predefined-nth-previous-or-following-character position="-1"/>
+                    <variable-reference id="c"/>
                     <int-val>0x0DC6</int-val>
                   </expr>
                 </expr>
-              </case>
-              <case>
-                <expr operator="=">
-                  <predefined-nth-previous-or-following-character position="+1"/>
-                  <int-val>0x0D91</int-val>
-                </expr>
                 <delete-n-characters n="-1"/>
-                <delete-n-characters n="+1"/>
                 <insert character="0x0D93"/>
               </case>
               <case>
-                <expr operator="&amp;">
-                  <expr operator="&gt;=">
-                    <predefined-nth-previous-or-following-character position="+1"/>
-                    <int-val>0x0D9A</int-val>
-                  </expr>
-                  <expr operator="&lt;=">
-                    <predefined-nth-previous-or-following-character position="+1"/>
-                    <int-val>0x0DC6</int-val>
-                  </expr>
-                </expr>
-                <set id="c1">
-                  <predefined-nth-previous-or-following-character position="+1"/>
-                </set>
-                <conditional>
-                  <case>
-                    <expr operator="=">
-                      <predefined-nth-previous-or-following-character position="+2"/>
-                      <int-val>0x0DD9</int-val>
-                    </expr>
-                    <macro-reference id="macro-merge-kombuva"/>
-                    <insert character="0x0DDB"/>
-                  </case>
-                  <case>
-                    <expr operator="=">
-                      <predefined-nth-previous-or-following-character position="+2"/>
-                      <int-val>0x0DCA</int-val>
-                    </expr>
-                    <macro-reference id="macro-merge-kombuva"/>
-                    <insert character="0x0DDA"/>
-                  </case>
-                  <case>
-                    <expr operator="=">
-                      <predefined-nth-previous-or-following-character position="+2"/>
-                      <int-val>0x0DCF</int-val>
-                    </expr>
-                    <macro-reference id="macro-merge-kombuva"/>
-                    <insert character="0x0DDC"/>
-                  </case>
-                  <case>
-                    <expr operator="=">
-                      <predefined-nth-previous-or-following-character position="+2"/>
-                      <int-val>0x0DDF</int-val>
-                    </expr>
-                    <macro-reference id="macro-merge-kombuva"/>
-                    <insert character="0x0DDE"/>
-                  </case>
-                  <case>
-                    <int-val>1</int-val>
-                    <delete-n-characters n="-1"/>
-                    <delete-n-characters n="+1"/>
-                    <insert character-or-string="variable">
-                      <variable-reference id="c1"/>
-                    </insert>
-                    <insert character="0x0DD9"/>
-                  </case>
-                </conditional>
+                <int-val>1</int-val>
+                <insert character="0x0D91"/>
               </case>
+            </conditional>
+          </case>
+          <case>
+            <int-val>1</int-val>
+            <insert character="0x0D91"/>
+          </case>
+        </conditional>
+      </rule>
+      <rule>
+        <keyseq keys="a"/>
+        <set id="c">
+          <predefined-nth-previous-or-following-character position="-1"/>
+        </set>
+        <conditional>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0D91</int-val>
+            </expr>
+            <delete-n-characters n="-1"/>
+            <insert character="0x0D92"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0D94</int-val>
+            </expr>
+            <delete-n-characters n="-1"/>
+            <insert character="0x0D95"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0DD9</int-val>
+            </expr>
+            <delete-n-characters n="-1"/>
+            <insert character="0x0DDA"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0DDC</int-val>
+            </expr>
+            <delete-n-characters n="-1"/>
+            <insert character="0x0DDD"/>
+          </case>
+          <case>
+            <int-val>1</int-val>
+            <insert character="0x0DCA"/>
+          </case>
+        </conditional>
+      </rule>
+      <rule>
+        <keyseq keys="d"/>
+        <set id="c">
+          <predefined-nth-previous-or-following-character position="-1"/>
+        </set>
+        <conditional>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0D85</int-val>
+            </expr>
+            <delete-n-characters n="-1"/>
+            <insert character="0x0D86"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0DD9</int-val>
+            </expr>
+            <delete-n-characters n="-1"/>
+            <insert character="0x0DDC"/>
+          </case>
+          <case>
+            <int-val>1</int-val>
+            <insert character="0x0DCF"/>
+          </case>
+        </conditional>
+      </rule>
+      <rule>
+        <keyseq keys="e"/>
+        <conditional>
+          <case>
+            <expr operator="=">
+              <predefined-nth-previous-or-following-character position="-1"/>
+              <int-val>0x0D85</int-val>
+            </expr>
+            <delete-n-characters n="-1"/>
+            <insert character="0x0D87"/>
+          </case>
+          <case>
+            <int-val>1</int-val>
+            <insert character="0x0DD0"/>
+          </case>
+        </conditional>
+      </rule>
+      <rule>
+        <keyseq keys="E"/>
+        <set id="c">
+          <predefined-nth-previous-or-following-character position="-1"/>
+        </set>
+        <conditional>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0D85</int-val>
+            </expr>
+            <delete-n-characters n="-1"/>
+            <insert character="0x0D88"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0DD4</int-val>
+            </expr>
+            <conditional>
               <case>
-                <expr operator="&amp;">
-                  <expr operator="&gt;=">
-                    <predefined-nth-previous-or-following-character position="-2"/>
-                    <int-val>0x0D9A</int-val>
-                  </expr>
-                  <expr operator="&lt;=">
-                    <predefined-nth-previous-or-following-character position="-2"/>
-                    <int-val>0x0DC6</int-val>
-                  </expr>
+                <expr operator="=">
+                  <predefined-nth-previous-or-following-character position="-2"/>
+                  <int-val>0x0DC5</int-val>
                 </expr>
                 <delete-n-characters n="-1"/>
-                <insert character="0x200C"/>
-                <insert character="0x0DD9"/>
-              </case>
-              <case>
-                <expr operator="&amp;">
-                  <expr operator="=">
-                    <predefined-nth-previous-or-following-character position="-4"/>
-                    <int-val>0x0DBB</int-val>
-                  </expr>
-                  <expr operator="=">
-                    <predefined-nth-previous-or-following-character position="-3"/>
-                    <int-val>0x0DCA</int-val>
-                  </expr>
-                  <expr operator="=">
-                    <predefined-nth-previous-or-following-character position="-2"/>
-                    <int-val>0x200D</int-val>
-                  </expr>
-                </expr>
-                <set id="c1">
-                  <predefined-nth-previous-or-following-character position="-1"/>
-                </set>
-                <delete-n-characters n="-4"/>
-                <insert character-or-string="variable">
-                  <variable-reference id="c1"/>
-                </insert>
-                <insert character="0x0DD9"/>
-              </case>
-              <case>
-                <expr operator="&amp;">
-                  <expr operator="&gt;=">
-                    <predefined-nth-previous-or-following-character position="-4"/>
-                    <int-val>0x0D9A</int-val>
-                  </expr>
-                  <expr operator="&lt;=">
-                    <predefined-nth-previous-or-following-character position="-4"/>
-                    <int-val>0x0DC6</int-val>
-                  </expr>
-                  <expr operator="=">
-                    <predefined-nth-previous-or-following-character position="-3"/>
-                    <int-val>0x0DCA</int-val>
-                  </expr>
-                  <expr operator="=">
-                    <predefined-nth-previous-or-following-character position="-2"/>
-                    <int-val>0x200D</int-val>
-                  </expr>
-                </expr>
-                <delete-n-characters n="-3"/>
-                <insert character="0x0DD9"/>
+                <insert character="0x0DD6"/>
               </case>
               <case>
                 <int-val>1</int-val>
-                <delete-n-characters n="-1"/>
-                <insert character="0x0DD9"/>
+                <insert character="0x0DD1"/>
               </case>
             </conditional>
           </case>
           <case>
+            <int-val>1</int-val>
+            <insert character="0x0DD1"/>
+          </case>
+        </conditional>
+      </rule>
+      <rule>
+        <keyseq keys="D"/>
+        <set id="c">
+          <predefined-nth-previous-or-following-character position="-1"/>
+        </set>
+        <conditional>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0D8D</int-val>
+            </expr>
+            <delete-n-characters n="-1"/>
+            <insert character="0x0D8E"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0DD8</int-val>
+            </expr>
+            <delete-n-characters n="-1"/>
+            <insert character="0x0DF2"/>
+          </case>
+          <case>
+            <int-val>1</int-val>
+            <insert character="0x0DD8"/>
+          </case>
+        </conditional>
+      </rule>
+      <rule>
+        <keyseq keys="A"/>
+        <set id="c">
+          <predefined-nth-previous-or-following-character position="-1"/>
+        </set>
+        <conditional>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0D8B</int-val>
+            </expr>
+            <delete-n-characters n="-1"/>
+            <insert character="0x0D8C"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0D8F</int-val>
+            </expr>
+            <delete-n-characters n="-1"/>
+            <insert character="0x0D90"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0D94</int-val>
+            </expr>
+            <delete-n-characters n="-1"/>
+            <insert character="0x0D96"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0DD9</int-val>
+            </expr>
+            <delete-n-characters n="-1"/>
+            <insert character="0x0DDE"/>
+          </case>
+          <case>
+            <int-val>1</int-val>
+            <insert character="0x0DDF"/>
+          </case>
+        </conditional>
+      </rule>
+      <rule>
+        <keyseq keys="f"/>
+        <set id="c">
+          <predefined-nth-previous-or-following-character position="+1"/>
+        </set>
+        <conditional>
+          <case>
+            <expr operator="&amp;">
+              <expr operator="&gt;=">
+                <variable-reference id="c"/>
+                <int-val>0x0D9A</int-val>
+              </expr>
+              <expr operator="&lt;=">
+                <variable-reference id="c"/>
+                <int-val>0x0DC6</int-val>
+              </expr>
+            </expr>
+            <delete-n-characters n="+1"/>
+            <insert character-or-string="variable">
+              <variable-reference id="c"/>
+            </insert>
+            <macro-reference id="macro-forward"/>
+            <set id="c">
+              <predefined-nth-previous-or-following-character position="+1"/>
+            </set>
+            <conditional>
+              <case>
+                <expr operator="=">
+                  <variable-reference id="c"/>
+                  <int-val>0x0DCA</int-val>
+                </expr>
+                <delete-n-characters n="+1"/>
+                <insert character="0x0DDA"/>
+              </case>
+              <case>
+                <expr operator="=">
+                  <variable-reference id="c"/>
+                  <int-val>0x0DD9</int-val>
+                </expr>
+                <delete-n-characters n="+1"/>
+                <insert character="0x0DDB"/>
+              </case>
+              <case>
+                <expr operator="=">
+                  <variable-reference id="c"/>
+                  <int-val>0x0DCF</int-val>
+                </expr>
+                <delete-n-characters n="+1"/>
+                <insert character="0x0DDC"/>
+              </case>
+              <case>
+                <expr operator="=">
+                  <variable-reference id="c"/>
+                  <int-val>0x0DDF</int-val>
+                </expr>
+                <delete-n-characters n="+1"/>
+                <insert character="0x0DDE"/>
+              </case>
+              <case>
+                <int-val>1</int-val>
+                <insert character="0x0DD9"/>
+              </case>
+            </conditional>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0D91</int-val>
+            </expr>
+            <delete-n-characters n="+1"/>
+            <insert character="0x0D93"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0DD9</int-val>
+            </expr>
+            <delete-n-characters n="+1"/>
+            <insert character="0x0DDB"/>
+          </case>
+          <case>
+            <expr operator="&amp;">
+              <expr operator="=">
+                <variable-reference id="c"/>
+                <int-val>0x200C</int-val>
+              </expr>
+              <expr operator="=">
+                <predefined-nth-previous-or-following-character position="+2"/>
+                <int-val>0x0DD9</int-val>
+              </expr>
+            </expr>
+            <delete-n-characters n="+2"/>
+            <insert character="0x200C"/>
+            <insert character="0x0DDB"/>
+          </case>
+          <case>
+            <expr operator="&amp;">
+              <expr operator="=">
+                <predefined-nth-previous-or-following-character position="-1"/>
+                <int-val>0x0DD9</int-val>
+              </expr>
+              <expr operator="|">
+                <expr operator="&lt;">
+                  <predefined-nth-previous-or-following-character position="-2"/>
+                  <int-val>0x0D9A</int-val>
+                </expr>
+                <expr operator="&gt;">
+                  <predefined-nth-previous-or-following-character position="-2"/>
+                  <int-val>0x0DC6</int-val>
+                </expr>
+              </expr>
+            </expr>
+            <delete-n-characters n="-1"/>
+            <insert character="0x0DDB"/>
+          </case>
+          <case>
+            <expr operator="&amp;">
+              <expr operator="&gt;=">
+                <predefined-nth-previous-or-following-character position="-1"/>
+                <int-val>0x0D9A</int-val>
+              </expr>
+              <expr operator="&lt;=">
+                <predefined-nth-previous-or-following-character position="-1"/>
+                <int-val>0x0DC6</int-val>
+              </expr>
+            </expr>
+            <insert character="0x200C"/>
+            <insert character="0x0DD9"/>
+          </case>
+          <case>
+            <int-val>1</int-val>
+            <insert character="0x0DD9"/>
+          </case>
+        </conditional>
+      </rule>
+      <rule>
+        <keyseq>
+          <key-event>A-z</key-event>
+        </keyseq>
+        <set id="c">
+          <predefined-nth-previous-or-following-character position="-1"/>
+        </set>
+        <conditional>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0DAF</int-val>
+            </expr>
+            <delete-n-characters n="-1"/>
+            <insert character="0x0DB3"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0D9C</int-val>
+            </expr>
+            <delete-n-characters n="-1"/>
+            <insert character="0x0D9F"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0DA9</int-val>
+            </expr>
+            <delete-n-characters n="-1"/>
+            <insert character="0x0DAC"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0DA2</int-val>
+            </expr>
+            <delete-n-characters n="-1"/>
+            <insert character="0x0DA6"/>
+          </case>
+        </conditional>
+      </rule>
+      <rule>
+        <keyseq keys="H"/>
+        <set id="c">
+          <predefined-nth-previous-or-following-character position="-1"/>
+        </set>
+        <conditional>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0DD9</int-val>
+            </expr>
+            <delete-n-characters n="-1"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0DDB</int-val>
+            </expr>
+            <delete-n-characters n="-1"/>
+          </case>
+          <case>
+            <int-val>1</int-val>
+            <set id="c">
+              <int-val>0</int-val>
+            </set>
+          </case>
+        </conditional>
+        <conditional>
+          <case>
+            <expr operator="&amp;">
+              <expr operator="&gt;=">
+                <predefined-nth-previous-or-following-character position="-1"/>
+                <int-val>0x0D9A</int-val>
+              </expr>
+              <expr operator="&lt;=">
+                <predefined-nth-previous-or-following-character position="-1"/>
+                <int-val>0x0DC6</int-val>
+              </expr>
+            </expr>
+            <insert character="0x0DCA"/>
+            <insert character="0x200D"/>
+            <insert character="0x0DBA"/>
+          </case>
+        </conditional>
+        <conditional>
+          <case>
+            <expr operator="&gt;">
+              <variable-reference id="c"/>
+              <int-val>0</int-val>
+            </expr>
+            <insert character-or-string="variable">
+              <variable-reference id="c"/>
+            </insert>
+          </case>
+        </conditional>
+      </rule>
+      <rule>
+        <keyseq keys="`"/>
+        <set id="c">
+          <predefined-nth-previous-or-following-character position="-1"/>
+        </set>
+        <conditional>
+          <case>
+            <expr operator="|">
+              <expr operator="=">
+                <variable-reference id="c"/>
+                <int-val>0x0DD9</int-val>
+              </expr>
+              <expr operator="=">
+                <variable-reference id="c"/>
+                <int-val>0x0DDB</int-val>
+              </expr>
+              <expr operator="=">
+                <variable-reference id="c"/>
+                <int-val>0x0DD2</int-val>
+              </expr>
+              <expr operator="=">
+                <variable-reference id="c"/>
+                <int-val>0x0DD3</int-val>
+              </expr>
+            </expr>
+            <delete-n-characters n="-1"/>
+          </case>
+          <case>
+            <int-val>1</int-val>
+            <set id="c">
+              <int-val>0</int-val>
+            </set>
+          </case>
+        </conditional>
+        <conditional>
+          <case>
+            <expr operator="&amp;">
+              <expr operator="&gt;=">
+                <predefined-nth-previous-or-following-character position="-1"/>
+                <int-val>0x0D9A</int-val>
+              </expr>
+              <expr operator="&lt;=">
+                <predefined-nth-previous-or-following-character position="-1"/>
+                <int-val>0x0DC6</int-val>
+              </expr>
+            </expr>
+            <insert character="0x0DCA"/>
+            <insert character="0x200D"/>
+            <insert character="0x0DBB"/>
+          </case>
+        </conditional>
+        <conditional>
+          <case>
+            <expr operator="&gt;">
+              <variable-reference id="c"/>
+              <int-val>0</int-val>
+            </expr>
+            <insert character-or-string="variable">
+              <variable-reference id="c"/>
+            </insert>
+          </case>
+        </conditional>
+      </rule>
+      <rule>
+        <keyseq keys="~"/>
+        <set id="c">
+          <predefined-nth-previous-or-following-character position="-1"/>
+        </set>
+        <conditional>
+          <case>
+            <expr operator="|">
+              <expr operator="=">
+                <variable-reference id="c"/>
+                <int-val>0x0DD9</int-val>
+              </expr>
+              <expr operator="=">
+                <variable-reference id="c"/>
+                <int-val>0x0DDB</int-val>
+              </expr>
+            </expr>
+            <delete-n-characters n="-1"/>
+          </case>
+          <case>
+            <int-val>1</int-val>
+            <set id="c">
+              <int-val>0</int-val>
+            </set>
+          </case>
+        </conditional>
+        <macro-reference id="macro-backward"/>
+        <conditional>
+          <case>
+            <expr operator="&amp;">
+              <expr operator="&gt;=">
+                <predefined-nth-previous-or-following-character position="-1"/>
+                <int-val>0x0D9A</int-val>
+              </expr>
+              <expr operator="&lt;=">
+                <predefined-nth-previous-or-following-character position="-1"/>
+                <int-val>0x0DC6</int-val>
+              </expr>
+            </expr>
+            <set id="c1">
+              <predefined-nth-previous-or-following-character position="-1"/>
+            </set>
+            <delete-n-characters n="-1"/>
+            <insert character-or-string="variable">
+              <variable-reference id="c1"/>
+            </insert>
+            <move-to-marker position="@first"/>
+            <insert character="0x0DBB"/>
+            <insert character="0x0DCA"/>
+            <insert character="0x200D"/>
+          </case>
+        </conditional>
+        <conditional>
+          <case>
+            <expr operator="&gt;">
+              <variable-reference id="c"/>
+              <int-val>0</int-val>
+            </expr>
+            <move-to-marker position="@last"/>
+            <insert character-or-string="variable">
+              <variable-reference id="c"/>
+            </insert>
+          </case>
+        </conditional>
+      </rule>
+      <rule>
+        <keyseq>
+          <key-event>BackSpace</key-event>
+        </keyseq>
+        <macro-reference id="macro-delete-preceding-zw"/>
+        <set id="c">
+          <predefined-nth-previous-or-following-character position="-1"/>
+        </set>
+        <conditional>
+          <case>
+            <expr operator="&lt;">
+              <variable-reference id="c"/>
+              <int-val>0</int-val>
+            </expr>
+            <unhandle/>
+          </case>
+        </conditional>
+        <delete-n-characters n="-1"/>
+        <conditional>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0D86</int-val>
+            </expr>
+            <insert character="0x0D85"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0D87</int-val>
+            </expr>
+            <insert character="0x0D85"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0D88</int-val>
+            </expr>
+            <insert character="0x0D85"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0D8C</int-val>
+            </expr>
+            <insert character="0x0D8B"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0D8E</int-val>
+            </expr>
+            <insert character="0x0D8D"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0D90</int-val>
+            </expr>
+            <insert character="0x0D8F"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0D92</int-val>
+            </expr>
+            <insert character="0x0D8F"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0D93</int-val>
+            </expr>
+            <conditional>
+              <case>
+                <expr operator="&amp;">
+                  <expr operator="&gt;=">
+                    <predefined-nth-previous-or-following-character position="-1"/>
+                    <int-val>0x0D9A</int-val>
+                  </expr>
+                  <expr operator="&lt;=">
+                    <predefined-nth-previous-or-following-character position="-1"/>
+                    <int-val>0x0DC6</int-val>
+                  </expr>
+                </expr>
+                <insert character="0x200C"/>
+              </case>
+            </conditional>
+            <insert character="0x0DD9"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0D95</int-val>
+            </expr>
+            <insert character="0x0D94"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0D96</int-val>
+            </expr>
+            <insert character="0x0D94"/>
+          </case>
+          <case>
+            <expr operator="&amp;">
+              <expr operator="&gt;=">
+                <variable-reference id="c"/>
+                <int-val>0x0D9A</int-val>
+              </expr>
+              <expr operator="&lt;=">
+                <variable-reference id="c"/>
+                <int-val>0x0DC6</int-val>
+              </expr>
+              <expr operator="=">
+                <predefined-nth-previous-or-following-character position="-2"/>
+                <int-val>0x0DCA</int-val>
+              </expr>
+              <expr operator="=">
+                <predefined-nth-previous-or-following-character position="-1"/>
+                <int-val>0x200D</int-val>
+              </expr>
+            </expr>
+            <conditional>
+              <case>
+                <expr operator="=">
+                  <predefined-nth-previous-or-following-character position="-3"/>
+                  <int-val>0x0DBB</int-val>
+                </expr>
+                <delete-n-characters n="-3"/>
+                <insert character-or-string="variable">
+                  <variable-reference id="c"/>
+                </insert>
+              </case>
+              <case>
+                <int-val>1</int-val>
+                <delete-n-characters n="-2"/>
+              </case>
+            </conditional>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0DD9</int-val>
+            </expr>
+            <conditional>
+              <case>
+                <expr operator="|">
+                  <expr operator="&lt;">
+                    <predefined-nth-previous-or-following-character position="-1"/>
+                    <int-val>0x0D9A</int-val>
+                  </expr>
+                  <expr operator="&gt;">
+                    <predefined-nth-previous-or-following-character position="-1"/>
+                    <int-val>0x0DC6</int-val>
+                  </expr>
+                </expr>
+              </case>
+              <case>
+                <expr operator="=">
+                  <predefined-nth-previous-or-following-character position="+1"/>
+                  <int-val>0x0D91</int-val>
+                </expr>
+                <delete-n-characters n="-1"/>
+                <delete-n-characters n="+1"/>
+                <insert character="0x0D93"/>
+              </case>
+              <case>
+                <expr operator="&amp;">
+                  <expr operator="&gt;=">
+                    <predefined-nth-previous-or-following-character position="+1"/>
+                    <int-val>0x0D9A</int-val>
+                  </expr>
+                  <expr operator="&lt;=">
+                    <predefined-nth-previous-or-following-character position="+1"/>
+                    <int-val>0x0DC6</int-val>
+                  </expr>
+                </expr>
+                <set id="c1">
+                  <predefined-nth-previous-or-following-character position="+1"/>
+                </set>
+                <conditional>
+                  <case>
+                    <expr operator="=">
+                      <predefined-nth-previous-or-following-character position="+2"/>
+                      <int-val>0x0DD9</int-val>
+                    </expr>
+                    <macro-reference id="macro-merge-kombuva"/>
+                    <insert character="0x0DDB"/>
+                  </case>
+                  <case>
+                    <expr operator="=">
+                      <predefined-nth-previous-or-following-character position="+2"/>
+                      <int-val>0x0DCA</int-val>
+                    </expr>
+                    <macro-reference id="macro-merge-kombuva"/>
+                    <insert character="0x0DDA"/>
+                  </case>
+                  <case>
+                    <expr operator="=">
+                      <predefined-nth-previous-or-following-character position="+2"/>
+                      <int-val>0x0DCF</int-val>
+                    </expr>
+                    <macro-reference id="macro-merge-kombuva"/>
+                    <insert character="0x0DDC"/>
+                  </case>
+                  <case>
+                    <expr operator="=">
+                      <predefined-nth-previous-or-following-character position="+2"/>
+                      <int-val>0x0DDF</int-val>
+                    </expr>
+                    <macro-reference id="macro-merge-kombuva"/>
+                    <insert character="0x0DDE"/>
+                  </case>
+                  <case>
+                    <int-val>1</int-val>
+                    <delete-n-characters n="-1"/>
+                    <delete-n-characters n="+1"/>
+                    <insert character-or-string="variable">
+                      <variable-reference id="c1"/>
+                    </insert>
+                    <insert character="0x0DD9"/>
+                  </case>
+                </conditional>
+              </case>
+              <case>
+                <expr operator="&amp;">
+                  <expr operator="&gt;=">
+                    <predefined-nth-previous-or-following-character position="-2"/>
+                    <int-val>0x0D9A</int-val>
+                  </expr>
+                  <expr operator="&lt;=">
+                    <predefined-nth-previous-or-following-character position="-2"/>
+                    <int-val>0x0DC6</int-val>
+                  </expr>
+                </expr>
+                <delete-n-characters n="-1"/>
+                <insert character="0x200C"/>
+                <insert character="0x0DD9"/>
+              </case>
+              <case>
+                <expr operator="&amp;">
+                  <expr operator="=">
+                    <predefined-nth-previous-or-following-character position="-4"/>
+                    <int-val>0x0DBB</int-val>
+                  </expr>
+                  <expr operator="=">
+                    <predefined-nth-previous-or-following-character position="-3"/>
+                    <int-val>0x0DCA</int-val>
+                  </expr>
+                  <expr operator="=">
+                    <predefined-nth-previous-or-following-character position="-2"/>
+                    <int-val>0x200D</int-val>
+                  </expr>
+                </expr>
+                <set id="c1">
+                  <predefined-nth-previous-or-following-character position="-1"/>
+                </set>
+                <delete-n-characters n="-4"/>
+                <insert character-or-string="variable">
+                  <variable-reference id="c1"/>
+                </insert>
+                <insert character="0x0DD9"/>
+              </case>
+              <case>
+                <expr operator="&amp;">
+                  <expr operator="&gt;=">
+                    <predefined-nth-previous-or-following-character position="-4"/>
+                    <int-val>0x0D9A</int-val>
+                  </expr>
+                  <expr operator="&lt;=">
+                    <predefined-nth-previous-or-following-character position="-4"/>
+                    <int-val>0x0DC6</int-val>
+                  </expr>
+                  <expr operator="=">
+                    <predefined-nth-previous-or-following-character position="-3"/>
+                    <int-val>0x0DCA</int-val>
+                  </expr>
+                  <expr operator="=">
+                    <predefined-nth-previous-or-following-character position="-2"/>
+                    <int-val>0x200D</int-val>
+                  </expr>
+                </expr>
+                <delete-n-characters n="-3"/>
+                <insert character="0x0DD9"/>
+              </case>
+              <case>
+                <int-val>1</int-val>
+                <delete-n-characters n="-1"/>
+                <insert character="0x0DD9"/>
+              </case>
+            </conditional>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0DDA</int-val>
+            </expr>
+            <insert character="0x0DD9"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0DDB</int-val>
+            </expr>
+            <conditional>
+              <case>
+                <expr operator="|">
+                  <expr operator="&lt;">
+                    <predefined-nth-previous-or-following-character position="-1"/>
+                    <int-val>0x0D9A</int-val>
+                  </expr>
+                  <expr operator="&gt;">
+                    <predefined-nth-previous-or-following-character position="-1"/>
+                    <int-val>0x0DC6</int-val>
+                  </expr>
+                </expr>
+                <insert character="0x0DD9"/>
+              </case>
+              <case>
+                <expr operator="&amp;">
+                  <expr operator="&gt;=">
+                    <predefined-nth-previous-or-following-character position="-2"/>
+                    <int-val>0x0D9A</int-val>
+                  </expr>
+                  <expr operator="&lt;=">
+                    <predefined-nth-previous-or-following-character position="-2"/>
+                    <int-val>0x0DC6</int-val>
+                  </expr>
+                </expr>
+                <delete-n-characters n="-1"/>
+                <insert character="0x200C"/>
+                <insert character="0x0DDB"/>
+              </case>
+              <case>
+                <expr operator="&amp;">
+                  <expr operator="=">
+                    <predefined-nth-previous-or-following-character position="-4"/>
+                    <int-val>0x0DBB</int-val>
+                  </expr>
+                  <expr operator="=">
+                    <predefined-nth-previous-or-following-character position="-3"/>
+                    <int-val>0x0DCA</int-val>
+                  </expr>
+                  <expr operator="=">
+                    <predefined-nth-previous-or-following-character position="-2"/>
+                    <int-val>0x200D</int-val>
+                  </expr>
+                </expr>
+                <set id="c1">
+                  <predefined-nth-previous-or-following-character position="-1"/>
+                </set>
+                <delete-n-characters n="-4"/>
+                <insert character-or-string="variable">
+                  <variable-reference id="c1"/>
+                </insert>
+                <insert character="0x0DDB"/>
+              </case>
+              <case>
+                <expr operator="&amp;">
+                  <expr operator="&gt;=">
+                    <predefined-nth-previous-or-following-character position="-4"/>
+                    <int-val>0x0D9A</int-val>
+                  </expr>
+                  <expr operator="&lt;=">
+                    <predefined-nth-previous-or-following-character position="-4"/>
+                    <int-val>0x0DC6</int-val>
+                  </expr>
+                  <expr operator="=">
+                    <predefined-nth-previous-or-following-character position="-3"/>
+                    <int-val>0x0DCA</int-val>
+                  </expr>
+                  <expr operator="=">
+                    <predefined-nth-previous-or-following-character position="-2"/>
+                    <int-val>0x200D</int-val>
+                  </expr>
+                </expr>
+                <delete-n-characters n="-3"/>
+                <insert character="0x0DDB"/>
+              </case>
+              <case>
+                <int-val>1</int-val>
+                <delete-n-characters n="-1"/>
+                <insert character="0x0DDB"/>
+              </case>
+            </conditional>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0DDC</int-val>
+            </expr>
+            <insert character="0x0DD9"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0DDD</int-val>
+            </expr>
+            <insert character="0x0DDC"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0DDE</int-val>
+            </expr>
+            <insert character="0x0DD9"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0DF2</int-val>
+            </expr>
+            <insert character="0x0DD8"/>
+          </case>
+        </conditional>
+        <conditional>
+          <case>
+            <expr operator="&amp;">
+              <expr operator="&gt;=">
+                <predefined-nth-previous-or-following-character position="-1"/>
+                <int-val>0x0D9A</int-val>
+              </expr>
+              <expr operator="&lt;=">
+                <predefined-nth-previous-or-following-character position="-1"/>
+                <int-val>0x0DC6</int-val>
+              </expr>
+              <expr operator="|">
+                <expr operator="=">
+                  <predefined-nth-previous-or-following-character position="+1"/>
+                  <int-val>0x0DD9</int-val>
+                </expr>
+                <expr operator="=">
+                  <predefined-nth-previous-or-following-character position="+1"/>
+                  <int-val>0x0DDB</int-val>
+                </expr>
+              </expr>
+            </expr>
+            <insert character="0x200C"/>
+          </case>
+        </conditional>
+      </rule>
+      <rule>
+        <keyseq>
+          <key-event>Delete</key-event>
+        </keyseq>
+        <macro-reference id="macro-delete-following-zw"/>
+        <set id="c">
+          <predefined-nth-previous-or-following-character position="+1"/>
+        </set>
+        <conditional>
+          <case>
+            <expr operator="&lt;">
+              <variable-reference id="c"/>
+              <int-val>0</int-val>
+            </expr>
+            <unhandle/>
+          </case>
+        </conditional>
+        <delete-n-characters n="+1"/>
+        <conditional>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0D86</int-val>
+            </expr>
+            <insert character="0x0DCF"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0D87</int-val>
+            </expr>
+            <insert character="0x0DD0"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0D88</int-val>
+            </expr>
+            <insert character="0x0DD1"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0D8C</int-val>
+            </expr>
+            <insert character="0x0DDF"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0D8E</int-val>
+            </expr>
+            <insert character="0x0DD8"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0D90</int-val>
+            </expr>
+            <insert character="0x0DDF"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0D92</int-val>
+            </expr>
+            <insert character="0x0DCA"/>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0D93</int-val>
+            </expr>
+            <insert character="0x0D91"/>
+          </case>
+          <case>
+            <expr operator="&amp;">
+              <expr operator="&gt;=">
+                <variable-reference id="c"/>
+                <int-val>0x0D9A</int-val>
+              </expr>
+              <expr operator="&lt;=">
+                <variable-reference id="c"/>
+                <int-val>0x0DC6</int-val>
+              </expr>
+            </expr>
+            <macro-reference id="macro-forward"/>
+            <conditional>
+              <case>
+                <expr operator="=">
+                  <predefined-nth-previous-or-following-character position="+1"/>
+                  <int-val>0x0DD9</int-val>
+                </expr>
+                <delete-n-characters n="+1"/>
+                <move-to-marker position="@first"/>
+                <insert character-or-string="variable">
+                  <variable-reference id="c"/>
+                </insert>
+              </case>
+              <case>
+                <expr operator="=">
+                  <predefined-nth-previous-or-following-character position="+1"/>
+                  <int-val>0x0DDB</int-val>
+                </expr>
+                <delete-n-characters n="+1"/>
+                <insert character="0x0DD9"/>
+                <move-to-marker position="@first"/>
+                <insert character-or-string="variable">
+                  <variable-reference id="c"/>
+                </insert>
+              </case>
+              <case>
+                <expr operator="=">
+                  <predefined-nth-previous-or-following-character position="+1"/>
+                  <int-val>0x0DDA</int-val>
+                </expr>
+                <delete-n-characters n="+1"/>
+                <insert character="0x0DCA"/>
+                <move-to-marker position="@first"/>
+                <insert character-or-string="variable">
+                  <variable-reference id="c"/>
+                </insert>
+              </case>
+              <case>
+                <expr operator="=">
+                  <predefined-nth-previous-or-following-character position="+1"/>
+                  <int-val>0x0DDC</int-val>
+                </expr>
+                <delete-n-characters n="+1"/>
+                <insert character="0x0DCF"/>
+                <move-to-marker position="@first"/>
+                <insert character-or-string="variable">
+                  <variable-reference id="c"/>
+                </insert>
+              </case>
+              <case>
+                <expr operator="=">
+                  <predefined-nth-previous-or-following-character position="+1"/>
+                  <int-val>0x0DDE</int-val>
+                </expr>
+                <delete-n-characters n="+1"/>
+                <insert character="0x0DDF"/>
+                <move-to-marker position="@first"/>
+                <insert character-or-string="variable">
+                  <variable-reference id="c"/>
+                </insert>
+              </case>
+              <case>
+                <int-val>1</int-val>
+                <delete-to-marker position="@first"/>
+              </case>
+            </conditional>
+          </case>
+          <case>
+            <expr operator="=">
+              <variable-reference id="c"/>
+              <int-val>0x0DDB</int-val>
+            </expr>
+            <insert character="0x0DD9"/>
+          </case>
+        </conditional>
+      </rule>
+    </map>
+    <map id="map-independent">
+      <rule>
+        <keyseq keys="w"/>
+        <insert string="අ"/>
+      </rule>
+      <rule>
+        <keyseq keys="b"/>
+        <insert string="ඉ"/>
+      </rule>
+      <rule>
+        <keyseq keys="B"/>
+        <insert string="ඊ"/>
+      </rule>
+      <rule>
+        <keyseq keys="W"/>
+        <insert string="උ"/>
+      </rule>
+      <rule>
+        <keyseq keys="R"/>
+        <insert string="ඍ"/>
+      </rule>
+      <rule>
+        <keyseq>
+          <key-event>A-,</key-event>
+        </keyseq>
+        <insert string="ඏ"/>
+      </rule>
+      <rule>
+        <keyseq keys="t"/>
+        <insert string="එ"/>
+      </rule>
+      <rule>
+        <keyseq keys="T"/>
+        <insert string="ඔ"/>
+      </rule>
+      <rule>
+        <keyseq keys="l"/>
+        <insert string="ක"/>
+      </rule>
+      <rule>
+        <keyseq keys="L"/>
+        <insert string="ඛ"/>
+      </rule>
+      <rule>
+        <keyseq keys="."/>
+        <insert string="ග"/>
+      </rule>
+      <rule>
+        <keyseq keys="&gt;"/>
+        <insert string="ඝ"/>
+      </rule>
+      <rule>
+        <keyseq keys="X"/>
+        <insert string="ඞ"/>
+      </rule>
+      <rule>
+        <keyseq>
+          <key-event>A-.</key-event>
+        </keyseq>
+        <insert string="ඟ"/>
+      </rule>
+      <rule>
+        <keyseq>
+          <character-code>0x2E</character-code>
+          <key-event>A-z</key-event>
+        </keyseq>
+        <insert string="ඟ"/>
+      </rule>
+      <rule>
+        <keyseq keys="p"/>
+        <insert string="ච"/>
+      </rule>
+      <rule>
+        <keyseq keys="P"/>
+        <insert string="ඡ"/>
+      </rule>
+      <rule>
+        <keyseq keys="c"/>
+        <insert string="ජ"/>
+      </rule>
+      <rule>
+        <keyseq keys="C"/>
+        <insert string="ඣ"/>
+      </rule>
+      <rule>
+        <keyseq keys="["/>
+        <insert string="ඤ"/>
+      </rule>
+      <rule>
+        <keyseq keys="{"/>
+        <insert string="ඥ"/>
+      </rule>
+      <rule>
+        <keyseq>
+          <key-event>A-c</key-event>
+        </keyseq>
+        <insert string="ඦ"/>
+      </rule>
+      <rule>
+        <keyseq>
+          <character-code>0x63</character-code>
+          <key-event>A-z</key-event>
+        </keyseq>
+        <insert string="ඦ"/>
+      </rule>
+      <rule>
+        <keyseq keys="g"/>
+        <insert string="ට"/>
+      </rule>
+      <rule>
+        <keyseq keys="G"/>
+        <insert string="ඨ"/>
+      </rule>
+      <rule>
+        <keyseq keys="v"/>
+        <insert string="ඩ"/>
+      </rule>
+      <rule>
+        <keyseq keys="V"/>
+        <insert string="ඪ"/>
+      </rule>
+      <rule>
+        <keyseq keys="K"/>
+        <insert string="ණ"/>
+      </rule>
+      <rule>
+        <keyseq>
+          <key-event>A-v</key-event>
+        </keyseq>
+        <insert string="ඬ"/>
+      </rule>
+      <rule>
+        <keyseq>
+          <character-code>0x76</character-code>
+          <key-event>A-z</key-event>
+        </keyseq>
+        <insert string="ඬ"/>
+      </rule>
+      <rule>
+        <keyseq keys=";"/>
+        <insert string="ත"/>
+      </rule>
+      <rule>
+        <keyseq keys=":"/>
+        <insert string="ථ"/>
+      </rule>
+      <rule>
+        <keyseq keys="o"/>
+        <insert string="ද"/>
+      </rule>
+      <rule>
+        <keyseq keys="O"/>
+        <insert string="ධ"/>
+      </rule>
+      <rule>
+        <keyseq keys="k"/>
+        <insert string="න"/>
+      </rule>
+      <rule>
+        <keyseq>
+          <key-event>A-o</key-event>
+        </keyseq>
+        <insert string="ඳ"/>
+      </rule>
+      <rule>
+        <keyseq>
+          <character-code>0x6F</character-code>
+          <key-event>A-z</key-event>
+        </keyseq>
+        <insert string="ඳ"/>
+      </rule>
+      <rule>
+        <keyseq keys="m"/>
+        <insert string="ප"/>
+      </rule>
+      <rule>
+        <keyseq keys="M"/>
+        <insert string="ඵ"/>
+      </rule>
+      <rule>
+        <keyseq keys="n"/>
+        <insert string="බ"/>
+      </rule>
+      <rule>
+        <keyseq keys="N"/>
+        <insert string="භ"/>
+      </rule>
+      <rule>
+        <keyseq keys="u"/>
+        <insert string="ම"/>
+      </rule>
+      <rule>
+        <keyseq keys="U"/>
+        <insert string="ඹ"/>
+      </rule>
+      <rule>
+        <keyseq keys="h"/>
+        <insert string="ය"/>
+      </rule>
+      <rule>
+        <keyseq keys="r"/>
+        <insert string="ර"/>
+      </rule>
+      <rule>
+        <keyseq keys=","/>
+        <insert string="ල"/>
+      </rule>
+      <rule>
+        <keyseq keys="j"/>
+        <insert string="ව"/>
+      </rule>
+      <rule>
+        <keyseq keys="Y"/>
+        <insert string="ශ"/>
+      </rule>
+      <rule>
+        <keyseq keys="I"/>
+        <insert string="ෂ"/>
+      </rule>
+      <rule>
+        <keyseq keys="i"/>
+        <insert string="ස"/>
+      </rule>
+      <rule>
+        <keyseq keys="y"/>
+        <insert string="හ"/>
+      </rule>
+      <rule>
+        <keyseq keys="&lt;"/>
+        <insert string="ළ"/>
+      </rule>
+      <rule>
+        <keyseq keys="F"/>
+        <insert string="ෆ"/>
+      </rule>
+      <rule>
+        <keyseq>
+          <key-event>A-'</key-event>
+        </keyseq>
+        <insert string="෴"/>
+      </rule>
+      <rule>
+        <keyseq keys="J"/>
+        <insert string="ළු"/>
+      </rule>
+      <rule>
+        <keyseq>
+          <key-event>S- </key-event>
+        </keyseq>
+        <insert string=" "/>
+      </rule>
+      <rule>
+        <keyseq>
+          <key-event>A- </key-event>
+        </keyseq>
+        <insert string="‌"/>
+      </rule>
+      <rule>
+        <keyseq keys="]"/>
+        <insert string=";"/>
+      </rule>
+      <rule>
+        <keyseq keys="}"/>
+        <insert string=":"/>
+      </rule>
+      <rule>
+        <keyseq keys="&apos;"/>
+        <insert string="."/>
+      </rule>
+      <rule>
+        <keyseq keys="&quot;"/>
+        <insert string=","/>
+      </rule>
+      <rule>
+        <keyseq keys="z"/>
+        <insert string="&apos;"/>
+      </rule>
+      <rule>
+        <keyseq keys="Z"/>
+        <insert string="&quot;"/>
+      </rule>
+    </map>
+    <map id="map-dependent">
+      <rule>
+        <keyseq keys="x"/>
+        <insert string="ං"/>
+      </rule>
+      <rule>
+        <keyseq>
+          <key-event>A-x</key-event>
+        </keyseq>
+        <insert string="ඃ"/>
+      </rule>
+      <rule>
+        <keyseq keys="a"/>
+        <conditional>
+          <case>
+            <expr operator="=">
+              <predefined-nth-previous-or-following-character position="-1"/>
+              <int-val>0x0D91</int-val>
+            </expr>
+            <delete-to-marker position="@previous"/>
+            <insert string="ඒ"/>
+          </case>
+          <case>
             <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0DDA</int-val>
+              <predefined-nth-previous-or-following-character position="-1"/>
+              <int-val>0x0D94</int-val>
             </expr>
-            <insert character="0x0DD9"/>
+            <delete-to-marker position="@previous"/>
+            <insert string="ඕ"/>
           </case>
           <case>
             <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0DDB</int-val>
+              <predefined-nth-previous-or-following-character position="-1"/>
+              <int-val>0x0DD9</int-val>
             </expr>
-            <conditional>
-              <case>
-                <expr operator="|">
-                  <expr operator="&lt;">
-                    <predefined-nth-previous-or-following-character position="-1"/>
-                    <int-val>0x0D9A</int-val>
-                  </expr>
-                  <expr operator="&gt;">
-                    <predefined-nth-previous-or-following-character position="-1"/>
-                    <int-val>0x0DC6</int-val>
-                  </expr>
-                </expr>
-                <insert character="0x0DD9"/>
-              </case>
-              <case>
-                <expr operator="&amp;">
-                  <expr operator="&gt;=">
-                    <predefined-nth-previous-or-following-character position="-2"/>
-                    <int-val>0x0D9A</int-val>
-                  </expr>
-                  <expr operator="&lt;=">
-                    <predefined-nth-previous-or-following-character position="-2"/>
-                    <int-val>0x0DC6</int-val>
-                  </expr>
-                </expr>
-                <delete-n-characters n="-1"/>
-                <insert character="0x200C"/>
-                <insert character="0x0DDB"/>
-              </case>
-              <case>
-                <expr operator="&amp;">
-                  <expr operator="=">
-                    <predefined-nth-previous-or-following-character position="-4"/>
-                    <int-val>0x0DBB</int-val>
-                  </expr>
-                  <expr operator="=">
-                    <predefined-nth-previous-or-following-character position="-3"/>
-                    <int-val>0x0DCA</int-val>
-                  </expr>
-                  <expr operator="=">
-                    <predefined-nth-previous-or-following-character position="-2"/>
-                    <int-val>0x200D</int-val>
-                  </expr>
-                </expr>
-                <set id="c1">
-                  <predefined-nth-previous-or-following-character position="-1"/>
-                </set>
-                <delete-n-characters n="-4"/>
-                <insert character-or-string="variable">
-                  <variable-reference id="c1"/>
-                </insert>
-                <insert character="0x0DDB"/>
-              </case>
-              <case>
-                <expr operator="&amp;">
-                  <expr operator="&gt;=">
-                    <predefined-nth-previous-or-following-character position="-4"/>
-                    <int-val>0x0D9A</int-val>
-                  </expr>
-                  <expr operator="&lt;=">
-                    <predefined-nth-previous-or-following-character position="-4"/>
-                    <int-val>0x0DC6</int-val>
-                  </expr>
-                  <expr operator="=">
-                    <predefined-nth-previous-or-following-character position="-3"/>
-                    <int-val>0x0DCA</int-val>
-                  </expr>
-                  <expr operator="=">
-                    <predefined-nth-previous-or-following-character position="-2"/>
-                    <int-val>0x200D</int-val>
-                  </expr>
-                </expr>
-                <delete-n-characters n="-3"/>
-                <insert character="0x0DDB"/>
-              </case>
-              <case>
-                <int-val>1</int-val>
-                <delete-n-characters n="-1"/>
-                <insert character="0x0DDB"/>
-              </case>
-            </conditional>
+            <delete-to-marker position="@previous"/>
+            <insert string="ේ"/>
           </case>
           <case>
             <expr operator="=">
-              <variable-reference id="c"/>
+              <predefined-nth-previous-or-following-character position="-1"/>
               <int-val>0x0DDC</int-val>
             </expr>
-            <insert character="0x0DD9"/>
+            <delete-to-marker position="@previous"/>
+            <insert string="ෝ"/>
           </case>
           <case>
+            <int-val>1</int-val>
+            <insert string="්"/>
+          </case>
+        </conditional>
+      </rule>
+      <rule>
+        <keyseq keys="d"/>
+        <conditional>
+          <case>
             <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0DDD</int-val>
+              <predefined-nth-previous-or-following-character position="-1"/>
+              <int-val>0x0D85</int-val>
             </expr>
-            <insert character="0x0DDC"/>
+            <delete-to-marker position="@previous"/>
+            <insert string="ආ"/>
           </case>
           <case>
             <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0DDE</int-val>
+              <predefined-nth-previous-or-following-character position="-1"/>
+              <int-val>0x0DD9</int-val>
             </expr>
-            <insert character="0x0DD9"/>
+            <delete-to-marker position="@previous"/>
+            <insert string="ො"/>
+          </case>
+          <case>
+            <int-val>1</int-val>
+            <insert string="ා"/>
           </case>
+        </conditional>
+      </rule>
+      <rule>
+        <keyseq keys="e"/>
+        <conditional>
           <case>
             <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0DF2</int-val>
+              <predefined-nth-previous-or-following-character position="-1"/>
+              <int-val>0x0D85</int-val>
             </expr>
-            <insert character="0x0DD8"/>
+            <delete-to-marker position="@previous"/>
+            <insert string="ඇ"/>
+          </case>
+          <case>
+            <int-val>1</int-val>
+            <insert string="ැ"/>
           </case>
         </conditional>
+      </rule>
+      <rule>
+        <keyseq keys="E"/>
         <conditional>
           <case>
+            <expr operator="=">
+              <predefined-nth-previous-or-following-character position="-1"/>
+              <int-val>0x0D85</int-val>
+            </expr>
+            <delete-to-marker position="@previous"/>
+            <insert string="ඈ"/>
+          </case>
+          <case>
             <expr operator="&amp;">
-              <expr operator="&gt;=">
-                <predefined-nth-previous-or-following-character position="-1"/>
-                <int-val>0x0D9A</int-val>
+              <expr operator="=">
+                <predefined-nth-previous-or-following-character position="-2"/>
+                <int-val>0x0DC5</int-val>
               </expr>
-              <expr operator="&lt;=">
+              <expr operator="=">
                 <predefined-nth-previous-or-following-character position="-1"/>
-                <int-val>0x0DC6</int-val>
-              </expr>
-              <expr operator="|">
-                <expr operator="=">
-                  <predefined-nth-previous-or-following-character position="+1"/>
-                  <int-val>0x0DD9</int-val>
-                </expr>
-                <expr operator="=">
-                  <predefined-nth-previous-or-following-character position="+1"/>
-                  <int-val>0x0DDB</int-val>
-                </expr>
+                <int-val>0x0DD4</int-val>
               </expr>
             </expr>
-            <insert character="0x200C"/>
+            <delete-to-marker position="@previous"/>
+            <insert string="ූ"/>
+          </case>
+          <case>
+            <int-val>1</int-val>
+            <insert string="ෑ"/>
           </case>
         </conditional>
       </rule>
       <rule>
-        <keyseq>
-          <key-event>Delete</key-event>
-        </keyseq>
-        <macro-reference id="macro-delete-following-zw"/>
-        <set id="c">
-          <predefined-nth-previous-or-following-character position="+1"/>
-        </set>
+        <keyseq keys="s"/>
+        <insert string="ි"/>
+      </rule>
+      <rule>
+        <keyseq keys="S"/>
+        <insert string="ී"/>
+      </rule>
+      <rule>
+        <keyseq keys="q"/>
+        <insert string="ු"/>
+      </rule>
+      <rule>
+        <keyseq keys="Q"/>
+        <insert string="ූ"/>
+      </rule>
+      <rule>
+        <keyseq keys="D"/>
         <conditional>
           <case>
-            <expr operator="&lt;">
-              <variable-reference id="c"/>
-              <int-val>0</int-val>
+            <expr operator="=">
+              <predefined-nth-previous-or-following-character position="-1"/>
+              <int-val>0x0D8D</int-val>
             </expr>
-            <unhandle/>
+            <delete-to-marker position="@previous"/>
+            <insert string="ඎ"/>
           </case>
-        </conditional>
-        <delete-n-characters n="+1"/>
-        <conditional>
           <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0D86</int-val>
-            </expr>
-            <insert character="0x0DCF"/>
+            <int-val>1</int-val>
+            <insert string="ෘ"/>
           </case>
+        </conditional>
+      </rule>
+      <rule>
+        <keyseq keys="DD"/>
+        <insert string="ෲ"/>
+      </rule>
+      <rule>
+        <keyseq keys="A"/>
+        <conditional>
           <case>
             <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0D87</int-val>
+              <predefined-nth-previous-or-following-character position="-1"/>
+              <int-val>0x0D8B</int-val>
             </expr>
-            <insert character="0x0DD0"/>
+            <delete-to-marker position="@previous"/>
+            <insert string="ඌ"/>
           </case>
           <case>
             <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0D88</int-val>
+              <predefined-nth-previous-or-following-character position="-1"/>
+              <int-val>0x0D8F</int-val>
             </expr>
-            <insert character="0x0DD1"/>
+            <delete-to-marker position="@previous"/>
+            <insert string="ඐ"/>
           </case>
           <case>
             <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0D8C</int-val>
+              <predefined-nth-previous-or-following-character position="-1"/>
+              <int-val>0x0D94</int-val>
             </expr>
-            <insert character="0x0DDF"/>
+            <delete-to-marker position="@previous"/>
+            <insert string="ඖ"/>
           </case>
           <case>
             <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0D8E</int-val>
+              <predefined-nth-previous-or-following-character position="-1"/>
+              <int-val>0x0DD9</int-val>
             </expr>
-            <insert character="0x0DD8"/>
+            <delete-to-marker position="@previous"/>
+            <insert string="ෞ"/>
           </case>
           <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0D90</int-val>
-            </expr>
-            <insert character="0x0DDF"/>
+            <int-val>1</int-val>
+            <insert string="ෟ"/>
           </case>
+        </conditional>
+      </rule>
+      <rule>
+        <keyseq>
+          <key-event>A-a</key-event>
+        </keyseq>
+        <insert string="ෳ"/>
+      </rule>
+      <rule>
+        <keyseq keys="H"/>
+        <conditional>
           <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0D92</int-val>
+            <expr operator="|">
+              <expr operator="=">
+                <predefined-nth-previous-or-following-character position="-1"/>
+                <int-val>0x0DD9</int-val>
+              </expr>
+              <expr operator="=">
+                <predefined-nth-previous-or-following-character position="-1"/>
+                <int-val>0x0DDB</int-val>
+              </expr>
             </expr>
-            <insert character="0x0DCA"/>
+            <move-to-marker position="@previous"/>
+            <insert string="්‍ය"/>
+            <move-to-marker position="@last"/>
           </case>
           <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0D93</int-val>
-            </expr>
-            <insert character="0x0D91"/>
+            <int-val>1</int-val>
+            <insert string="්‍ය"/>
           </case>
+        </conditional>
+      </rule>
+      <rule>
+        <keyseq keys="`"/>
+        <conditional>
           <case>
-            <expr operator="&amp;">
-              <expr operator="&gt;=">
-                <variable-reference id="c"/>
-                <int-val>0x0D9A</int-val>
+            <expr operator="|">
+              <expr operator="=">
+                <predefined-nth-previous-or-following-character position="-1"/>
+                <int-val>0x0DD2</int-val>
               </expr>
-              <expr operator="&lt;=">
-                <variable-reference id="c"/>
-                <int-val>0x0DC6</int-val>
+              <expr operator="=">
+                <predefined-nth-previous-or-following-character position="-1"/>
+                <int-val>0x0DD3</int-val>
+              </expr>
+              <expr operator="=">
+                <predefined-nth-previous-or-following-character position="-1"/>
+                <int-val>0x0DD9</int-val>
+              </expr>
+              <expr operator="=">
+                <predefined-nth-previous-or-following-character position="-1"/>
+                <int-val>0x0DDB</int-val>
               </expr>
             </expr>
-            <macro-reference id="macro-forward"/>
-            <conditional>
-              <case>
-                <expr operator="=">
-                  <predefined-nth-previous-or-following-character position="+1"/>
-                  <int-val>0x0DD9</int-val>
-                </expr>
-                <delete-n-characters n="+1"/>
-                <move-to-marker position="@first"/>
-                <insert character-or-string="variable">
-                  <variable-reference id="c"/>
-                </insert>
-              </case>
-              <case>
-                <expr operator="=">
-                  <predefined-nth-previous-or-following-character position="+1"/>
-                  <int-val>0x0DDB</int-val>
-                </expr>
-                <delete-n-characters n="+1"/>
-                <insert character="0x0DD9"/>
-                <move-to-marker position="@first"/>
-                <insert character-or-string="variable">
-                  <variable-reference id="c"/>
-                </insert>
-              </case>
-              <case>
-                <expr operator="=">
-                  <predefined-nth-previous-or-following-character position="+1"/>
-                  <int-val>0x0DDA</int-val>
-                </expr>
-                <delete-n-characters n="+1"/>
-                <insert character="0x0DCA"/>
-                <move-to-marker position="@first"/>
-                <insert character-or-string="variable">
-                  <variable-reference id="c"/>
-                </insert>
-              </case>
-              <case>
-                <expr operator="=">
-                  <predefined-nth-previous-or-following-character position="+1"/>
-                  <int-val>0x0DDC</int-val>
-                </expr>
-                <delete-n-characters n="+1"/>
-                <insert character="0x0DCF"/>
-                <move-to-marker position="@first"/>
-                <insert character-or-string="variable">
-                  <variable-reference id="c"/>
-                </insert>
-              </case>
-              <case>
-                <expr operator="=">
-                  <predefined-nth-previous-or-following-character position="+1"/>
-                  <int-val>0x0DDE</int-val>
-                </expr>
-                <delete-n-characters n="+1"/>
-                <insert character="0x0DDF"/>
-                <move-to-marker position="@first"/>
-                <insert character-or-string="variable">
-                  <variable-reference id="c"/>
-                </insert>
-              </case>
-              <case>
-                <int-val>1</int-val>
-                <delete-to-marker position="@first"/>
-              </case>
-            </conditional>
+            <move-to-marker position="@previous"/>
+            <insert string="්‍ර"/>
+            <move-to-marker position="@last"/>
           </case>
           <case>
-            <expr operator="=">
-              <variable-reference id="c"/>
-              <int-val>0x0DDB</int-val>
-            </expr>
-            <insert character="0x0DD9"/>
+            <int-val>1</int-val>
+            <insert string="්‍ර"/>
           </case>
         </conditional>
       </rule>
+      <rule>
+        <keyseq keys="~"/>
+        <move-to-marker position="@first"/>
+        <insert string="ර්‍"/>
+        <move-to-marker position="@last"/>
+      </rule>
+    </map>
+    <map id="map-kombuva">
+      <rule>
+        <keyseq keys="f"/>
+        <insert string="ෙ"/>
+      </rule>
     </map>
     <map id="map-join">
       <rule>
         <keyseq keys="\"/>
       </rule>
     </map>
+    <map id="map-backspace">
+      <rule>
+        <keyseq>
+          <key-event>BackSpace</key-event>
+        </keyseq>
+      </rule>
+    </map>
   </map-list>
   <state-list>
     <state id="state-init">
+      <branch branch-selecting-map="map-starter">
+        <pushback-n-events n="1"/>
+        <conditional>
+          <case>
+            <expr operator="&amp;">
+              <expr operator="=">
+                <variable-reference id="use-surrounding-text"/>
+                <int-val>1</int-val>
+              </expr>
+              <expr operator="=">
+                <variable-reference type="predefined" id="predefined-surround-text-flag"/>
+                <int-val>-1</int-val>
+              </expr>
+            </expr>
+            <shift-to id="state-surrounding-text"/>
+          </case>
+          <case>
+            <int-val>1</int-val>
+            <shift-to id="state-preedit"/>
+          </case>
+        </conditional>
+      </branch>
+    </state>
+    <state id="state-surrounding-text">
       <branch branch-selecting-map="map-consonant">
         <move-to-marker position="@first"/>
         <conditional>
@@ -1700,8 +2572,11 @@ This input method requires surrounding text support.
             </conditional>
           </case>
         </conditional>
+        <commit/>
+      </branch>
+      <branch branch-selecting-map="map-misc">
+        <commit/>
       </branch>
-      <branch branch-selecting-map="map-misc"/>
       <branch branch-selecting-map="map-join">
         <shift-to id="state-join"/>
       </branch>
@@ -1761,11 +2636,197 @@ This input method requires surrounding text support.
             <insert character="0x200D"/>
           </case>
         </conditional>
-        <shift-to id="state-init"/>
+        <commit/>
+        <shift-to id="state-surrounding-text"/>
       </branch>
       <catch-all-branch>
-        <shift-to id="state-init"/>
+        <commit/>
+        <shift-to id="state-surrounding-text"/>
       </catch-all-branch>
     </state>
+    <state id="state-preedit">
+      <branch branch-selecting-map="map-independent">
+        <shift-to id="state-independent-state"/>
+      </branch>
+      <branch branch-selecting-map="map-kombuva">
+        <shift-to id="state-kombuva-state"/>
+      </branch>
+      <branch branch-selecting-map="map-dependent"/>
+    </state>
+    <state id="state-independent-state">
+      <branch branch-selecting-map="map-dependent"/>
+      <branch branch-selecting-map="map-join">
+        <conditional>
+          <case>
+            <expr operator="|">
+              <expr operator="=">
+                <predefined-nth-previous-or-following-character position="-1"/>
+                <int-val>0x0DD9</int-val>
+              </expr>
+              <expr operator="=">
+                <predefined-nth-previous-or-following-character position="-1"/>
+                <int-val>0x0DDB</int-val>
+              </expr>
+            </expr>
+            <shift-to id="state-join-state"/>
+          </case>
+          <case>
+            <expr operator="|">
+              <expr operator="&lt;">
+                <predefined-nth-previous-or-following-character position="-1"/>
+                <int-val>0x0D9A</int-val>
+              </expr>
+              <expr operator="&gt;">
+                <predefined-nth-previous-or-following-character position="-1"/>
+                <int-val>0x0DC6</int-val>
+              </expr>
+            </expr>
+            <undo target-of-undo="-1"/>
+          </case>
+          <case>
+            <int-val>1</int-val>
+            <shift-to id="state-join-state"/>
+          </case>
+        </conditional>
+      </branch>
+      <branch branch-selecting-map="map-backspace">
+        <undo/>
+      </branch>
+    </state>
+    <state id="state-join-state">
+      <state-hook>
+        <mark-current-position markerID="p"/>
+      </state-hook>
+      <branch branch-selecting-map="map-independent">
+        <move-to-marker markerID="p"/>
+        <set id="c">
+          <predefined-nth-previous-or-following-character position="-1"/>
+        </set>
+        <conditional>
+          <case>
+            <expr operator="|">
+              <expr operator="=">
+                <variable-reference id="c"/>
+                <int-val>0x0DD9</int-val>
+              </expr>
+              <expr operator="=">
+                <variable-reference id="c"/>
+                <int-val>0x0DDB</int-val>
+              </expr>
+            </expr>
+            <delete-to-marker position="@previous"/>
+            <insert string="්‍"/>
+            <move-to-marker position="@last"/>
+            <insert character-or-string="variable">
+              <variable-reference id="c"/>
+            </insert>
+          </case>
+          <case>
+            <int-val>1</int-val>
+            <insert string="්‍"/>
+            <move-to-marker position="@last"/>
+          </case>
+        </conditional>
+        <shift-to id="state-independent-state"/>
+      </branch>
+      <branch branch-selecting-map="map-backspace">
+        <undo/>
+      </branch>
+    </state>
+    <state id="state-kombuva-state">
+      <state-hook>
+        <mark-current-position markerID="p"/>
+      </state-hook>
+      <branch branch-selecting-map="map-independent">
+        <conditional>
+          <case>
+            <expr operator="&amp;">
+              <expr operator="=">
+                <variable-reference id="@0" type="predefined"/>
+                <int-val>0x0DD9</int-val>
+              </expr>
+              <expr operator="=">
+                <variable-reference id="@1" type="predefined"/>
+                <int-val>0x0D91</int-val>
+              </expr>
+            </expr>
+            <delete-to-marker position="@first"/>
+            <insert string="ඓ"/>
+            <shift-to id="state-independent-state"/>
+          </case>
+          <case>
+            <expr operator="&amp;">
+              <expr operator="=">
+                <variable-reference id="@0" type="predefined"/>
+                <int-val>0x0DD9</int-val>
+              </expr>
+              <expr operator="&lt;">
+                <variable-reference id="@2" type="predefined"/>
+                <int-val>0</int-val>
+              </expr>
+            </expr>
+            <move-to-marker position="@0"/>
+            <delete-to-marker position="@next"/>
+            <move-to-marker position="@last"/>
+            <insert string="ෙ"/>
+            <shift-to id="state-independent-state"/>
+          </case>
+          <case>
+            <expr operator="&amp;">
+              <expr operator="=">
+                <variable-reference id="@0" type="predefined"/>
+                <int-val>0x0DDB</int-val>
+              </expr>
+              <expr operator="&lt;">
+                <variable-reference id="@2" type="predefined"/>
+                <int-val>0</int-val>
+              </expr>
+            </expr>
+            <move-to-marker position="@0"/>
+            <delete-to-marker position="@next"/>
+            <move-to-marker position="@last"/>
+            <insert string="ෛ"/>
+            <shift-to id="state-independent-state"/>
+          </case>
+          <case>
+            <int-val>1</int-val>
+            <delete-to-marker markerID="p"/>
+            <pushback-n-events n="1"/>
+            <shift-to id="state-preedit"/>
+          </case>
+        </conditional>
+      </branch>
+      <branch branch-selecting-map="map-kombuva">
+        <mark-current-position markerID="p"/>
+        <conditional>
+          <case>
+            <expr operator="&amp;">
+              <expr operator="=">
+                <variable-reference id="@0" type="predefined"/>
+                <int-val>0x0DD9</int-val>
+              </expr>
+              <expr operator="&lt;">
+                <variable-reference id="@2" type="predefined"/>
+                <int-val>0</int-val>
+              </expr>
+            </expr>
+            <delete-to-marker position="@first"/>
+            <insert string="ෛ"/>
+          </case>
+          <case>
+            <int-val>1</int-val>
+            <delete-to-marker position="@previous"/>
+            <pushback-n-events n="1"/>
+            <shift-to id="state-preedit"/>
+          </case>
+        </conditional>
+      </branch>
+      <branch branch-selecting-map="map-dependent">
+        <mark-current-position markerID="p"/>
+      </branch>
+      <branch branch-selecting-map="map-backspace">
+        <undo/>
+      </branch>
+    </state>
   </state-list>
 </input-method>
\ No newline at end of file