Patch 8.0.0116
Problem:    When reading English help and using CTRl-] the language from
            'helplang' is used.
Solution:   Make help tag jumps keep the language. (Tatsuki, test by Hirohito
            Higashi, closes #1249)
Files:      src/tag.c, src/testdir/test_help_tagjump.vim


*** ../vim-8.0.0115/src/tag.c   2016-12-01 17:25:16.795864620 +0100
--- src/tag.c   2016-12-01 21:25:07.384984712 +0100
***************
*** 742,748 ****
                        /* skip backslash used for escaping a command char or
                         * a backslash */
                        if (*p == '\\' && (*(p + 1) == *tagp.command
!                                       || *(p + 1) == '\\'))
                            ++p;
  
                        if (*p == TAB)
--- 742,748 ----
                        /* skip backslash used for escaping a command char or
                         * a backslash */
                        if (*p == '\\' && (*(p + 1) == *tagp.command
!                                       || *(p + 1) == '\\'))
                            ++p;
  
                        if (*p == TAB)
***************
*** 1356,1361 ****
--- 1356,1362 ----
      char_u    *help_lang_find = NULL;         /* lang to be found */
      char_u    help_lang[3];                   /* lang of current tags file */
      char_u    *saved_pat = NULL;              /* copy of pat[] */
+     int               is_txt = FALSE;                 /* flag of file 
extension */
  #endif
  
      pat_T     orgpat;                 /* holds unconverted pattern info */
***************
*** 1388,1394 ****
       */
      switch (curbuf->b_tc_flags ? curbuf->b_tc_flags : tc_flags)
      {
!       case TC_FOLLOWIC:                break;
        case TC_IGNORE:    p_ic = TRUE;  break;
        case TC_MATCH:     p_ic = FALSE; break;
        case TC_FOLLOWSCS: p_ic = ignorecase(pat); break;
--- 1389,1395 ----
       */
      switch (curbuf->b_tc_flags ? curbuf->b_tc_flags : tc_flags)
      {
!       case TC_FOLLOWIC:                break;
        case TC_IGNORE:    p_ic = TRUE;  break;
        case TC_MATCH:     p_ic = FALSE; break;
        case TC_FOLLOWSCS: p_ic = ignorecase(pat); break;
***************
*** 1476,1481 ****
--- 1477,1491 ----
       * When the tag file is case-fold sorted, it is either one or the other.
       * Only ignore case when TAG_NOIC not used or 'ignorecase' set.
       */
+ #ifdef FEAT_MULTI_LANG
+     /* Set a flag if the file extension is .txt */
+     if ((flags & TAG_KEEP_LANG)
+           && help_lang_find == NULL
+           && curbuf->b_fname != NULL
+           && (i = (int)STRLEN(curbuf->b_fname)) > 4
+           && STRICMP(curbuf->b_fname + i - 4, ".txt") == 0)
+       is_txt = TRUE;
+ #endif
  #ifdef FEAT_TAG_BINS
      orgpat.regmatch.rm_ic = ((p_ic || !noic)
                                && (findall || orgpat.headlen == 0 || !p_tbs));
***************
*** 1509,1522 ****
  #ifdef FEAT_MULTI_LANG
            if (curbuf->b_help)
            {
!               /* Prefer help tags according to 'helplang'.  Put the
!                * two-letter language name in help_lang[]. */
!               i = (int)STRLEN(tag_fname);
!               if (i > 3 && tag_fname[i - 3] == '-')
!                   STRCPY(help_lang, tag_fname + i - 2);
!               else
                    STRCPY(help_lang, "en");
! 
                /* When searching for a specific language skip tags files
                 * for other languages. */
                if (help_lang_find != NULL
--- 1519,1537 ----
  #ifdef FEAT_MULTI_LANG
            if (curbuf->b_help)
            {
!               /* Keep en if the file extension is .txt*/
!               if (is_txt)
                    STRCPY(help_lang, "en");
!               else
!               {
!                   /* Prefer help tags according to 'helplang'.  Put the
!                    * two-letter language name in help_lang[]. */
!                   i = (int)STRLEN(tag_fname);
!                   if (i > 3 && tag_fname[i - 3] == '-')
!                       STRCPY(help_lang, tag_fname + i - 2);
!                   else
!                       STRCPY(help_lang, "en");
!               }
                /* When searching for a specific language skip tags files
                 * for other languages. */
                if (help_lang_find != NULL
*** ../vim-8.0.0115/src/testdir/test_help_tagjump.vim   2016-11-17 
19:44:56.623679016 +0100
--- src/testdir/test_help_tagjump.vim   2016-12-01 21:23:59.121442847 +0100
***************
*** 141,144 ****
--- 141,176 ----
    endtry
  endfunc
  
+ func Test_help_respect_current_file_lang()
+   try
+     let list = []
+     call s:doc_config_setup()
+ 
+     if has('multi_lang')
+       function s:check_help_file_ext(help_keyword, ext)
+         exec 'help ' . a:help_keyword
+         call assert_equal(a:ext, expand('%:e'))
+         call feedkeys("\<C-]>", 'tx')
+         call assert_equal(a:ext, expand('%:e'))
+         pop
+         helpclose
+       endfunc
+ 
+       set rtp+=Xdir1/doc-ab
+       set rtp+=Xdir1/doc-ja
+ 
+       set helplang=ab
+       call s:check_help_file_ext('test-char', 'abx')
+       call s:check_help_file_ext('test-char@ja', 'jax')
+       set helplang=ab,ja
+       call s:check_help_file_ext('test-char@ja', 'jax')
+       call s:check_help_file_ext('test-char@en', 'txt')
+     endif
+   catch
+     call assert_exception('X')
+   finally
+     call s:doc_config_teardown()
+   endtry
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.0.0115/src/version.c       2016-12-01 20:37:45.415893903 +0100
--- src/version.c       2016-12-01 21:28:24.051665342 +0100
***************
*** 766,767 ****
--- 766,769 ----
  {   /* Add new patch number below this line */
+ /**/
+     116,
  /**/

-- 
Proof techniques #2: Proof by Oddity.
        SAMPLE: To prove that horses have an infinite number of legs.
(1) Horses have an even number of legs.
(2) They have two legs in back and fore legs in front.
(3) This makes a total of six legs, which certainly is an odd number of
    legs for a horse.
(4) But the only number that is both odd and even is infinity.
(5) Therefore, horses must have an infinite number of legs.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui