Version: (using KDE KDE 3.1) Installed from: SuSE RPMs OS: Linux Great to see code folding now! Would be good to be able to fold everything in a file with one action (i.e. menu item and/or keyboard shortcut) so you could browse quickly through a list of code functions and expand the one you want to work on. Alternatively an setting to open files folded by default.
Got same issue on my system (SuSE 8.0 RPM) despite reading some other bug report mentionning that this is possible. May be not very clear how to achieve it! What are the shortcut for folding by the way.
View -> Code Folding -> Collapse toplevel (Alt+Control+C). Only present in CVS if my quick grepping job was correct. I have also added per-node collapse/expand shortcuts to CVS. If we can get the rest of the bugs out of the folding code it might be possible to consider a backport...
Backport? KDE 3.1 is feature and i18n frozen!
Of course you are right... upgrade to CVS if you need this.
Why did you close it? Has CVS "unfold throughout entire file" already too?
No, I'm working on it though...
Subject: kdelibs/kate/part CVS commit by rodda: Expand all folded code. Changed shortcuts for expanding and collapsing all nodes to Control+Shift+Plus/Minus, to be consistent with the expand/collapse one local node. I hope the kate devs agree this is better ;) Needs my next commit to activate the gui. CCMAIL:53577-done@bugs.kde.org M +13 -2 katecodefoldinghelpers.cpp 1.46 M +1 -0 katecodefoldinghelpers.h 1.20 M +10 -3 kateview.cpp 1.235 M +1 -0 kateview.h 1.110 --- kdelibs/kate/part/katecodefoldinghelpers.cpp #1.45:1.46 @@ -1316,4 +1316,15 @@ void KateCodeFoldingTree::collapseToplev emit regionVisibilityChangedAt(node->startLineRel); } +} + +void KateCodeFoldingTree::expandToplevelNodes(int numLines) +{ + KateLineInfo line; + for (int i = 0; i < numLines; i++) { + getLineInfo(&line, i); + + if (line.startsInVisibleBlock) + toggleRegionVisibility(i); + } } --- kdelibs/kate/part/katecodefoldinghelpers.h #1.19:1.20 @@ -161,4 +161,5 @@ class KateCodeFoldingTree : public QObje void toggleRegionVisibility (unsigned int); void collapseToplevelNodes(); + void expandToplevelNodes(int numLines); int collapseOne(int realLine); void expandOne(int realLine, int numLines); --- kdelibs/kate/part/kateview.cpp #1.234:1.235 @@ -488,6 +488,8 @@ void KateView::setupCodeFolding() { KActionCollection *ac=this->actionCollection(); - new KAction( i18n("Collapse Toplevel"), CTRL+ALT+Key_C, + new KAction( i18n("Collapse Toplevel"), CTRL+SHIFT+Key_Minus, m_doc->foldingTree(),SLOT(collapseToplevelNodes()),ac,"folding_toplevel"); + new KAction( i18n("Expand Toplevel"), CTRL+SHIFT+Key_Plus, + this,SLOT(slotExpandToplevel()),ac,"folding_expandtoplevel"); new KAction( i18n("Collapse One Local Level"), CTRL+Key_Minus, this,SLOT(slotCollapseLocal()),ac,"folding_collapselocal"); @@ -498,4 +500,9 @@ void KateView::setupCodeFolding() debugAccels->insert("KATE_DUMP_REGION_TREE",i18n("Show the code folding region tree"),"","Ctrl+Shift+Alt+D",m_doc,SLOT(dumpRegionTree())); debugAccels->setEnabled(true); +} + +void KateView::slotExpandToplevel() +{ + m_doc->foldingTree()->expandToplevelNodes(m_doc->numLines()); } --- kdelibs/kate/part/kateview.h #1.109:1.110 @@ -296,4 +296,5 @@ class KateView : public Kate::View, void slotSelectionTypeChanged(); void slotSaveCanceled( const QString& error ); + void slotExpandToplevel(); void slotCollapseLocal(); void slotExpandLocal();