"Disabling" code-folding

Posted by on in Blogs
Code-folding was introduced into Delphi 2005, and is a means whereby sections of your code can be "collapsed", eg from this:

Code Expanded

to this:

Code collapsed

Code-folding is switched on by default, and there appears to be no way to turn it off permanently.  For those (like me) that never use it, this can be annoying, especially when you click the node to collapse code when you wanted to click elsewhere in the gutter, or you just want to have a few extra pixels of space in your editor.

The hot-key sequence for turning off code-folding is Ctrl-Shift-K-O (KO.. knock-out.. stands to reason) . Unfortunately this doesn't turn it off permanently as it is not saved between sessions. Fortunately, the setting *is* saved in desktop settings, so if you turn off code-folding and then save the desktop (View|Desktops|Save desktop...) the setting will persist for that desktop. That means you will need to turn it off in each desktop you want it saved to, and save that desktop, too.

Thanks go to Alexander Tereshchenko for the suggestion, which he made in CodeGear's newsgroups.


Comments

  • Guest
    Lachlan Gemmell Monday, 15 September 2008

    Like you I don't use cold folding however I recently found a use for it.

    Create a LiveTemplate something along these lines.

    {$REGION 'Assert'}Assert(Condition, 'Message');{$ENDREGION}

    Use it every time you write an assertion and fold it up straight away.

    Your distracting full length Assert statement is reduced to a single word, Assert, and because the region starts and ends on the same line you don't have line numbers jumping unexpectedly.

    I also change my editor colours so that the collapsed region label is less prominent than the regular code lines.

  • Guest
    ttakahashi Sunday, 28 September 2008

    Thanks, this issue is already logged as QC#66688

  • Guest
    web designing Wednesday, 7 May 2014

    very informative post,, its very useful for me

  • Please login first in order for you to submit comments
  • Page :
  • 1

Check out more tips and tricks in this development video: