Hi list.

When using vim with encoding!=utf-8, :helpgrep don't match any multi-byte 
words.
For japanese, '.jax'  is possible to add localized help files. And it must 
be utf-8 encoded.
But vim is matching the words with different encoding.

Below is a patch. Please check and include.

https://gist.github.com/1400283 

Thanks.

diff -r 379a6398d462 src/quickfix.c
--- a/src/quickfix.c Wed Oct 26 23:48:21 2011 +0200
+++ b/src/quickfix.c Mon Nov 28 21:50:56 2011 +0900
@@ -3914,6 +3914,14 @@
     regmatch.rm_ic = FALSE;
     if (regmatch.regprog != NULL)
     {
+#ifdef FEAT_MBYTE
+ vimconv_T vc;
+
+ vc.vc_type = CONV_NONE;
+ if (!enc_utf8)
+    convert_setup(&vc, "utf-8", p_enc);
+#endif
+
  /* create a new quickfix list */
  qf_new_list(qi, *eap->cmdlinep);
 
@@ -3948,21 +3956,31 @@
  lnum = 1;
  while (!vim_fgets(IObuff, IOSIZE, fd) && !got_int)
  {
-    if (vim_regexec(&regmatch, IObuff, (colnr_T)0))
+
+    char_u    *line = IObuff;
+#ifdef FEAT_MBYTE
+    if (vc.vc_type != CONV_NONE) {
+ line = string_convert(&vc, IObuff, NULL);
+ if (!line)
+    line = IObuff;
+    }
+#endif
+
+    if (vim_regexec(&regmatch, line, (colnr_T)0))
     {
- int l = (int)STRLEN(IObuff);
+ int l = (int)STRLEN(line);
 
  /* remove trailing CR, LF, spaces, etc. */
- while (l > 0 && IObuff[l - 1] <= ' ')
-     IObuff[--l] = NUL;
+ while (l > 0 && line[l - 1] <= ' ')
+     line[--l] = NUL;
 
  if (qf_add_entry(qi, &prevp,
     NULL, /* dir */
     fnames[fi],
     0,
-    IObuff,
+    line,
     lnum,
-    (int)(regmatch.startp[0] - IObuff)
+    (int)(regmatch.startp[0] - line)
  + 1, /* col */
     FALSE, /* vis_col */
     NULL, /* search pattern */
@@ -3975,6 +3993,11 @@
     break;
  }
     }
+#ifdef FEAT_MBYTE
+    if (line != IObuff)
+ vim_free(line);
+#endif
+
     ++lnum;
     line_breakcheck();
  }
@@ -3990,6 +4013,11 @@
  qi->qf_lists[qi->qf_curlist].qf_ptr =
     qi->qf_lists[qi->qf_curlist].qf_start;
  qi->qf_lists[qi->qf_curlist].qf_index = 1;
+
+#ifdef FEAT_MBYTE
+ if (vc.vc_type != CONV_NONE)
+    convert_setup(&vc, NULL, NULL);
+#endif
     }
 
     if (p_cpo == empty_option)

-- 
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

Raspunde prin e-mail lui