]> git.proxmox.com Git - mirror_novnc.git/commitdiff
Remove character substitution
authorPierre Ossman <ossman@cendio.se>
Tue, 24 Jan 2017 11:55:54 +0000 (12:55 +0100)
committerPierre Ossman <ossman@cendio.se>
Fri, 24 Mar 2017 10:35:36 +0000 (11:35 +0100)
We can handle any Unicode codepoint now, so stop replacing symbols.

core/input/util.js
tests/test.helper.js

index 39ac905e2d104916984ec3b4cd446e1ccbb72d2e..36bcd720ccc6bbd1a1506c707f2a7d5993c41be2 100644 (file)
@@ -1,22 +1,6 @@
 import KeyTable from "./keysym.js";
 import keysyms from "./keysymdef.js";
 
-export function substituteCodepoint(cp) {
-    // Any Unicode code points which do not have corresponding keysym entries
-    // can be swapped out for another code point by adding them to this table
-    var substitutions = {
-        // {S,s} with comma below -> {S,s} with cedilla
-        0x218 : 0x15e,
-        0x219 : 0x15f,
-        // {T,t} with comma below -> {T,t} with cedilla
-        0x21a : 0x162,
-        0x21b : 0x163
-    };
-
-    var sub = substitutions[cp];
-    return sub ? sub : cp;
-}
-
 function isMac() {
     return navigator && !!(/mac/i).exec(navigator.platform);
 }
@@ -176,7 +160,7 @@ export function getKeysym(evt){
         codepoint = evt.keyCode;
     }
     if (codepoint) {
-        return keysyms.lookup(substituteCodepoint(codepoint));
+        return keysyms.lookup(codepoint);
     }
     // we could check evt.key here.
     // Legal values are defined in http://www.w3.org/TR/DOM-Level-3-Events/#key-values-list,
index 0c1ba0dc32c2797f0d2d1c4d9534da4bc6d18897..e161d34d14656c16c8f3621c9f8cc109a0f41b8b 100644 (file)
@@ -49,18 +49,6 @@ describe('Helpers', function() {
         });
     });
 
-    describe('substituteCodepoint', function() {
-        it('should replace characters which don\'t have a keysym', function() {
-            expect(KeyboardUtil.substituteCodepoint('Ș'.charCodeAt())).to.equal('Ş'.charCodeAt());
-            expect(KeyboardUtil.substituteCodepoint('ș'.charCodeAt())).to.equal('ş'.charCodeAt());
-            expect(KeyboardUtil.substituteCodepoint('Ț'.charCodeAt())).to.equal('Ţ'.charCodeAt());
-            expect(KeyboardUtil.substituteCodepoint('ț'.charCodeAt())).to.equal('ţ'.charCodeAt());
-        });
-        it('should pass other characters through unchanged', function() {
-            expect(KeyboardUtil.substituteCodepoint('T'.charCodeAt())).to.equal('T'.charCodeAt());
-        });
-    });
-
     describe('nonCharacterKey', function() {
         it('should  recognize the right keys', function() {
             expect(KeyboardUtil.nonCharacterKey({keyCode: 0xd}), 'enter').to.be.defined;
@@ -96,9 +84,6 @@ describe('Helpers', function() {
             expect(KeyboardUtil.getKeysym({which: 0x43, shiftKey: false})).to.be.equal(0x63);
             expect(KeyboardUtil.getKeysym({which: 0x43, shiftKey: true})).to.be.equal(0x43);
         });
-        it('should substitute where applicable', function() {
-            expect(KeyboardUtil.getKeysym({char : 'Ș'})).to.be.equal(0x1aa);
-        });
     });
 
     describe('Modifier Sync', function() { // return a list of fake events necessary to fix modifier state