Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: Code Folding

by sir_lichtkind (Friar)
on Dec 30, 2008 at 12:47 UTC ( #733237=note: print w/ replies, xml ) Need Help??


in reply to Re: Code Folding
in thread Code Folding

Your' right but i was aware of that just didn't want point out all cornercases. My point was however that there is no immediat purpose to fold recursively. you have to make two operations, when i need just one to achieve the same result. hope could make this clearer now.


Kephra, a beautiful Perl Editor lives at http://kephra.sourceforge.net


Comment on Re^2: Code Folding
Re^3: Code Folding
by afresh1 (Hermit) on Dec 30, 2008 at 18:16 UTC

    Although vim has many commands for folding things, I really only use 2, za and zA. They toggle folding at the cursor, capital is recursive.

    My point is that folding can appear simple, but depending on features you want to allow it can be more complex.

    l8rZ,
    --
    andrew
      Thanks for the answer and it agrees to my gut feeling that these are the two most important. Thatswhy I put them together on the easier reachable key ("-" alt+minus and alt+shift+minus- the other 2 on plus) and on the 2 leftmost mouse keys and but the new sibling fold on right because it has also similarities with a popup menu which usually appears on right click.

      Kephra, a beautiful Perl Editor, designed along Perl like Paradigms lives at http://kephra.sourceforge.net
Re^3: Code Folding
by eric256 (Parson) on Dec 30, 2008 at 21:37 UTC

    I don't think you do acheive the same result, though i havn't managed to get the wX library to install so i'm not sure.

    sub test { # 5 important lines while ($x) { # 10 lines of good stuff } for (1..5) { # 100 lines of crap } }

    Now if you fold that recursively you get

     sub test { ... }

    and then a recursive unfold yeilds to original back. However a non recursive unfold returns

    sub test { # 5 important lines while ($x) { ... } } for (1..5) { ... } }

    So there are cases where a user might want a recursive fold/unfold, and other where they do not. Now if you through in remembering the fold state, maybe i've already folded the "100 lines of crap" but i left "10 lines of good stuff" unfolded. If i did a non recursive fold on test, and then a nonrecursive unfold i would still be able to see my "5 important lines" and the "10 lines of good stuff" but the "100 lines of crap would not be unfolded". If however you alwas do a recursive fold/unfold then as soon as i unfold test it unfolds my "100 lines of crap"


    ___________
    Eric Hodges
      because both loops are siblings in node hierarchy they get both folded by my new shiny sibling fold. differences appear just when you open the loops. if folded recursive you only see next level und can unfold further. if choden sibling fold you get all at once, because no further folding was done. but there are cases when recursive has advantages. thatsway i added it too.(see update above.)

      thank you too for answering.

      Kephra, a beautiful Perl Editor, designed along Perl like Paradigms lives at http://kephra.sourceforge.net

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://733237]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2014-12-22 06:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (111 votes), past polls