surrogate. one flew over the 杜鹃's nest.

This commit is contained in:
Christopher Jeffrey 2015-04-17 21:17:11 -07:00
parent d49881f96b
commit 82928702d3
2 changed files with 15 additions and 7 deletions

View File

@ -5879,8 +5879,7 @@ Textarea.prototype._listener = function(ch, key) {
} else if (key.name === 'backspace') {
if (this.value.length) {
if (this.screen.fullUnicode) {
if (this.value[this.value.length - 2]
&& unicode.isSurrogate(this.value[this.value.length - 2])) {
if (unicode.isSurrogate(this.value, this.value.length - 2)) {
this.value = this.value.slice(0, -2);
} else {
this.value = this.value.slice(0, -1);

View File

@ -16,13 +16,20 @@ screen = blessed.screen({
// screen.tput.numbers.U8 = -1;
// screen.tput.strings.enter_alt_charset_mode = false;
// var DOUBLE = '杜';
// '杜'
var DOUBLE = String.fromCodePoint
? String.fromCodePoint(0x675c)
: String.fromCharCode(0x675c);
// du juan (dou gyun?)
var DU = '杜';
var JUAN = '鹃';
// var DU = String.fromCodePoint
// ? String.fromCodePoint(0x675c)
// : String.fromCharCode(0x675c);
// var DOUBLE = DU;
// var DOUBLE = String.fromCodePoint(0x1F250);
// one flew over the 杜鹃's nest.
var DOUBLE = DU + JUAN;
// var SURROGATE_DOUBLE = '𰀀';
var SURROGATE_DOUBLE = String.fromCodePoint
? String.fromCodePoint(0x30000)
@ -89,6 +96,8 @@ var lorem = 'Non eram nes' + (!~process.argv.indexOf('s') ? COMBINE : '')
+ ' legantur';
lorem = lorem.replace(/e/gi, DOUBLE);
//lorem = lorem.replace(/e/gi, DU);
//lorem = lorem.replace(/r/gi, JUAN);
// NOTE: libvte breaks when trying to display
// this surrogate pair double width character:
if (~process.argv.indexOf('vte')) {