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

[patch] Re: patchmode truncates filename

Expand Messages
  • R. Edward Ralston
    The following patch fixes a problem with patchmode truncating long filenames on MacOSX built with the Carbon GUI. This patch is against vim 6.1.255 ######
    Message 1 of 9 , Nov 13, 2002
    • 0 Attachment
      The following patch fixes a problem with 'patchmode'
      truncating long filenames on MacOSX built
      with the Carbon GUI.

      This patch is against vim 6.1.255


      ###### snip ######
      diff -C3 -r src.orig/os_mac.h src/os_mac.h
      *** src.orig/os_mac.h Sat Mar 9 10:17:30 2002
      --- src/os_mac.h Wed Nov 13 09:01:52 2002
      ***************
      *** 310,318 ****
      */
      #define CMDBUFFSIZE 1024 /* size of the command processing buffer */

      ! #define MAXPATHL 256 /* Limited by the Pascal Strings */
      !
      ! #define BASENAMELEN (32-5-1) /* length of base of filename */

      #ifndef DFLT_MAXMEM
      # define DFLT_MAXMEM 512 /* use up to 512 Kbyte for buffer */
      --- 310,322 ----
      */
      #define CMDBUFFSIZE 1024 /* size of the command processing buffer */

      ! #if defined(MACOS_X_UNIX)
      ! # define MAXPATHL 1024
      ! # define BASENAMELEN (MAXNAMLEN - 5) /* length of base of filename */
      ! #else
      ! # define MAXPATHL 256 /* Limited by the Pascal Strings */
      ! # define BASENAMELEN (32-5-1) /* length of base of filename */
      ! #endif

      #ifndef DFLT_MAXMEM
      # define DFLT_MAXMEM 512 /* use up to 512 Kbyte for buffer */
      ###### snip ######



      On 2002-11-05 11:29:59, R. Edward Ralston <eralston@...> wrote:
      > "patchmode" appears to be munging long filenames.
      >
      > In your shell do:
      >
      > touch ABCDEFGHIJKLMNOPQRSTUVWXYZ.txt
      >
      > then
      >
      > vim -u NONE -U NONE ABCDEFGHIJKLMNOPQRSTUVWXYZ.txt
      >
      > once there, type some text, then
      >
      > :set patchmode=.originalfile
      > :wq
      >
      > I then have the two files
      >
      > ABCDEFGHIJKLMNOPQRSTUVWXYZ.txt
      > ABCDEFGHIJKLMNOPQRSTUVWXYZ.originalfile
      >
      > in the current directory.
      > Shouln't that instead be
      >
      > ABCDEFGHIJKLMNOPQRSTUVWXYZ.txt.originalfile
      >
      > ???
      >
      > Thanks.
      >


      --
      do daemons dream of electric sleep()?
      R. Edward Ralston <eralston@...>
    • Benji Fisher
      ... [snip] ... Thank you! If this patch works for me, I will post new binaries soon. (It has been a while...) What is the logic behind the definition of
      Message 2 of 9 , Nov 13, 2002
      • 0 Attachment
        R. Edward Ralston wrote:
        > The following patch fixes a problem with 'patchmode'
        > truncating long filenames on MacOSX built
        > with the Carbon GUI.
        >
        > This patch is against vim 6.1.255
        >
        [snip]
        > --- 310,322 ----
        > */
        > #define CMDBUFFSIZE 1024 /* size of the command processing buffer */
        >
        > ! #if defined(MACOS_X_UNIX)
        > ! # define MAXPATHL 1024
        > ! # define BASENAMELEN (MAXNAMLEN - 5) /* length of base of filename */
        > ! #else
        > ! # define MAXPATHL 256 /* Limited by the Pascal Strings */
        > ! # define BASENAMELEN (32-5-1) /* length of base of filename */
        > ! #endif
        >
        > #ifndef DFLT_MAXMEM
        > # define DFLT_MAXMEM 512 /* use up to 512 Kbyte for buffer */
        > ###### snip ######

        Thank you! If this patch works for me, I will post new binaries
        soon. (It has been a while...) What is the logic behind the definition
        of BASENAMELEN ? I assume -5 is to allow for the extension; it that
        guaranteed to be enough? Do we not need -1 for the "."?

        --Benji Fisher
      • R. Edward Ralston
        ... I think that the -5 isn t for the extension, but instead is used when the leading . and trailing .swp are added to create the associated swap
        Message 3 of 9 , Nov 13, 2002
        • 0 Attachment
          On 2002-11-13 09:55:22, Benji Fisher <benji@...> wrote:
          > Thank you! If this patch works for me, I will post new
          > binaries soon. (It has been a while...) What is the logic
          > behind the definition of BASENAMELEN ? I assume -5 is to allow
          > for the extension; it that guaranteed to be enough? Do we not
          > need -1 for the "."?
          >
          > --Benji Fisher


          I think that the "-5" isn't for the extension, but instead
          is used when the leading "." and trailing ".swp" are added
          to create the associated swap filename.

          -e


          --
          R. Edward Ralston <eralston@...>
          Experience is what allows you to recognize a mistake the second time
          you make it.
        • Bram Moolenaar
          ... Thanks, I ll include it. -- How To Keep A Healthy Level Of Insanity: 11. Specify that your drive-through order is to go . /// Bram Moolenaar --
          Message 4 of 9 , Nov 13, 2002
          • 0 Attachment
            Ed Ralston wrote:

            > The following patch fixes a problem with 'patchmode'
            > truncating long filenames on MacOSX built
            > with the Carbon GUI.

            Thanks, I'll include it.

            --
            How To Keep A Healthy Level Of Insanity:
            11. Specify that your drive-through order is "to go".

            /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
            /// Creator of Vim - Vi IMproved -- http://www.vim.org \\\
            \\\ Project leader for A-A-P -- http://www.a-a-p.org ///
            \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///
          • Benji Fisher
            ... Sorry, I have lost some of my e-mail. I saved the patch, though, and tried it out. I do not have time to explore this more right now, but here is the
            Message 5 of 9 , Nov 17, 2002
            • 0 Attachment
              >>> On Tue, 05 Nov 2002 at 11:29:59 -0500, R. Edward Ralston wrote:
              >>>
              >>>> "patchmode" appears to be munging long filenames.
              >>>>
              >>>> In your shell do:
              >>>>
              >>>> touch ABCDEFGHIJKLMNOPQRSTUVWXYZ.txt
              >>>>
              >>>> then
              >>>>
              >>>> vim -u NONE -U NONE ABCDEFGHIJKLMNOPQRSTUVWXYZ.txt
              >>>>
              >>>> once there, type some text, then
              >>>>
              >>>> :set patchmode=.originalfile
              >>>> :wq

              Sorry, I have lost some of my e-mail. I saved the patch, though,
              and tried it out. I do not have time to explore this more right now,
              but here is the strange output of
              :let @* = system("ls") :

              abcdefghijklmnopqrstuvwxyz.originalfile
              abcdefghijklmnopqrstuvwxyz.txt
              fjdskanffnhjakfbnjsdakvnjf.originalfile
              fjdskanffnhjakfbnjsdakvnjfgnrjwvnjfkanvjksad.txt

              More strangeness: when I simply do

              :ls

              many of the longer files are not listed.

              Details: I got this lovely collection if files by doing

              :set patchmode=.originalfile
              :e abc...txt
              <add a line>
              :w
              :e fjd...txt
              <add a line>
              :w

              --Benji Fisher
            Your message has been successfully submitted and would be delivered to recipients shortly.