File: 01-wcwidth.diff

package info (click to toggle)
node-string-width 2.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 144 kB
  • ctags: 4
  • sloc: makefile: 4; sh: 2
file content (43 lines) | stat: -rw-r--r-- 1,261 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Description: Replace dependency on is-fullwidth-code-point with wcwidth.js.
Forwarded: https://github.com/sindresorhus/string-width/issues/4
Origin: vendor, https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=842191#10
Author: Paolo Greppi <paolo.greppi@libpf.com>

Index: node-string-width/index.js
===================================================================
--- node-string-width.orig/index.js
+++ node-string-width/index.js
@@ -1,6 +1,6 @@
 'use strict';
 const stripAnsi = require('strip-ansi');
-const isFullwidthCodePoint = require('is-fullwidth-code-point');
+const wcwidth = require('wcwidth.js');
 
 module.exports = str => {
 	if (typeof str !== 'string' || str.length === 0) {
@@ -24,11 +24,7 @@ module.exports = str => {
 			i++;
 		}
 
-		if (isFullwidthCodePoint(code)) {
-			width += 2;
-		} else {
-			width++;
-		}
+		width += wcwidth(code);
 	}
 
 	return width;
Index: node-string-width/package.json
===================================================================
--- node-string-width.orig/package.json
+++ node-string-width/package.json
@@ -45,7 +45,7 @@
     "fixed-width"
   ],
   "dependencies": {
-    "is-fullwidth-code-point": "^2.0.0",
+    "wcwidth.js": "^1.0.0",
     "strip-ansi": "^3.0.0"
   },
   "devDependencies": {