Revision: 4047
          http://vexi.svn.sourceforge.net/vexi/?rev=4047&view=rev
Author:   clrg
Date:     2011-03-11 04:42:32 +0000 (Fri, 11 Mar 2011)

Log Message:
-----------
Support adding circumflex (caret) accent marks in lib.text.edit using C-^

Modified Paths:
--------------
    trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/text/edit.t

Modified: trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/text/edit.t
===================================================================
--- trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/text/edit.t       
2011-03-11 04:16:52 UTC (rev 4046)
+++ trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/text/edit.t       
2011-03-11 04:42:32 UTC (rev 4047)
@@ -844,6 +844,26 @@
             findCurThreadRequest();
         }
         
+        /** applies a caret to the letter preceeding the cursor if it is valid 
*/
+        var checkAndApplyCaret = function(cb, cw, cp) {
+            if (cw==null or (cw==0 and cp==0)) {
+                return;
+            }
+            if (cp==0) {
+                cw--;
+                cp = thisbox[cb][cw].text.length;
+            }
+            var word = thisbox[cb][cw];
+            var oldt = word.text;
+            var oldc = oldt.charCodeAt(cp-1);
+            var newc = static.charCaretLookup[oldc+""];
+            if (newc!=null) {
+                var newt = oldt.substring(0, cp-1) + 
vexi.string.fromCharCode(newc) + oldt.substring(cp);
+                word.text = newt;
+                thisbox[cb].reflow();
+            }
+        }
+        
         ///////////////////////////////////////////////////////////////
         //////// Public Properties ////////////////////////////////////
         ///////////////////////////////////////////////////////////////
@@ -975,6 +995,11 @@
                     }
                     insertText(vexi.ui.clipboard);
                     break;
+                
+                // add circumflex (caret) accent
+                case "C-^":
+                    checkAndApplyCaret(cbInd, cwInd, cPos);
+                    break;
                     
                 // move cursor right
                 case "right":
@@ -2053,4 +2078,21 @@
         }
     }
     
+    static.charCaretLookup = {
+        "65":194,  "194":65,  // A->\xC2
+        "97":226,  "226":97,  // a->\xE2
+        "69":202,  "202":69,  // E->\xCA
+        "101":234, "234":101, // e->\xEA
+        "73":206,  "206":73,  // I->\xCE
+        "105":238, "238":105, // i->\xEE
+        "79":212,  "212":79,  // O->\xD4
+        "111":244, "244":111, // o->\xF4
+        "85":219,  "219":85,  // U->\xDB
+        "117":251, "251":117, // u->\xFB
+        "87":372,  "372":87,  // W->
+        "119":373, "373":119, // w->
+        "89":374,  "374":89,  // Y->
+        "121":375, "375":121  // y->
+    };
+    
 </vexi>


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to