Loading ...
Sorry, an error occurred while loading the content.

Patch 7.3.341

Expand Messages
  • Bram Moolenaar
    Patch 7.3.341 Problem: Local help files are only listed in help.txt, not in translated help files. Solution: Also find translated help files. (Yasuhiro
    Message 1 of 1 , Oct 20, 2011
    • 0 Attachment
      Patch 7.3.341
      Problem: Local help files are only listed in help.txt, not in translated
      help files.
      Solution: Also find translated help files. (Yasuhiro Matsumoto)
      Files: src/ex_cmds.c


      *** ../vim-7.3.340/src/ex_cmds.c 2011-09-30 17:30:27.000000000 +0200
      --- src/ex_cmds.c 2011-10-20 17:39:45.000000000 +0200
      ***************
      *** 5982,5987 ****
      --- 5982,5988 ----
      char_u *line;
      int in_example = FALSE;
      int len;
      + char_u *fname;
      char_u *p;
      char_u *rt;
      int mustfree;
      ***************
      *** 6028,6151 ****
      }

      /*
      ! * In the "help.txt" file, add the locally added help files.
      ! * This uses the very first line in the help file.
      */
      ! if (fnamecmp(gettail(curbuf->b_fname), "help.txt") == 0)
      {
      for (lnum = 1; lnum < curbuf->b_ml.ml_line_count; ++lnum)
      {
      line = ml_get_buf(curbuf, lnum, FALSE);
      ! if (strstr((char *)line, "*local-additions*") != NULL)
      {
      ! /* Go through all directories in 'runtimepath', skipping
      ! * $VIMRUNTIME. */
      ! p = p_rtp;
      ! while (*p != NUL)
      {
      ! copy_option_part(&p, NameBuff, MAXPATHL, ",");
      ! mustfree = FALSE;
      ! rt = vim_getenv((char_u *)"VIMRUNTIME", &mustfree);
      ! if (fullpathcmp(rt, NameBuff, FALSE) != FPC_SAME)
      ! {
      ! int fcount;
      ! char_u **fnames;
      ! FILE *fd;
      ! char_u *s;
      ! int fi;
      #ifdef FEAT_MBYTE
      ! vimconv_T vc;
      ! char_u *cp;
      #endif

      ! /* Find all "doc/ *.txt" files in this directory. */
      ! add_pathsep(NameBuff);
      ! STRCAT(NameBuff, "doc/*.txt");
      ! if (gen_expand_wildcards(1, &NameBuff, &fcount,
      ! &fnames, EW_FILE|EW_SILENT) == OK
      ! && fcount > 0)
      {
      ! for (fi = 0; fi < fcount; ++fi)
      {
      ! fd = mch_fopen((char *)fnames[fi], "r");
      ! if (fd != NULL)
      {
      ! vim_fgets(IObuff, IOSIZE, fd);
      ! if (IObuff[0] == '*'
      ! && (s = vim_strchr(IObuff + 1, '*'))
      ! != NULL)
      ! {
      ! #ifdef FEAT_MBYTE
      ! int this_utf = MAYBE;
      #endif
      ! /* Change tag definition to a
      ! * reference and remove <CR>/<NL>. */
      ! IObuff[0] = '|';
      ! *s = '|';
      ! while (*s != NUL)
      ! {
      ! if (*s == '\r' || *s == '\n')
      ! *s = NUL;
      #ifdef FEAT_MBYTE
      ! /* The text is utf-8 when a byte
      ! * above 127 is found and no
      ! * illegal byte sequence is found.
      ! */
      ! if (*s >= 0x80 && this_utf != FALSE)
      ! {
      ! int l;
      !
      ! this_utf = TRUE;
      ! l = utf_ptr2len(s);
      ! if (l == 1)
      ! this_utf = FALSE;
      ! s += l - 1;
      ! }
      #endif
      ! ++s;
      ! }
      #ifdef FEAT_MBYTE
      ! /* The help file is latin1 or utf-8;
      ! * conversion to the current
      ! * 'encoding' may be required. */
      ! vc.vc_type = CONV_NONE;
      ! convert_setup(&vc, (char_u *)(
      ! this_utf == TRUE ? "utf-8"
      ! : "latin1"), p_enc);
      ! if (vc.vc_type == CONV_NONE)
      ! /* No conversion needed. */
      ! cp = IObuff;
      ! else
      {
      ! /* Do the conversion. If it fails
      ! * use the unconverted text. */
      ! cp = string_convert(&vc, IObuff,
      ! NULL);
      ! if (cp == NULL)
      ! cp = IObuff;
      }
      ! convert_setup(&vc, NULL, NULL);

      ! ml_append(lnum, cp, (colnr_T)0, FALSE);
      ! if (cp != IObuff)
      ! vim_free(cp);
      #else
      ! ml_append(lnum, IObuff, (colnr_T)0,
      ! FALSE);
      #endif
      ! ++lnum;
      ! }
      ! fclose(fd);
      }
      }
      - FreeWild(fcount, fnames);
      }
      }
      - if (mustfree)
      - vim_free(rt);
      }
      ! break;
      }
      }
      }
      }
      --- 6029,6215 ----
      }

      /*
      ! * In the "help.txt" and "help.abx" file, add the locally added help
      ! * files. This uses the very first line in the help file.
      */
      ! fname = gettail(curbuf->b_fname);
      ! if (fnamecmp(fname, "help.txt") == 0
      ! #ifdef FEAT_MULTI_LANG
      ! || (fnamencmp(fname, "help.", 5) == 0
      ! && ASCII_ISALPHA(fname[5])
      ! && ASCII_ISALPHA(fname[6])
      ! && TOLOWER_ASC(fname[7]) == 'x'
      ! && fname[8] == NUL)
      ! #endif
      ! )
      {
      for (lnum = 1; lnum < curbuf->b_ml.ml_line_count; ++lnum)
      {
      line = ml_get_buf(curbuf, lnum, FALSE);
      ! if (strstr((char *)line, "*local-additions*") == NULL)
      ! continue;
      !
      ! /* Go through all directories in 'runtimepath', skipping
      ! * $VIMRUNTIME. */
      ! p = p_rtp;
      ! while (*p != NUL)
      {
      ! copy_option_part(&p, NameBuff, MAXPATHL, ",");
      ! mustfree = FALSE;
      ! rt = vim_getenv((char_u *)"VIMRUNTIME", &mustfree);
      ! if (fullpathcmp(rt, NameBuff, FALSE) != FPC_SAME)
      {
      ! int fcount;
      ! char_u **fnames;
      ! FILE *fd;
      ! char_u *s;
      ! int fi;
      #ifdef FEAT_MBYTE
      ! vimconv_T vc;
      ! char_u *cp;
      #endif

      ! /* Find all "doc/ *.txt" files in this directory. */
      ! add_pathsep(NameBuff);
      ! #ifdef FEAT_MULTI_LANG
      ! STRCAT(NameBuff, "doc/*.??[tx]");
      ! #else
      ! STRCAT(NameBuff, "doc/*.txt");
      ! #endif
      ! if (gen_expand_wildcards(1, &NameBuff, &fcount,
      ! &fnames, EW_FILE|EW_SILENT) == OK
      ! && fcount > 0)
      ! {
      ! #ifdef FEAT_MULTI_LANG
      ! int i1;
      ! int i2;
      ! char_u *f1;
      ! char_u *f2;
      ! char_u *t1;
      ! char_u *e1;
      ! char_u *e2;
      !
      ! /* If foo.abx is found use it instead of foo.txt in
      ! * the same directory. */
      ! for (i1 = 0; i1 < fcount; ++i1)
      {
      ! for (i2 = 0; i2 < fcount; ++i2)
      {
      ! if (i1 == i2)
      ! continue;
      ! if (fnames[i1] == NULL || fnames[i2] == NULL)
      ! continue;
      ! f1 = fnames[i1];
      ! f2 = fnames[i2];
      ! t1 = gettail(f1);
      ! if (fnamencmp(f1, f2, t1 - f1) != 0)
      ! continue;
      ! e1 = vim_strrchr(t1, '.');
      ! e2 = vim_strrchr(gettail(f2), '.');
      ! if (e1 == NUL || e2 == NUL)
      ! continue;
      ! if (fnamecmp(e1, ".txt") != 0
      ! && fnamecmp(e1, fname + 4) != 0)
      {
      ! /* Not .txt and not .abx, remove it. */
      ! vim_free(fnames[i1]);
      ! fnames[i1] = NULL;
      ! continue;
      ! }
      ! if (fnamencmp(f1, f2, e1 - f1) != 0)
      ! continue;
      ! if (fnamecmp(e1, ".txt") == 0
      ! && fnamecmp(e2, fname + 4) == 0)
      ! {
      ! /* use .abx instead of .txt */
      ! vim_free(fnames[i1]);
      ! fnames[i1] = NULL;
      ! }
      ! }
      ! }
      #endif
      ! for (fi = 0; fi < fcount; ++fi)
      ! {
      ! if (fnames[fi] == NULL)
      ! continue;
      ! fd = mch_fopen((char *)fnames[fi], "r");
      ! if (fd != NULL)
      ! {
      ! vim_fgets(IObuff, IOSIZE, fd);
      ! if (IObuff[0] == '*'
      ! && (s = vim_strchr(IObuff + 1, '*'))
      ! != NULL)
      ! {
      #ifdef FEAT_MBYTE
      ! int this_utf = MAYBE;
      #endif
      ! /* Change tag definition to a
      ! * reference and remove <CR>/<NL>. */
      ! IObuff[0] = '|';
      ! *s = '|';
      ! while (*s != NUL)
      ! {
      ! if (*s == '\r' || *s == '\n')
      ! *s = NUL;
      #ifdef FEAT_MBYTE
      ! /* The text is utf-8 when a byte
      ! * above 127 is found and no
      ! * illegal byte sequence is found.
      ! */
      ! if (*s >= 0x80 && this_utf != FALSE)
      {
      ! int l;
      !
      ! this_utf = TRUE;
      ! l = utf_ptr2len(s);
      ! if (l == 1)
      ! this_utf = FALSE;
      ! s += l - 1;
      }
      ! #endif
      ! ++s;
      ! }
      ! #ifdef FEAT_MBYTE
      ! /* The help file is latin1 or utf-8;
      ! * conversion to the current
      ! * 'encoding' may be required. */
      ! vc.vc_type = CONV_NONE;
      ! convert_setup(&vc, (char_u *)(
      ! this_utf == TRUE ? "utf-8"
      ! : "latin1"), p_enc);
      ! if (vc.vc_type == CONV_NONE)
      ! /* No conversion needed. */
      ! cp = IObuff;
      ! else
      ! {
      ! /* Do the conversion. If it fails
      ! * use the unconverted text. */
      ! cp = string_convert(&vc, IObuff,
      ! NULL);
      ! if (cp == NULL)
      ! cp = IObuff;
      ! }
      ! convert_setup(&vc, NULL, NULL);

      ! ml_append(lnum, cp, (colnr_T)0, FALSE);
      ! if (cp != IObuff)
      ! vim_free(cp);
      #else
      ! ml_append(lnum, IObuff, (colnr_T)0,
      ! FALSE);
      #endif
      ! ++lnum;
      }
      + fclose(fd);
      }
      }
      + FreeWild(fcount, fnames);
      }
      }
      ! if (mustfree)
      ! vim_free(rt);
      }
      + break;
      }
      }
      }
      *** ../vim-7.3.340/src/version.c 2011-10-20 18:12:27.000000000 +0200
      --- src/version.c 2011-10-20 18:13:46.000000000 +0200
      ***************
      *** 711,712 ****
      --- 711,714 ----
      { /* Add new patch number below this line */
      + /**/
      + 341,
      /**/

      --
      From "know your smileys":
      :-)-O Smiling doctor with stethoscope

      /// Bram Moolenaar -- Bram@... -- 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
    Your message has been successfully submitted and would be delivered to recipients shortly.