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

Patch 6.2.303

Expand Messages
  • Bram Moolenaar
    Patch 6.2.303 Problem: Cannot use Unicode digraphs while encoding is not Unicode. Solution: Convert the character from Unicode to encoding when
    Message 1 of 1 , Mar 1, 2004
    • 0 Attachment
      Patch 6.2.303
      Problem: Cannot use Unicode digraphs while 'encoding' is not Unicode.
      Solution: Convert the character from Unicode to 'encoding' when needed.
      Use the Unicode digraphs for the Macintosh. (Eckehard Berns)
      Files: src/digraph.c


      *** ../vim-6.2.302/src/digraph.c Thu Feb 5 16:04:26 2004
      --- src/digraph.c Wed Feb 25 15:12:53 2004
      ***************
      *** 390,396 ****
      };

      # else
      ! # ifdef MACOS

      /*
      * Macintosh digraphs
      --- 390,396 ----
      };

      # else
      ! # if defined(MACOS) && !defined(FEAT_MBYTE)

      /*
      * Macintosh digraphs
      ***************
      *** 813,818 ****
      --- 813,819 ----
      {'y', ':', 0xff},

      # ifdef FEAT_MBYTE
      + # define USE_UNICODE_DIGRAPHS

      {'A', '-', 0x0100},
      {'a', '-', 0x0101},
      ***************
      *** 2110,2115 ****
      --- 2111,2149 ----
      }
      }
      #ifdef FEAT_MBYTE
      + # ifdef USE_UNICODE_DIGRAPHS
      + if (retval != 0 && !enc_utf8)
      + {
      + char_u buf[6], *to;
      + vimconv_T vc;
      + int utflen;
      +
      + /*
      + * Convert the Unicode digraph to 'encoding'.
      + */
      + i = utf_char2bytes(retval, buf);
      + if (convert_setup(&vc, (char_u *)"utf-8", p_enc) == OK)
      + {
      + utflen = i;
      + to = string_convert(&vc, buf, &i);
      + if (to != NULL)
      + {
      + /* Checking for invalid values isn't very easy. Internal
      + * latin1 conversion will return char 0xbf in case it can't be
      + * converted */
      + if ((i > 1 && !has_mbyte)
      + || (vc.vc_type == CONV_TO_LATIN1 && utflen != 1
      + && to[0] == 0xbf))
      + /* assume invalid value */
      + retval = 0;
      + else
      + retval = (*mb_ptr2char)(to);
      + vim_free(to);
      + }
      + }
      + }
      + # endif
      +
      /* Ignore multi-byte characters when not in multi-byte mode. */
      if (!has_mbyte && retval > 0xff)
      retval = 0;
      ***************
      *** 2219,2230 ****
      dp = digraphdefault;
      for (i = 0; dp->char1 != NUL && !got_int; ++i)
      {
      if (getexactdigraph(dp->char1, dp->char2, FALSE) == dp->result
      ! #ifdef FEAT_MBYTE
      && (has_mbyte || dp->result <= 255)
      ! #endif
      )
      printdigraph(dp);
      ++dp;
      ui_breakcheck();
      }
      --- 2253,2277 ----
      dp = digraphdefault;
      for (i = 0; dp->char1 != NUL && !got_int; ++i)
      {
      + #if defined(USE_UNICODE_DIGRAPHS) && defined(FEAT_MBYTE)
      + digr_T tmp;
      +
      + /* May need to convert the result to 'encoding'. */
      + tmp.char1 = dp->char1;
      + tmp.char2 = dp->char2;
      + tmp.result = getexactdigraph(tmp.char1, tmp.char2, FALSE);
      + if (tmp.result != 0 && tmp.result != tmp.char2
      + && (has_mbyte || tmp.result <= 255))
      + printdigraph(&tmp);
      + #else
      +
      if (getexactdigraph(dp->char1, dp->char2, FALSE) == dp->result
      ! # ifdef FEAT_MBYTE
      && (has_mbyte || dp->result <= 255)
      ! # endif
      )
      printdigraph(dp);
      + #endif
      ++dp;
      ui_breakcheck();
      }
      *** ../vim-6.2.302/src/version.c Mon Mar 1 16:54:50 2004
      --- src/version.c Mon Mar 1 16:59:41 2004
      ***************
      *** 639,640 ****
      --- 639,642 ----
      { /* Add new patch number below this line */
      + /**/
      + 303,
      /**/

      --
      MORTICIAN: What?
      CUSTOMER: Nothing -- here's your nine pence.
      DEAD PERSON: I'm not dead!
      MORTICIAN: Here -- he says he's not dead!
      CUSTOMER: Yes, he is.
      DEAD PERSON: I'm not!
      The Quest for the Holy Grail (Monty Python)

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
      \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
    Your message has been successfully submitted and would be delivered to recipients shortly.