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

vim56 - "|" in trail byte in ex command

Expand Messages
  • ASAI Kenichi
    Dear Vim developpers, Vim Version: vim 5.6 + patch 1-14 + macpatch 01 Environment: MacOS J1-8.1 Compile : +multi_byte Problem description: When multibyte
    Message 1 of 2 , Apr 3, 2000
      Dear Vim developpers,

      Vim Version: vim 5.6 + patch 1-14 + macpatch 01
      Environment: MacOS J1-8.1
      Compile : +multi_byte

      Problem description:

      When multibyte charcters are used in ex command such as

      set guifont=<font name using multibyte>

      and if the multibyte contains "|" (0x7c) in its trail byte, this "|"
      is mistakenly interpreted as the separation of ex commands.

      Patch:

      (I made this patch through "diff -c original-file new-file". If this
      is wrong, please let me know the correct way of making patch files.)

      --- cut here -------------------------------------------------------
      *** ../orig/ex_docmd.c Sat Mar 25 17:27:24 2000
      --- ex_docmd.c Tue Mar 28 14:01:48 2000
      ***************
      *** 3622,3627 ****
      --- 3622,3631 ----
      break;
      }
      }
      + #ifdef MULTI_BYTE
      + if (is_dbcs && IsLeadByte(*p))
      + ++p;
      + #endif
      }
      if (!(eap->argt & NOTRLCOM)) /* remove trailing spaces */
      del_trailing_spaces(eap->arg);
      --- cut here -------------------------------------------------------

      This patch does not take care of the malicious case where the line
      ends with only a leading byte. So you might want to add

      if (*p == NUL) break;

      after

      if (is_dbcs && IsLeadByte(*p))
      ++p;

      Sincerely,

      ---
      Kenichi Asai
    • Bram Moolenaar
      ... I see the problem. Thanks for making a patch for this. I ll bring it out as an official patch, with the extra check for NUL added: ... ***************
      Message 2 of 2 , Apr 3, 2000
        Kenichi Asai wrote:

        > Problem description:
        >
        > When multibyte charcters are used in ex command such as
        >
        > set guifont=<font name using multibyte>
        >
        > and if the multibyte contains "|" (0x7c) in its trail byte, this "|"
        > is mistakenly interpreted as the separation of ex commands.

        I see the problem. Thanks for making a patch for this. I'll bring it out as
        an official patch, with the extra check for NUL added:

        *** ../vim-5.6.51/src/ex_docmd.c Mon Mar 27 21:52:25 2000
        --- src/ex_docmd.c Mon Apr 3 09:28:24 2000
        ***************
        *** 3622,3627 ****
        --- 3622,3631 ----
        break;
        }
        }
        + #ifdef MULTI_BYTE
        + else if (is_dbcs && p[1] && IsLeadByte(*p))
        + ++p; /* skip second byte of double-byte char */
        + #endif
        }
        if (!(eap->argt & NOTRLCOM)) /* remove trailing spaces */
        del_trailing_spaces(eap->arg);

        > (I made this patch through "diff -c original-file new-file". If this
        > is wrong, please let me know the correct way of making patch files.)

        Yes, that's the right way to make a diff.

        --
        Biting someone with your natural teeth is "simple assault," while biting
        someone with your false teeth is "aggravated assault."
        [real standing law in Louisana, United States of America]

        /-/-- Bram Moolenaar --- Bram@... --- http://www.moolenaar.net --\-\
        \-\-- Vim: http://www.vim.org ---- ICCF Holland: http://www.vim.org/iccf --/-/
      Your message has been successfully submitted and would be delivered to recipients shortly.