From: Peter G. <pe...@ar...> - 2003-05-28 15:41:47
|
On Wed, 28 May 2003 at 16:40:10 +0200, Axel Bodemer wrote: > Hi, > > this ist my testcase: > > <?PHP > > function fct_check_form_schritt_4() { > > > print " > dddddddddd "; > > > if( _DEBUG ) print "<br>TESTING"; > > } > > ?> > > If I fold on the 'function' line , the fold ends befor the line with > the 'dddddd'. In the absence of explicit fold markers, j's folding is based on indentation. Since "ddd..." is in the first column, it terminates the fold. If you move "ddd..." over to line up under "print" (or possibly even further to the right), the fold ends at the '}', which is what you want. jEdit has a similar problem when "ddd..." is in the first column, although the symptoms are slightly different (I think the overall behavior is no better). I think this problem is only fixable by building some intelligence about program block structure into the folding code. This is possible in theory, but it would be a fair bit of work, since each mode has its own idea of program block structure, except of course for the modes that have no program block structure at all. The right way to do it would probably be to keep the generic behavior the way it is now, and come up with some mechanism whereby each mode could override this behavior with its own more knowledgeable treatment of the situation, if it so desired. So Editor.fold() would end up looking something like this: public void fold() { if (dot == null) return; if (!foldRegionInternal() && !foldExplicit()) if (!getMode().fold(this)) // Added. foldNearLine(getDotLine()); } where AbstractMode.fold() just does nothing and returns false. Then you'd be able to implement PHPMode.fold(), for example, to do the right mode-specific thing. I'd be glad to consider a patch that implements this functionality. -Peter |