add forceUnicode option. see #158.

This commit is contained in:
Christopher Jeffrey 2015-07-28 03:53:13 -07:00
parent 0f655de980
commit 6e409f2789
4 changed files with 13 additions and 1 deletions

View File

@ -339,6 +339,8 @@ The screen on which every other node renders.
- __sendFocus__ - Send focus events after mouse is enabled.
- __warnings__ - Display warnings (such as the output not being a TTY, similar
to ncurses).
- __forceUnicode__ - Force blessed to use unicode even if it is not detected
via terminfo, env variables, or windows code page.
##### Properties:

View File

@ -255,7 +255,8 @@ Program.prototype.setupTput = function() {
padding: options.padding,
extended: options.extended,
printf: options.printf,
termcap: options.termcap
termcap: options.termcap,
forceUnicode: options.forceUnicode
});
if (tput.error) {

View File

@ -2019,6 +2019,10 @@ Tput.prototype.detectFeatures = function(info) {
};
Tput.prototype.detectUnicode = function() {
if (this.options.forceUnicode) {
return true;
}
var LANG = process.env.LANG
+ ':' + process.env.LANGUAGE
+ ':' + process.env.LC_ALL

View File

@ -53,6 +53,7 @@ function Screen(options) {
dump: options.dump,
term: options.term,
resizeTimeout: options.resizeTimeout,
forceUnicode: options.forceUnicode,
tput: true,
buffer: true,
zero: true
@ -62,6 +63,10 @@ function Screen(options) {
this.program.useBuffer = true;
this.program.zero = true;
this.program.options.resizeTimeout = options.resizeTimeout;
if (options.forceUnicode) {
this.program.tput.features.unicode = true;
this.program.tput.unicode = true;
}
}
this.tput = this.program.tput;