hterm: add a pref for default terminal encoding
This allows for easy experimentation with terminal encoding and is a
step to setting the default encoding to utf8. For now, the default is
unchanged (iso-2022/ecma-35) which means character map (graphics maps)
are available. In the future, if all goes well, we'll default to utf8
and see if anyone notices, and if they do, they'll be able to back out
in the meantime.
BUG=chromium:747625
Change-Id: Ia63542c9a97b18ec09abeb954dc2de75d682d92f
Reviewed-on: https://chromium-review.googlesource.com/591919
Reviewed-by: Brandon Gilmore <varz@google.com>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/hterm/js/hterm_terminal.js b/hterm/js/hterm_terminal.js
index 31f56ef..b802580 100644
--- a/hterm/js/hterm_terminal.js
+++ b/hterm/js/hterm_terminal.js
@@ -537,6 +537,26 @@
terminal.keyboard.shiftInsertPaste = v;
},
+ 'terminal-encoding': function(v) {
+ switch (v) {
+ default:
+ console.warn('Invalid value for "terminal-encoding": ' + v);
+ // Fall through.
+ case 'iso-2022':
+ terminal.vt.codingSystemUtf8 = false;
+ terminal.vt.codingSystemLocked = false;
+ break;
+ case 'utf-8-locked':
+ terminal.vt.codingSystemUtf8 = true;
+ terminal.vt.codingSystemLocked = true;
+ break;
+ case 'utf-8':
+ terminal.vt.codingSystemUtf8 = true;
+ terminal.vt.codingSystemLocked = false;
+ break;
+ }
+ },
+
'user-css': function(v) {
terminal.scrollPort_.setUserCssUrl(v);
},