From ff5e64e4311bfecc6d15c520c16add2247a2bbc0 Mon Sep 17 00:00:00 2001 From: Min RK Date: Thu, 8 Jun 2017 12:51:07 +0200 Subject: [PATCH] no need to double-check second half of a surrogate pair --- notebook/static/base/js/utils.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/notebook/static/base/js/utils.js b/notebook/static/base/js/utils.js index 73551b61c..b24f0aa81 100644 --- a/notebook/static/base/js/utils.js +++ b/notebook/static/base/js/utils.js @@ -1031,7 +1031,8 @@ define([ if (char_code >= 0xD800 && char_code <= 0xDBFF) { var next_char_code = text.charCodeAt(i+1); if (next_char_code >= 0xDC00 && next_char_code <= 0xDFFF) { - char_idx -= 1; + char_idx--; + i++; } } } @@ -1046,7 +1047,8 @@ define([ if (char_code >= 0xD800 && char_code <= 0xDBFF) { var next_char_code = text.charCodeAt(i+1); if (next_char_code >= 0xDC00 && next_char_code <= 0xDFFF) { - js_idx += 1; + js_idx++; + i++; } } }