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

Patch 7.2.356

Expand Messages
  • Bram Moolenaar
    Patch 7.2.356 Problem: When foldmethod is changed not all folds are closed as expected. Solution: In foldUpdate() correct the start position and reset
    Message 1 of 10 , Feb 3, 2010
    • 0 Attachment
      Patch 7.2.356
      Problem: When 'foldmethod' is changed not all folds are closed as expected.
      Solution: In foldUpdate() correct the start position and reset fd_flags when
      w_foldinvalid is set. (Lech Lorens)
      Files: src/fold.c


      *** ../vim-7.2.355/src/fold.c 2010-01-19 17:24:20.000000000 +0100
      --- src/fold.c 2010-02-03 18:08:11.000000000 +0100
      ***************
      *** 849,859 ****
      fold_T *fp;

      /* Mark all folds from top to bot as maybe-small. */
      ! (void)foldFind(&curwin->w_folds, curwin->w_cursor.lnum, &fp);
      while (fp < (fold_T *)curwin->w_folds.ga_data + curwin->w_folds.ga_len
      && fp->fd_top < bot)
      {
      fp->fd_small = MAYBE;
      ++fp;
      }

      --- 849,865 ----
      fold_T *fp;

      /* Mark all folds from top to bot as maybe-small. */
      ! (void)foldFind(&curwin->w_folds, top, &fp);
      while (fp < (fold_T *)curwin->w_folds.ga_data + curwin->w_folds.ga_len
      && fp->fd_top < bot)
      {
      fp->fd_small = MAYBE;
      +
      + /* Not sure if this is the right place to reset fd_flags (suggested by
      + * Lech Lorens). */
      + if (wp->w_foldinvalid)
      + fp->fd_flags = FD_LEVEL;
      +
      ++fp;
      }

      *** ../vim-7.2.355/src/version.c 2010-02-03 17:42:59.000000000 +0100
      --- src/version.c 2010-02-03 18:12:34.000000000 +0100
      ***************
      *** 683,684 ****
      --- 683,686 ----
      { /* Add new patch number below this line */
      + /**/
      + 356,
      /**/

      --
      hundred-and-one symptoms of being an internet addict:
      190. You quickly hand over your wallet, leather jacket, and car keys
      during a mugging, then proceed to beat the crap out of your
      assailant when he asks for your laptop.

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ download, build and distribute -- http://www.A-A-P.org ///
      \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

      --
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
    • Chris Sutcliffe
      ... I think this patch may have caused an undesired side affect, in that if I save a file (:w) with foldmethod set to syntax , the fold closes on the line
      Message 2 of 10 , Feb 3, 2010
      • 0 Attachment
        > Patch 7.2.356
        > Problem:    When 'foldmethod' is changed not all folds are closed as expected.
        > Solution:   In foldUpdate() correct the start position and reset fd_flags when
        >            w_foldinvalid is set. (Lech Lorens)
        > Files:      src/fold.c

        I think this patch may have caused an undesired side affect, in that
        if I save a file (:w) with foldmethod set to 'syntax', the fold closes
        on the line that I was editing.

        Chris

        --
        Chris Sutcliffe
        http://emergedesktop.org

        --
        You received this message from the "vim_dev" maillist.
        For more information, visit http://www.vim.org/maillist.php
      • Lech Lorens
        ... I can t reproduce the problem. Do you know the exact steps I have to take to do it? -- Best regards, Lech Lorens -- You received this message from the
        Message 3 of 10 , Feb 4, 2010
        • 0 Attachment
          On 4 February 2010 04:12, Chris Sutcliffe <ir0nh34d@...> wrote:
          >> Patch 7.2.356
          >> Problem:    When 'foldmethod' is changed not all folds are closed as expected.
          >> Solution:   In foldUpdate() correct the start position and reset fd_flags when
          >>            w_foldinvalid is set. (Lech Lorens)
          >> Files:      src/fold.c
          >
          > I think this patch may have caused an undesired side affect, in that
          > if I save a file (:w) with foldmethod set to 'syntax', the fold closes
          > on the line that I was editing.
          >
          > Chris

          I can't reproduce the problem. Do you know the exact steps I have to
          take to do it?

          --
          Best regards,
          Lech Lorens

          --
          You received this message from the "vim_dev" maillist.
          For more information, visit http://www.vim.org/maillist.php
        • Chris Sutcliffe
          ... I can reproduce it by editing a cpp file with foldmethod=syntax, typing zO to open a fold, go in to the previously folded function and type :w and the
          Message 4 of 10 , Feb 4, 2010
          • 0 Attachment
            > I can't reproduce the problem. Do you know the exact steps I have to
            > take to do it?

            I can reproduce it by editing a cpp file with foldmethod=syntax,
            typing 'zO' to open a fold, go in to the previously folded function
            and type ':w' and the fold is closed.

            Chris

            --
            Chris Sutcliffe
            http://emergedesktop.org

            --
            You received this message from the "vim_dev" maillist.
            For more information, visit http://www.vim.org/maillist.php
          • Ben Fritz
            ... Following these steps does not reproduce the problem for me, running the Cream install on Windows which is now up to 7.2.356. Thinking maybe something in
            Message 5 of 10 , Feb 4, 2010
            • 0 Attachment
              On Feb 4, 7:14 am, Chris Sutcliffe <ir0nh...@...> wrote:
              > > I can't reproduce the problem. Do you know the exact steps I have to
              > > take to do it?
              >
              > I can reproduce it by editing a cpp file with foldmethod=syntax,
              > typing 'zO' to open a fold, go in to the previously folded function
              > and type ':w' and the fold is closed.
              >

              Following these steps does not reproduce the problem for me, running
              the "Cream" install on Windows which is now up to 7.2.356.

              Thinking maybe something in my config was compensating for something,
              I tried again:

              gvim -N -u NONE -i NONE
              :set rtp-=$HOME/vimfiles
              :set rtp-=$HOME/vimfiles/after
              :filetype plugin indent on
              :syntax on
              :e test.c
              :set fdm=syntax

              I then open a fold for a function, edit the function, and :w.

              The fold continues to stay open.

              Maybe there's something in YOUR config causing the issue? Can you
              reproduce with none of your customizations, as I have tried?

              --
              You received this message from the "vim_dev" maillist.
              For more information, visit http://www.vim.org/maillist.php
            • Chris Sutcliffe
              ... It is indeed an issue in my config, in particular this line: au BufWritePost * nested filetype detect Which I use to re-read the ctags file so that
              Message 6 of 10 , Feb 4, 2010
              • 0 Attachment
                > Thinking maybe something in my config was compensating for something,
                > I tried again:
                >
                > gvim -N -u NONE -i NONE
                > :set rtp-=$HOME/vimfiles
                > :set rtp-=$HOME/vimfiles/after
                > :filetype plugin indent on
                > :syntax on
                > :e test.c
                > :set fdm=syntax
                >
                > I then open a fold for a function, edit the function, and :w.
                >
                > The fold continues to stay open.
                >
                > Maybe there's something in YOUR config causing the issue? Can you
                > reproduce with none of your customizations, as I have tried?

                It is indeed an issue in my config, in particular this line:

                au BufWritePost * nested filetype detect

                Which I use to re-read the ctags file so that Omni-complete has the
                latest information after a file is written. This worked without issue
                prior to this patch. Is there an alternate implementation I could use
                that would play nicely with this new implementation?

                Thank you,

                Chris

                --
                Chris Sutcliffe
                http://emergedesktop.org

                --
                You received this message from the "vim_dev" maillist.
                For more information, visit http://www.vim.org/maillist.php
              • James Vega
                ... You shouldn t need to do this. If you have something automatically updating the tags database, Vim will always be up-to-date. Vim doesn t cache tags
                Message 7 of 10 , Feb 4, 2010
                • 0 Attachment
                  On Thu, Feb 4, 2010 at 2:27 PM, Chris Sutcliffe <ir0nh34d@...> wrote:
                  >> Thinking maybe something in my config was compensating for something,
                  >> I tried again:
                  >>
                  >> gvim -N -u NONE -i NONE
                  >> :set rtp-=$HOME/vimfiles
                  >> :set rtp-=$HOME/vimfiles/after
                  >> :filetype plugin indent on
                  >> :syntax on
                  >> :e test.c
                  >> :set fdm=syntax
                  >>
                  >> I then open a fold for a function, edit the function, and :w.
                  >>
                  >> The fold continues to stay open.
                  >>
                  >> Maybe there's something in YOUR config causing the issue? Can you
                  >> reproduce with none of your customizations, as I have tried?
                  >
                  > It is indeed an issue in my config, in particular this line:
                  >
                  >        au BufWritePost * nested filetype detect
                  >
                  > Which I use to re-read the ctags file so that Omni-complete has the
                  > latest information after a file is written.

                  You shouldn't need to do this. If you have something automatically
                  updating the tags database, Vim will always be up-to-date. Vim doesn't
                  cache tags info. It always reads from the file. If you're seeing
                  otherwise, then it may be that the omnicompletion script is caching the
                  tag information and I'd consider that a bug.

                  --
                  James
                  GPG Key: 1024D/61326D40 2003-09-02 James Vega <jamessan@...>

                  --
                  You received this message from the "vim_dev" maillist.
                  For more information, visit http://www.vim.org/maillist.php
                • Chris Sutcliffe
                  ... I ve sorted it out... I originally had: Create tags file au FileType cpp call CreateTags() au BufWritePost * nested filetype detect Where: Create
                  Message 8 of 10 , Feb 4, 2010
                  • 0 Attachment
                    >> It is indeed an issue in my config, in particular this line:
                    >>
                    >>        au BufWritePost * nested filetype detect
                    >>
                    >> Which I use to re-read the ctags file so that Omni-complete has the
                    >> latest information after a file is written.
                    >
                    > You shouldn't need to do this.  If you have something automatically
                    > updating the tags database, Vim will always be up-to-date.  Vim doesn't
                    > cache tags info.  It always reads from the file.  If you're seeing
                    > otherwise, then it may be that the omnicompletion script is caching the
                    > tag information and I'd consider that a bug.

                    I've sorted it out... I originally had:

                    " Create tags file
                    au FileType cpp call CreateTags()
                    au BufWritePost * nested filetype detect

                    Where:

                    " Create CTags for all files in the current directory
                    function! CreateTags()
                    let currdir = expand('%:p:h')
                    let currtags = currdir.'/tags'
                    if getftime(expand('%')) > getftime(currtags)
                    silent execute '!ctags *'
                    endif
                    endfunction

                    Which would create a tags file in the current directory if the tags
                    file was older than the age of the file being opened (based on the
                    file type detection). In order to update the tags file when the file
                    was written, I had to force a file type detection again.

                    I've now changed it to:

                    " Create tags file
                    au FileType cpp call CreateTags()
                    au BufWritePost * if &ft == 'cpp' | silent execute '!ctags *' | endif

                    Which works in similar fashion but doesn't cause the undesired fold collapsing.

                    Chris

                    --
                    Chris Sutcliffe
                    http://emergedesktop.org

                    --
                    You received this message from the "vim_dev" maillist.
                    For more information, visit http://www.vim.org/maillist.php
                  • Ben Fritz
                    The original problem may have been solved, but take a look at this current vim_use thread. A new one seems to have popped up:
                    Message 9 of 10 , Feb 4, 2010
                    • 0 Attachment
                      The original problem may have been solved, but take a look at this
                      current vim_use thread. A new one seems to have popped up:

                      http://groups.google.com/group/vim_use/browse_thread/thread/9f4c69b6693e8838

                      --
                      You received this message from the "vim_dev" maillist.
                      For more information, visit http://www.vim.org/maillist.php
                    • Chris Sutcliffe
                      ... Additionally, now doing a refresh with Ctrl-L also causes all the folds to collapse (which didn t happen before). Chris -- Chris Sutcliffe
                      Message 10 of 10 , Feb 5, 2010
                      • 0 Attachment
                        > The original problem may have been solved, but take a look at this
                        > current vim_use thread. A new one seems to have popped up:
                        >
                        > http://groups.google.com/group/vim_use/browse_thread/thread/9f4c69b6693e8838

                        Additionally, now doing a refresh with Ctrl-L also causes all the
                        folds to collapse (which didn't happen before).

                        Chris

                        --
                        Chris Sutcliffe
                        http://emergedesktop.org

                        --
                        You received this message from the "vim_dev" maillist.
                        For more information, visit http://www.vim.org/maillist.php
                      Your message has been successfully submitted and would be delivered to recipients shortly.