From: <k_s...@us...> - 2008-08-23 09:57:32
|
Revision: 13404 http://jedit.svn.sourceforge.net/jedit/?rev=13404&view=rev Author: k_satoda Date: 2008-08-23 09:57:25 +0000 (Sat, 23 Aug 2008) Log Message: ----------- Expanded care for black hole bugs (SF.net bug #950961, #1193683), to handle ... - multi line edit including folded line, - more folding modes other than 'explicit', - and modification at the middle of folded range. (SF.net patch #1999448) Modified Paths: -------------- jEdit/trunk/doc/CHANGES.txt jEdit/trunk/org/gjt/sp/jedit/textarea/BufferHandler.java Modified: jEdit/trunk/doc/CHANGES.txt =================================================================== --- jEdit/trunk/doc/CHANGES.txt 2008-08-23 09:25:30 UTC (rev 13403) +++ jEdit/trunk/doc/CHANGES.txt 2008-08-23 09:57:25 UTC (rev 13404) @@ -12,6 +12,9 @@ - Error "Invalid screen line count" was shown when scrolling in a compound edit. (SF.net patch #1990960 - Kazutoshi Satoda) +- Folded lines sometimes became invisible. + (SF.net patch #1999448 - Kazutoshi Satoda) + }}} {{{ Miscellaneous - Moved buffer list sorting options from General to View Option Pane Modified: jEdit/trunk/org/gjt/sp/jedit/textarea/BufferHandler.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/textarea/BufferHandler.java 2008-08-23 09:25:30 UTC (rev 13403) +++ jEdit/trunk/org/gjt/sp/jedit/textarea/BufferHandler.java 2008-08-23 09:57:25 UTC (rev 13404) @@ -168,16 +168,9 @@ */ public void preContentInserted(JEditBuffer buffer, int startLine, int offset, int numLines, int length) { - if (textArea.getDisplayManager() == displayManager && numLines != 0) + if(textArea.getDisplayManager() == displayManager) { - //{{{ fix for black hole bug - // if you remove the {{{ at a fold start, the fold is removed so it must be expanded otherwise }}} - // the text remains invisible - if (buffer.isFoldStart(startLine)) - { - displayManager.expandFold(startLine, false); - } - // }}} + getReadyToBreakFold(startLine); } } //}}} @@ -203,31 +196,25 @@ if(textArea.getDisplayManager() == displayManager) { - //{{{ fix for black hole bug - // if you remove the {{{ at a fold start, the fold is removed so it must be expanded otherwise }}} - // the text remains invisible - int endLine = startLine + numLines; - if (buffer.isFoldStart(endLine)) + if(numLines == 0) { - if (numLines == 0) + getReadyToBreakFold(startLine); + } + else + { + int lastLine = startLine + numLines; + if(offset != buffer.getLineStartOffset(startLine) + || offset + length != buffer.getLineStartOffset(lastLine)) { - String endLineText = buffer.getLineText(endLine); - int i = endLineText.indexOf("{{{"); // }}} - if (i != -1) - { - int lineStartOffset = buffer.getLineStartOffset(endLine); - if (offset < lineStartOffset + i + 3 && offset + length > lineStartOffset + i) - { - displayManager.expandFold(endLine, false); - } - } + getReadyToBreakFold(startLine); + getReadyToBreakFold(lastLine); } else { - displayManager.expandFold(endLine, false); + // The removal wll not modify + // any remaining lines. } } - // }}} if(numLines != 0) { @@ -455,4 +442,14 @@ endLine); } } //}}} + + //{{{ getReadyToBreakFold() method + // This is a fix for black hole bug. + // If you modify a part of folded lines, like {{{ (followed by }}}), + // the fold is removed so it must be expanded otherwise the text + // remains invisible. + private void getReadyToBreakFold(int line) + { + displayManager.expandFold(line, false); + } //}}} } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |