Add an option for East Asian Ambiguous character width

East Asian Ambiguous characters are traditionally treated as two column width
characters, and many fonts are designed to display them as so. There are two
types of applications that regard this width. One is terminal emulators like
hterm, and the other is applications that use libcurses. The mismatch of the
column width between these applications causes an odd rendering. Adding an
option solves this issue.

In hterm, it has a JavaScript port of wcwidth. Even though the original version
of wcwidth includes the treatment for East Asian Ambiguous characters, the
ported version omits it. This commit add this missing part and add an option to
switch the width.

Change-Id: I14b7c052202203691e57043e10bab2b2a83de51d
Reviewed-on: https://chromium-review.googlesource.com/202247
Reviewed-by: Robert Ginda <rginda@chromium.org>
Tested-by: Robert Ginda <rginda@chromium.org>
Reviewed-by: Jun Mukai <mukai@chromium.org>
diff --git a/hterm/js/hterm_terminal.js b/hterm/js/hterm_terminal.js
index 396f422..fbfae79 100644
--- a/hterm/js/hterm_terminal.js
+++ b/hterm/js/hterm_terminal.js
@@ -4,7 +4,7 @@
 
 'use strict';
 
-lib.rtdep('lib.colors', 'lib.PreferenceManager', 'lib.resource',
+lib.rtdep('lib.colors', 'lib.PreferenceManager', 'lib.resource', 'lib.wc',
           'hterm.Keyboard', 'hterm.Options', 'hterm.PreferenceManager',
           'hterm.Screen', 'hterm.ScrollPort', 'hterm.Size',
           'hterm.TextAttributes', 'hterm.VT');
@@ -273,6 +273,10 @@
       terminal.keyboard.ctrlVPaste = v;
     },
 
+    'east-asian-ambiguous-as-two-column': function(v) {
+      lib.wc.regardCjkAmbiguous = v;
+    },
+
     'enable-8-bit-control': function(v) {
       terminal.vt.enable8BitControl = !!v;
     },