]> git.proxmox.com Git - mirror_xterm.js.git/commitdiff
fixing whitespaces
authorJörg Breitbart <jerch@rockborn.de>
Sun, 16 Jul 2017 11:44:00 +0000 (13:44 +0200)
committerJörg Breitbart <jerch@rockborn.de>
Sun, 16 Jul 2017 11:44:00 +0000 (13:44 +0200)
src/InputHandler.test.ts
src/InputHandler.ts

index 04dca9abd6cb92558a11d37c5dfc736aeed497a2..992b1ca6bb03369d3ed3a59dcecf6c91cce21bc4 100644 (file)
@@ -156,7 +156,7 @@ const old_wcwidth = (function(opts) {
 
 describe('wcwidth', () => {
   it('same as old implementation for BMP and individual higher', () => {
-    for (let i=0; i<65536; ++i)
+    for (let i = 0; i < 65536; ++i)
       assert.equal(wcwidth(i), old_wcwidth(i));
     // test some individual higher to fullfill branching
     assert.equal(wcwidth(0x10A01), old_wcwidth(0x10A01));
@@ -166,16 +166,16 @@ describe('wcwidth', () => {
   it('new is at least 10 times faster', () => {
     let start_new = new Date().getTime();
     let x = 0;
-    for (let runs=0; runs<1; ++runs)
+    for (let runs = 0; runs < 1; ++runs)
       for (let i=0; i<65536; ++i)
         x = wcwidth(i);
     let end_new = new Date().getTime();
     let start_old = new Date().getTime();
     let y = 0;
-    for (let runs=0; runs<1; ++runs)
-      for (let i=0; i<65536; ++i)
+    for (let runs = 0; runs < 1; ++runs)
+      for (let i = 0; i < 65536; ++i)
         y = old_wcwidth(i);
     let end_old = new Date().getTime();
-    assert.equal(((end_new-start_new)*10 < (end_old-start_old)), true);
+    assert.equal(((end_new-start_new) * 10 < (end_old-start_old)), true);
   });
 });
index 35849327a77f096997e4715fe6771610b224151d..3dec9966ca1535ff5c35326a33e6e4ebf479b8c0 100644 (file)
@@ -1601,21 +1601,21 @@ export const wcwidth = (function(opts) {
         return 1;
     }
     let table = new Uint8Array(16384);
-    for (let i=0; i<16384; ++i) {
+    for (let i = 0; i < 16384; ++i) {
         let j = i * 4;
         let num = 0;
-        num |= (wcwidthBMP(j+3));
+        num |= (wcwidthBMP(j + 3));
         num <<= 2;
-        num |= (wcwidthBMP(j+2));
+        num |= (wcwidthBMP(j + 2));
         num <<= 2;
-        num |= (wcwidthBMP(j+1));
+        num |= (wcwidthBMP(j + 1));
         num <<= 2;
         num |= (wcwidthBMP(j));
         table[i] = num;
     }
     return function (num) {
-        num = num|0;
-        return (num<65536) ? (table[num>>2] >> ((num & 3) * 2))&3 : wcwidthHigh(num);
+        num = num | 0;
+        return (num < 65536) ? (table[num >> 2] >> ((num & 3) * 2)) & 3 : wcwidthHigh(num);
     }
 })({nul: 0, control: 0});  // configurable options