Skip to content

Commit f6fde07

Browse files
committed
js: viml_len should return byte length
1 parent ab9f66c commit f6fde07

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

js/vimlfunc.js

+3
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ function viml_keys(obj) {
151151
}
152152

153153
function viml_len(obj) {
154+
if (typeof obj === 'string') {
155+
return unescape(encodeURIComponent(obj))
156+
}
154157
return obj.length;
155158
}
156159

js/vimlparser.js

+3
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ function viml_keys(obj) {
151151
}
152152

153153
function viml_len(obj) {
154+
if (typeof obj === 'string') {
155+
return unescape(encodeURIComponent(obj))
156+
}
154157
return obj.length;
155158
}
156159

0 commit comments

Comments
 (0)