From 82928702d341ff4909b44d901644eaf7065a0a15 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Fri, 17 Apr 2015 21:17:11 -0700 Subject: [PATCH] =?UTF-8?q?surrogate.=20one=20flew=20over=20the=20?= =?UTF-8?q?=E6=9D=9C=E9=B9=83's=20nest.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/widget.js | 3 +-- test/widget-eaw.js | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/widget.js b/lib/widget.js index 4d2e0b8..18ed9ab 100644 --- a/lib/widget.js +++ b/lib/widget.js @@ -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); diff --git a/test/widget-eaw.js b/test/widget-eaw.js index 7434cdd..55329ba 100644 --- a/test/widget-eaw.js +++ b/test/widget-eaw.js @@ -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')) {