Skip to content

Commit

Permalink
readline: use native codePointAt
Browse files Browse the repository at this point in the history
Semver: patch
PR-URL: nodejs/node#825
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
  • Loading branch information
vkurchatkin authored and chrisdickinson committed Feb 23, 2015
1 parent cb22bc9 commit b41dbc2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/readline.js
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ Interface.prototype._getDisplayPos = function(str) {
var code;
str = stripVTControlCharacters(str);
for (var i = 0, len = str.length; i < len; i++) {
code = codePointAt(str, i);
code = str.codePointAt(i);
if (code >= 0x10000) { // surrogates
i++;
}
Expand Down Expand Up @@ -605,7 +605,7 @@ Interface.prototype._getCursorPos = function() {
// move the cursor to the beginning of the next line.
if (cols + 1 === columns &&
this.cursor < this.line.length &&
isFullWidthCodePoint(codePointAt(this.line, this.cursor))) {
isFullWidthCodePoint(this.line.codePointAt(this.cursor))) {
rows++;
cols = 0;
}
Expand Down Expand Up @@ -1251,7 +1251,7 @@ function getStringWidth(str) {
var width = 0;
str = stripVTControlCharacters(str);
for (var i = 0, len = str.length; i < len; i++) {
var code = codePointAt(str, i);
var code = str.codePointAt(i);
if (code >= 0x10000) { // surrogates
i++;
}
Expand Down Expand Up @@ -1331,7 +1331,8 @@ function codePointAt(str, index) {
}
return code;
}
exports.codePointAt = codePointAt;
exports.codePointAt = util.deprecate(codePointAt,
'codePointAt() is deprecated. Use String.prototype.codePointAt');


/**
Expand Down

0 comments on commit b41dbc2

Please sign in to comment.