Latest netrw doesn't work with multi-byte strings

109 views
Skip to first unread message

mattn

unread,
Dec 4, 2013, 9:52:56 PM12/4/13
to vim...@googlegroups.com
Hi list.

Currently, vim bundle netrw v149. It doesn't work with multi-byte strings.
This problem occur in v149, 150j both.

Below is a patch for v150j.

--- autoload/netrw.vim.org 2013-11-29 09:51:50.637597900 +0900
+++ autoload/netrw.vim 2013-11-29 09:53:09.361597900 +0900
@@ -8608,7 +8608,7 @@

" get the list of files contained in the current directory
let dirname = b:netrw_curdir
- let dirnamelen = s:Strlen(b:netrw_curdir)
+ let dirnamelen = strlen(b:netrw_curdir)
let filelist = glob(s:ComposePath(dirname,"*"),0,1)
let filelist = filelist + glob(s:ComposePath(dirname,".*"),0,1)
" call Decho("(LocalListing) filelist=".filelist)

- Yasuhiro Matsumoto

Charles Campbell

unread,
Dec 4, 2013, 11:14:13 PM12/4/13
to vim...@googlegroups.com
Hello!

Please use netrw v150j on my website; this problem has been addressed
earlier.
http://www.drchip.org/astronaut/vim/index.html#NETRW

Regards,
Charles Campbell

Charles Campbell

unread,
Dec 4, 2013, 11:18:17 PM12/4/13
to vim...@googlegroups.com
I'm sorry; I just noticed that you mentioned v150j. The s:Strlen()
function is (by default) using strdisplaywidth(); does this not work?
Please give me an example so I can test things out.

Thank you,
Charles Campbell

mattn

unread,
Dec 5, 2013, 12:52:12 AM12/5/13
to vim...@googlegroups.com, charles.e...@nasa.gov

dirnamelen is used for:

let pfile= strpart(pfile,dirnamelen)

* autoload/netrw.vim:L8689

A second argument of strpart should be byte size not display width.
For example, directory name contains multi-byte like follow,

c:/[][][]/foo.txt

* [] is multi-byte.

let pfile = strpart(pfile, length_until_last_slash)

length_until_last_slash should be 10. if using s:Strlen(), it become 7.
So it display broken bytes in netrw.

- Yasuhiro Matsumoto.

Charles Campbell

unread,
Dec 5, 2013, 9:35:15 PM12/5/13
to vim...@googlegroups.com
Ok, please try v150k of netrw, available on my website:
http://www.drchip.org/astronaut/vim/index.html#NETRW .

Regards,
C Campbell

mattn

unread,
Dec 5, 2013, 10:50:48 PM12/5/13
to vim...@googlegroups.com, charles.e...@nasa.gov
On Friday, December 6, 2013 11:35:15 AM UTC+9, Charles Campbell wrote:
> Ok, please try v150k of netrw, available on my website:
>
> http://www.drchip.org/astronaut/vim/index.html#NETRW .

v150k doesn't fixed this issue.

--- autoload/netrw.vim.org 2013-12-06 12:49:38.228750700 +0900
+++ autoload/netrw.vim 2013-12-06 12:49:58.907818400 +0900
@@ -8655,7 +8655,7 @@

mattn

unread,
Dec 5, 2013, 10:59:27 PM12/5/13
to vim...@googlegroups.com, charles.e...@nasa.gov
You MUST-NOT use s:Strlen in this part.
Reply all
Reply to author
Forward
0 new messages