Patch 7.2.356

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Patch 7.2.356

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 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 -- [hidden email] -- 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
Reply | Threaded
Open this post in threaded view
|

Re: Patch 7.2.356

Chris Sutcliffe-2
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Patch 7.2.356

Lech Lorens
On 4 February 2010 04:12, Chris Sutcliffe <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: Patch 7.2.356

Chris Sutcliffe-2
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Patch 7.2.356

Benjamin Fritz


On Feb 4, 7:14 am, Chris Sutcliffe <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: Patch 7.2.356

Chris Sutcliffe-2
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Patch 7.2.356

James Vega-3
On Thu, Feb 4, 2010 at 2:27 PM, Chris Sutcliffe <[hidden email]> 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 <[hidden email]>

--
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: Patch 7.2.356

Chris Sutcliffe-2
>> 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
Reply | Threaded
Open this post in threaded view
|

Re: Patch 7.2.356

Benjamin 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:

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
Reply | Threaded
Open this post in threaded view
|

Re: Patch 7.2.356

Chris Sutcliffe-2
> 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