diff --git a/lib/readline.js b/lib/readline.js index 12fb97e1cbf134..d81d62c9230c91 100644 --- a/lib/readline.js +++ b/lib/readline.js @@ -588,8 +588,8 @@ Interface.prototype._wordRight = function() { function charLengthLeft(str, i) { if (i <= 0) return 0; - if (i > 1 && str.codePointAt(i - 2) > 2 ** 16 || - str.codePointAt(i - 1) > 2 ** 16) { + if (i > 1 && str.codePointAt(i - 2) >= 2 ** 16 || + str.codePointAt(i - 1) >= 2 ** 16) { return 2; } return 1; @@ -598,7 +598,7 @@ function charLengthLeft(str, i) { function charLengthAt(str, i) { if (str.length <= i) return 0; - return str.codePointAt(i) > 2 ** 16 ? 2 : 1; + return str.codePointAt(i) >= 2 ** 16 ? 2 : 1; } Interface.prototype._deleteLeft = function() {