Hi Yue,
2013/08/19 Mon 10:51:08 UTC+9 WU Yue wrote:
> Hi list,
>
> If I :set encoding=utf-8, then the file name completion with Chinese
> charactors doesn't work.
>
> I use utf-8 instead of the default encoding (cp936) on windows, the
> reason is that, encoding utf-8 can distinguish Chinese punctuations in
> word motions.
>
> Platform: Windows XP.
> Affected version of vim: all versions
>
> How to produce:
> 1. set encoding=utf-8 in vimrc, then restart vim.
> 2. creat a new file with Chinese name:
> :call mkdir("c:/中文名/中文名2")
> 2. At a vim buffer, insert text: c:/中, then try to complete it with
> <C-x><C-f>, completion will say: Pattern not found. However, c:/<C-x><C-f>
> work.
I think attached patch fixes this problem.
Regards,
Ken Takata
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
# HG changeset patch
# Parent 561e223412ae790fc893722a3ae4c1989567fb73
diff --git a/src/edit.c b/src/edit.c
--- a/src/edit.c
+++ b/src/edit.c
@@ -5184,8 +5184,13 @@
}
else if (ctrl_x_mode == CTRL_X_FILES)
{
- while (--startcol >= 0 && vim_isfilec(line[startcol]))
- ;
+ char_u *p;
+
+ p = line + startcol;
+ mb_ptr_back(line, p);
+ while (vim_isfilec(PTR2CHAR(p)) && p >= line)
+ mb_ptr_back(line, p);
+ startcol = p - line;
compl_col += ++startcol;
compl_length = (int)curs_col - startcol;
compl_pattern = addstar(line + compl_col, compl_length,