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

Please! Is there anyone who can answer this question about the fold mechanism? Benji? Anyone?

Expand Messages
  • Brett Pershing Stahlman
    With foldmethod set to marker, I would expect that performing a recursive close (zC) on the outer fold in the following example would cause the inner fold to
    Message 1 of 3 , Apr 2, 2002
      With foldmethod set to marker, I would expect that performing a recursive close (zC) on the outer fold in the following example would cause the inner fold to close as well. However, if I do a non-recursive open (zo) on the outer fold immediately after the recursive close, the inner fold is open. If the inner fold had been closed by the recursive close, it should still appear closed after the enclosing fold is opened non-recursively. Am I missing something here?
       
      outer fold {{{
         inner fold {{{
            Why doesn't this
            fold close when zC
            is done on outermost
            fold?
         }}}
      }}}
       
      Thanks,
          Brett S.
    • Srinath Avadhanula
      hello! ... by recursive, it was meant in the _outward_ direction... if you press zC when you re on the _inner_ fold, the outer fold would get folded up as
      Message 2 of 3 , Apr 2, 2002
        hello!

        > With foldmethod set to marker, I would expect that performing
        > a recursive close (zC) on the outer fold in the following example
        > would cause the inner fold to close as well. However, if I do
        >
        by recursive, it was meant in the _outward_ direction... if you press zC
        when you're on the _inner_ fold, the outer fold would get folded up as
        well. not the other way around. try it out... when you did zC on the
        outer fold, the inner fold was never closed. therefore zo shows it open.
        even za would have shown it open. try using the foldclosedend() function
        to debug. the docs should explain this...

        Bram, here's a little patch for the docs in fold.txt which might clarify
        this.

        anyway, is this for a script you're writing? in that case, you can use
        the foldopen(), foldclosedend() etc functions. that should work.

        -----------------------------------%<-----------------------------------
        ~/tmp > diff -c fold.orig.txt d\:/Vim/vim61/runtime/doc/fold.txt
        *** fold.orig.txt Tue Apr 2 08:50:37 2002
        --- d:/Vim/vim61/runtime/doc/fold.txt Mon Mar 25 09:00:32 2002
        ***************
        *** 304,314 ****
        folds is opened for all lines in the selected area.

        *zO*
        ! zO Open all folds under the cursor recursively. Recursion here
        ! is carried out in the outward direction. i.e doing zO on an
        ! inner fold opens all folds within which it is contained. In
        ! Visual mode it opens all folds that are in the selected area,
        ! also those that are only partly selected.

        *zc*
        zc Close one fold under the cursor. When a count is given, that
        --- 304,312 ----
        folds is opened for all lines in the selected area.

        *zO*
        ! zO Open all folds under the cursor recursively. In Visual mode
        ! it opens all folds that are in the selected area, also those
        ! that are only partly selected.

        *zc*
        zc Close one fold under the cursor. When a count is given, that
        ***************
        *** 317,330 ****
        'foldenable' will be set.

        *zC*
        ! zC Close all folds under the cursor recursively.
        ! Recursion here is carried out in the outward direction. i.e
        ! doing zC on an inner fold closes all folds within which it is
        ! contained. In Visual mode it closes all folds that are in the
        ! selected area, also those that are only partly selected.
        ! Recursion here is carried out in the outward direction. i.e
        ! doing zC on an inner fold closes all folds within which it is
        ! contained.
        'foldenable' will be set.

        *za*
        --- 315,323 ----
        'foldenable' will be set.

        *zC*
        ! zC Close all folds under the cursor recursively. In Visual mode
        ! it closes all folds that are in the selected area, also those
        ! that are only partly selected.
        'foldenable' will be set.

        *za*
        -----------------------------------%<-----------------------------------

        hth

        srinath

        In our last exciting episode, on Tue, 2 Apr 2002, Brett Pershing Stahlman said:
        > With foldmethod set to marker, I would expect that performing
        > a recursive close (zC) on the outer fold in the following example
        > would cause the inner fold to close as well. However, if I do
        > a non-recursive open (zo) on the outer fold immediately after the
        > recursive close, the inner fold is open. If the inner fold had been
        > closed by the recursive close, it should still appear closed after the
        > enclosing fold is opened non-recursively. Am I missing something here?
        >
        > outer fold {{{
        > inner fold {{{
        > Why doesn't this
        > fold close when zC
        > is done on outermost
        > fold?
        > }}}
        > }}}
        >
        > Thanks,
        > Brett S.
        >
        >

        --
        Srinath Avadhanula
        Apr 2 8:31am
        Fourth Law of Revision:
        It is usually impractical to worry beforehand about
        interferences -- if you have none, someone will make one for you.
      • Brett Pershing Stahlman
        Srinath, Thank you very much. This does help, and I do think the patch to the docs would make things much clearer, especially since the outward recursiveness
        Message 3 of 3 , Apr 2, 2002
          Srinath,
          Thank you very much. This does help, and I do think the patch to the
          docs would make things much clearer, especially since the outward
          recursiveness for this feature is, in one sense, a bit counter-intuitive; on
          the other hand, I can see that it might be just what is desired if you have
          just descended multiple levels of folding and wish to close everything back
          up.

          Thanks again,
          Brett S.

          ----- Original Message -----
          From: Srinath Avadhanula <srinath@...>
          To: Brett Pershing Stahlman <brett.stahlman@...>
          Cc: Vim Mailing List <vim@...>
          Sent: Tuesday, April 02, 2002 10:59 AM
          Subject: Re: folding behavior [Bram, a small patch enclosed]


          >
          > hello!
          >
          > > With foldmethod set to marker, I would expect that performing
          > > a recursive close (zC) on the outer fold in the following example
          > > would cause the inner fold to close as well. However, if I do
          > >
          > by recursive, it was meant in the _outward_ direction... if you press zC
          > when you're on the _inner_ fold, the outer fold would get folded up as
          > well. not the other way around. try it out... when you did zC on the
          > outer fold, the inner fold was never closed. therefore zo shows it open.
          > even za would have shown it open. try using the foldclosedend() function
          > to debug. the docs should explain this...
          >
          > Bram, here's a little patch for the docs in fold.txt which might clarify
          > this.
          >
          > anyway, is this for a script you're writing? in that case, you can use
          > the foldopen(), foldclosedend() etc functions. that should work.
          >
          > -----------------------------------%<-----------------------------------
          > ~/tmp > diff -c fold.orig.txt d\:/Vim/vim61/runtime/doc/fold.txt
          > *** fold.orig.txt Tue Apr 2 08:50:37 2002
          > --- d:/Vim/vim61/runtime/doc/fold.txt Mon Mar 25 09:00:32 2002
          > ***************
          > *** 304,314 ****
          > folds is opened for all lines in the selected area.
          >
          > *zO*
          > ! zO Open all folds under the cursor recursively. Recursion
          here
          > ! is carried out in the outward direction. i.e doing zO on
          an
          > ! inner fold opens all folds within which it is contained.
          In
          > ! Visual mode it opens all folds that are in the selected
          area,
          > ! also those that are only partly selected.
          >
          > *zc*
          > zc Close one fold under the cursor. When a count is given,
          that
          > --- 304,312 ----
          > folds is opened for all lines in the selected area.
          >
          > *zO*
          > ! zO Open all folds under the cursor recursively. In Visual
          mode
          > ! it opens all folds that are in the selected area, also
          those
          > ! that are only partly selected.
          >
          > *zc*
          > zc Close one fold under the cursor. When a count is given,
          that
          > ***************
          > *** 317,330 ****
          > 'foldenable' will be set.
          >
          > *zC*
          > ! zC Close all folds under the cursor recursively.
          > ! Recursion here is carried out in the outward direction.
          i.e
          > ! doing zC on an inner fold closes all folds within which it
          is
          > ! contained. In Visual mode it closes all folds that are in
          the
          > ! selected area, also those that are only partly selected.
          > ! Recursion here is carried out in the outward direction.
          i.e
          > ! doing zC on an inner fold closes all folds within which it
          is
          > ! contained.
          > 'foldenable' will be set.
          >
          > *za*
          > --- 315,323 ----
          > 'foldenable' will be set.
          >
          > *zC*
          > ! zC Close all folds under the cursor recursively. In Visual
          mode
          > ! it closes all folds that are in the selected area, also
          those
          > ! that are only partly selected.
          > 'foldenable' will be set.
          >
          > *za*
          > -----------------------------------%<-----------------------------------
          >
          > hth
          >
          > srinath
          >
          > In our last exciting episode, on Tue, 2 Apr 2002, Brett Pershing Stahlman
          said:
          > > With foldmethod set to marker, I would expect that performing
          > > a recursive close (zC) on the outer fold in the following example
          > > would cause the inner fold to close as well. However, if I do
          > > a non-recursive open (zo) on the outer fold immediately after the
          > > recursive close, the inner fold is open. If the inner fold had been
          > > closed by the recursive close, it should still appear closed after the
          > > enclosing fold is opened non-recursively. Am I missing something here?
          > >
          > > outer fold {{{
          > > inner fold {{{
          > > Why doesn't this
          > > fold close when zC
          > > is done on outermost
          > > fold?
          > > }}}
          > > }}}
          > >
          > > Thanks,
          > > Brett S.
          > >
          > >
          >
          > --
          > Srinath Avadhanula
          > Apr 2 8:31am
          > Fourth Law of Revision:
          > It is usually impractical to worry beforehand about
          > interferences -- if you have none, someone will make one for you.
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.