PageRenderTime 32ms CodeModel.GetById 2ms app.highlight 24ms RepoModel.GetById 1ms app.codeStats 0ms

/jEdit/tags/jedit-4-1-pre5/org/gjt/sp/jedit/textarea/FoldVisibilityManager.java

#
Java | 920 lines | 610 code | 116 blank | 194 comment | 173 complexity | 6825736fc8b9811023beb24a511b1698 MD5 | raw file
  1/*
  2 * FoldVisibilityManager.java - Controls fold visiblity
  3 * :tabSize=8:indentSize=8:noTabs=false:
  4 * :folding=explicit:collapseFolds=1:
  5 *
  6 * Copyright (C) 2001, 2002 Slava Pestov
  7 *
  8 * This program is free software; you can redistribute it and/or
  9 * modify it under the terms of the GNU General Public License
 10 * as published by the Free Software Foundation; either version 2
 11 * of the License, or any later version.
 12 *
 13 * This program is distributed in the hope that it will be useful,
 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 16 * GNU General Public License for more details.
 17 *
 18 * You should have received a copy of the GNU General Public License
 19 * along with this program; if not, write to the Free Software
 20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 21 */
 22
 23package org.gjt.sp.jedit.textarea;
 24
 25//{{{ Imports
 26import java.awt.Toolkit;
 27import org.gjt.sp.jedit.buffer.OffsetManager;
 28import org.gjt.sp.jedit.*;
 29//}}}
 30
 31/**
 32 * Manages fold visibility.
 33 *
 34 * This class defines methods for translating between physical and virtual
 35 * line numbers, for determining which lines are visible and which aren't,
 36 * and for expanding and collapsing folds.<p>
 37 *
 38 * Note that a "physical" line number is a line index, numbered from the
 39 * start of the buffer. A "virtual" line number is a visible line index;
 40 * lines after a collapsed fold have a virtual line number that is less
 41 * than their physical line number, for example.<p>
 42 *
 43 * You can use the <code>physicalToVirtual()</code> and
 44 * <code>virtualToPhysical()</code> methods to convert one type of line
 45 * number to another.
 46 *
 47 * @author Slava Pestov
 48 * @version $Id: FoldVisibilityManager.java 4093 2002-03-17 03:05:24Z spestov $
 49 * @since jEdit 4.0pre1
 50 */
 51public class FoldVisibilityManager
 52{
 53	//{{{ FoldVisibilityManager constructor
 54	public FoldVisibilityManager(Buffer buffer, OffsetManager offsetMgr,
 55		JEditTextArea textArea)
 56	{
 57		this.buffer = buffer;
 58		this.offsetMgr = offsetMgr;
 59		this.textArea = textArea;
 60	} //}}}
 61
 62	//{{{ isNarrowed() method
 63	/**
 64	 * Returns if the buffer has been narrowed.
 65	 * @since jEdit 4.0pre2
 66	 */
 67	public boolean isNarrowed()
 68	{
 69		return narrowed;
 70	} //}}}
 71
 72	//{{{ getVirtualLineCount() method
 73	/**
 74	 * Returns the number of virtual lines in the buffer.
 75	 * @since jEdit 4.0pre1
 76	 */
 77	public int getVirtualLineCount()
 78	{
 79		return offsetMgr.getVirtualLineCount(index);
 80	} //}}}
 81
 82	//{{{ isLineVisible() method
 83	/**
 84	 * Returns if the specified line is visible.
 85	 * @param line A physical line index
 86	 * @since jEdit 4.0pre1
 87	 */
 88	public final boolean isLineVisible(int line)
 89	{
 90		if(line < 0 || line >= offsetMgr.getLineCount())
 91			throw new ArrayIndexOutOfBoundsException(line);
 92
 93		try
 94		{
 95			buffer.readLock();
 96			return offsetMgr.isLineVisible(line,index);
 97		}
 98		finally
 99		{
100			buffer.readUnlock();
101		}
102	} //}}}
103
104	//{{{ getFirstVisibleLine() method
105	/**
106	 * Returns the physical line number of the first visible line.
107	 * @since jEdit 4.0pre3
108	 */
109	public int getFirstVisibleLine()
110	{
111		try
112		{
113			buffer.readLock();
114
115			for(int i = 0; i < buffer.getLineCount(); i++)
116			{
117				if(offsetMgr.isLineVisible(i,index))
118					return i;
119			}
120		}
121		finally
122		{
123			buffer.readUnlock();
124		}
125
126		// can't happen?
127		return -1;
128	} //}}}
129
130	//{{{ getLastVisibleLine() method
131	/**
132	 * Returns the physical line number of the last visible line.
133	 * @since jEdit 4.0pre3
134	 */
135	public int getLastVisibleLine()
136	{
137		try
138		{
139			buffer.readLock();
140
141			for(int i = buffer.getLineCount() - 1; i >= 0; i--)
142			{
143				if(offsetMgr.isLineVisible(i,index))
144					return i;
145			}
146		}
147		finally
148		{
149			buffer.readUnlock();
150		}
151
152		// can't happen?
153		return -1;
154	} //}}}
155
156	//{{{ getNextVisibleLine() method
157	/**
158	 * Returns the next visible line after the specified line index.
159	 * @param line A physical line index
160	 * @since jEdit 4.0pre1
161	 */
162	public int getNextVisibleLine(int line)
163	{
164		if(line < 0 || line >= offsetMgr.getLineCount())
165			throw new ArrayIndexOutOfBoundsException(line);
166
167		try
168		{
169			buffer.readLock();
170
171			if(line == buffer.getLineCount() - 1)
172				return -1;
173
174			for(int i = line + 1; i < buffer.getLineCount(); i++)
175			{
176				if(offsetMgr.isLineVisible(i,index))
177					return i;
178			}
179			return -1;
180		}
181		finally
182		{
183			buffer.readUnlock();
184		}
185	} //}}}
186
187	//{{{ getPrevVisibleLine() method
188	/**
189	 * Returns the previous visible line before the specified line index.
190	 * @param line A physical line index
191	 * @since jEdit 4.0pre1
192	 */
193	public int getPrevVisibleLine(int line)
194	{
195		if(line < 0 || line >= offsetMgr.getLineCount())
196			throw new ArrayIndexOutOfBoundsException(line);
197
198		try
199		{
200			buffer.readLock();
201
202			if(line == 0)
203				return -1;
204
205			for(int i = line - 1; i >= 0; i--)
206			{
207				if(offsetMgr.isLineVisible(i,index))
208					return i;
209			}
210			return -1;
211		}
212		finally
213		{
214			buffer.readUnlock();
215		}
216	} //}}}
217
218	//{{{ physicalToVirtual() method
219	/**
220	 * Converts a physical line number to a virtual line number.
221	 * @param line A physical line index
222	 * @since jEdit 4.0pre1
223	 */
224	public int physicalToVirtual(int line)
225	{
226		try
227		{
228			buffer.readLock();
229
230			if(line < 0)
231				throw new ArrayIndexOutOfBoundsException(line + " < 0");
232			else if(line >= offsetMgr.getLineCount())
233			{
234				throw new ArrayIndexOutOfBoundsException(line + " > "
235					+ buffer.getLineCount());
236			}
237
238			// optimization
239			if(getVirtualLineCount() == buffer.getLineCount())
240				return line;
241
242			while(!offsetMgr.isLineVisible(line,index) && line > 0)
243				line--;
244
245			if(line == 0 && !offsetMgr.isLineVisible(line,index))
246			{
247				// inside the top narrow.
248				return 0;
249			}
250
251			if(lastPhysical == line)
252			{
253				if(lastVirtual < 0 || lastVirtual >= offsetMgr.getVirtualLineCount(index))
254				{
255					throw new ArrayIndexOutOfBoundsException(
256						"cached: " + lastVirtual);
257				}
258			}
259			else if(line > lastPhysical && lastPhysical != -1)
260			{
261				for(;;)
262				{
263					if(lastPhysical == line)
264						break;
265
266					if(offsetMgr.isLineVisible(lastPhysical,index))
267						lastVirtual++;
268
269					if(lastPhysical == buffer.getLineCount() - 1)
270						break;
271					else
272						lastPhysical++;
273				}
274
275				if(lastVirtual < 0 || lastVirtual >= offsetMgr.getVirtualLineCount(index))
276				{
277					throw new ArrayIndexOutOfBoundsException(
278						"fwd scan: " + lastVirtual);
279				}
280			}
281			else if(line < lastPhysical && lastPhysical - line > line)
282			{
283				for(;;)
284				{
285					if(lastPhysical == line)
286						break;
287
288					if(offsetMgr.isLineVisible(lastPhysical,index))
289						lastVirtual--;
290
291					if(lastPhysical == 0)
292						break;
293					else
294						lastPhysical--;
295				}
296
297				if(lastVirtual < 0 || lastVirtual >= offsetMgr.getVirtualLineCount(index))
298				{
299					throw new ArrayIndexOutOfBoundsException(
300						"back scan: " + lastVirtual);
301				}
302			}
303			else
304			{
305				lastPhysical = 0;
306				// find first visible line
307				while(!offsetMgr.isLineVisible(lastPhysical,index))
308					lastPhysical++;
309
310				lastVirtual = 0;
311				for(;;)
312				{
313					if(lastPhysical == line)
314						break;
315
316					if(offsetMgr.isLineVisible(lastPhysical,index))
317						lastVirtual++;
318
319					if(lastPhysical == buffer.getLineCount() - 1)
320						break;
321					else
322						lastPhysical++;
323				}
324
325				if(lastVirtual < 0 || lastVirtual >= offsetMgr.getVirtualLineCount(index))
326				{
327					throw new ArrayIndexOutOfBoundsException(
328						"zero scan: " + lastVirtual);
329				}
330			}
331
332			return lastVirtual;
333		}
334		finally
335		{
336			buffer.readUnlock();
337		}
338	} //}}}
339
340	//{{{ virtualToPhysical() method
341	/**
342	 * Converts a virtual line number to a physical line number.
343	 * @param line A virtual line index
344	 * @since jEdit 4.0pre1
345	 */
346	public int virtualToPhysical(int line)
347	{
348		try
349		{
350			buffer.readLock();
351
352			if(line < 0)
353				throw new ArrayIndexOutOfBoundsException(line + " < 0");
354			else if(line >= offsetMgr.getVirtualLineCount(index))
355			{
356				throw new ArrayIndexOutOfBoundsException(line + " > "
357					+ offsetMgr.getVirtualLineCount(index));
358			}
359
360			// optimization
361			if(getVirtualLineCount() == buffer.getLineCount())
362				return line;
363
364			if(lastVirtual == line)
365			{
366				if(lastPhysical < 0 || lastPhysical >= buffer.getLineCount())
367				{
368					throw new ArrayIndexOutOfBoundsException(
369						"cached: " + lastPhysical);
370				}
371			}
372			else if(line > lastVirtual && lastVirtual != -1)
373			{
374				for(;;)
375				{
376					if(offsetMgr.isLineVisible(lastPhysical,index))
377					{
378						if(lastVirtual == line)
379							break;
380						else
381							lastVirtual++;
382					}
383
384					if(lastPhysical == buffer.getLineCount() - 1)
385						break;
386					else
387						lastPhysical++;
388				}
389
390				if(lastPhysical < 0 || lastPhysical >= buffer.getLineCount())
391				{
392					throw new ArrayIndexOutOfBoundsException(
393						"fwd scan: " + lastPhysical);
394				}
395			}
396			else if(line < lastVirtual && lastVirtual - line > line)
397			{
398				for(;;)
399				{
400					if(offsetMgr.isLineVisible(lastPhysical,index))
401					{
402						if(lastVirtual == line)
403							break;
404						else
405							lastVirtual--;
406					}
407
408					if(lastPhysical == 0)
409						break;
410					else
411						lastPhysical--;
412				}
413
414				if(lastPhysical < 0 || lastPhysical >= buffer.getLineCount())
415				{
416					throw new ArrayIndexOutOfBoundsException(
417						"back scan: " + lastPhysical);
418				}
419			}
420			else
421			{
422
423				lastPhysical = 0;
424				// find first visible line
425				while(!offsetMgr.isLineVisible(lastPhysical,index))
426					lastPhysical++;
427
428				lastVirtual = 0;
429				for(;;)
430				{
431					if(offsetMgr.isLineVisible(lastPhysical,index))
432					{
433						if(lastVirtual == line)
434							break;
435						else
436							lastVirtual++;
437					}
438
439					if(lastPhysical == buffer.getLineCount() - 1)
440						break;
441					else
442						lastPhysical++;
443				}
444
445				if(lastPhysical < 0 || lastPhysical >= buffer.getLineCount())
446				{
447					throw new ArrayIndexOutOfBoundsException(
448						"zero scan: " + lastPhysical);
449				}
450			}
451
452			return lastPhysical;
453		}
454		finally
455		{
456			buffer.readUnlock();
457		}
458	} //}}}
459
460	//{{{ collapseFold() method
461	/**
462	 * Collapses the fold at the specified physical line index.
463	 * @param line A physical line index
464	 * @since jEdit 4.0pre1
465	 */
466	public void collapseFold(int line)
467	{
468		int lineCount = buffer.getLineCount();
469		int start = 0;
470		int end = lineCount - 1;
471
472		try
473		{
474			buffer.writeLock();
475
476			// if the caret is on a collapsed fold, collapse the
477			// parent fold
478			if(line != 0
479				&& line != buffer.getLineCount() - 1
480				&& buffer.isFoldStart(line)
481				&& !offsetMgr.isLineVisible(line + 1,index))
482			{
483				line--;
484			}
485
486			int initialFoldLevel = buffer.getFoldLevel(line);
487
488			//{{{ Find fold start and end...
489			if(line != lineCount - 1
490				&& buffer.getFoldLevel(line + 1) > initialFoldLevel)
491			{
492				// this line is the start of a fold
493				start = line + 1;
494
495				for(int i = line + 1; i < lineCount; i++)
496				{
497					if(buffer.getFoldLevel(i) <= initialFoldLevel)
498					{
499						end = i - 1;
500						break;
501					}
502				}
503			}
504			else
505			{
506				boolean ok = false;
507
508				// scan backwards looking for the start
509				for(int i = line - 1; i >= 0; i--)
510				{
511					if(buffer.getFoldLevel(i) < initialFoldLevel)
512					{
513						start = i + 1;
514						ok = true;
515						break;
516					}
517				}
518
519				if(!ok)
520				{
521					// no folds in buffer
522					return;
523				}
524
525				for(int i = line + 1; i < lineCount; i++)
526				{
527					if(buffer.getFoldLevel(i) < initialFoldLevel)
528					{
529						end = i - 1;
530						break;
531					}
532				}
533			} //}}}
534
535			//{{{ Collapse the fold...
536			int delta = (end - start + 1);
537
538			for(int i = start; i <= end; i++)
539			{
540				if(offsetMgr.isLineVisible(i,index))
541					offsetMgr.setLineVisible(i,index,false);
542				else
543					delta--;
544			}
545
546			if(delta == 0)
547			{
548				// user probably pressed A+BACK_SPACE twice
549				return;
550			}
551
552			offsetMgr.setVirtualLineCount(index,
553				offsetMgr.getVirtualLineCount(index)
554				- delta);
555			//}}}
556		}
557		finally
558		{
559			buffer.writeUnlock();
560		}
561
562		foldStructureChanged();
563
564		int virtualLine = physicalToVirtual(start);
565		if(textArea.getFirstLine() > virtualLine)
566			textArea.setFirstLine(virtualLine - textArea.getElectricScroll());
567	} //}}}
568
569	//{{{ expandFold() method
570	/**
571	 * Expands the fold at the specified physical line index.
572	 * @param line A physical line index
573	 * @param fully If true, all subfolds will also be expanded
574	 * @since jEdit 4.0pre3
575	 */
576	public int expandFold(int line, boolean fully)
577	{
578		// the first sub-fold. used by JEditTextArea.expandFold().
579		int returnValue = -1;
580
581		int lineCount = buffer.getLineCount();
582		int start = 0;
583		int end = lineCount - 1;
584		int delta = 0;
585
586		try
587		{
588			buffer.writeLock();
589
590			int initialFoldLevel = buffer.getFoldLevel(line);
591
592			//{{{ Find fold start and fold end...
593			if(line != lineCount - 1
594				&& offsetMgr.isLineVisible(line,index)
595				&& !offsetMgr.isLineVisible(line + 1,index)
596				&& buffer.getFoldLevel(line + 1) > initialFoldLevel)
597			{
598				// this line is the start of a fold
599				start = line + 1;
600
601				for(int i = line + 1; i < lineCount; i++)
602				{
603					if(/* offsetMgr.isLineVisible(i,index) && */
604						buffer.getFoldLevel(i) <= initialFoldLevel)
605					{
606						end = i - 1;
607						break;
608					}
609				}
610			}
611			else
612			{
613				boolean ok = false;
614
615				// scan backwards looking for the start
616				for(int i = line - 1; i >= 0; i--)
617				{
618					if(offsetMgr.isLineVisible(i,index) && buffer.getFoldLevel(i) < initialFoldLevel)
619					{
620						start = i + 1;
621						ok = true;
622						break;
623					}
624				}
625
626				if(!ok)
627				{
628					// no folds in buffer
629					return -1;
630				}
631
632				for(int i = line + 1; i < lineCount; i++)
633				{
634					if((offsetMgr.isLineVisible(i,index) &&
635						buffer.getFoldLevel(i) < initialFoldLevel)
636						|| i == getLastVisibleLine())
637					{
638						end = i - 1;
639						break;
640					}
641				}
642			} //}}}
643
644			//{{{ Expand the fold...
645
646			// we need a different value of initialFoldLevel here!
647			initialFoldLevel = buffer.getFoldLevel(start);
648
649			for(int i = start; i <= end; i++)
650			{
651				buffer.getFoldLevel(i);
652			}
653
654			for(int i = start; i <= end; i++)
655			{
656				if(buffer.getFoldLevel(i) > initialFoldLevel)
657				{
658					if(returnValue == -1
659						&& i != 0
660						&& buffer.isFoldStart(i - 1))
661					{
662						returnValue = i - 1;
663					}
664
665					if(!offsetMgr.isLineVisible(i,index) && fully)
666					{
667						delta++;
668						offsetMgr.setLineVisible(i,index,true);
669					}
670				}
671				else if(!offsetMgr.isLineVisible(i,index))
672				{
673					delta++;
674					offsetMgr.setLineVisible(i,index,true);
675				}
676			}
677
678			offsetMgr.setVirtualLineCount(index,
679				offsetMgr.getVirtualLineCount(index)
680				+ delta);
681			//}}}
682
683			if(!fully && !offsetMgr.isLineVisible(line,index))
684			{
685				// this is a hack, and really needs to be done better.
686				expandFold(line,false);
687				return returnValue;
688			}
689		}
690		finally
691		{
692			buffer.writeUnlock();
693		}
694
695		foldStructureChanged();
696
697		int virtualLine = physicalToVirtual(start);
698		int firstLine = textArea.getFirstLine();
699		int visibleLines = textArea.getVisibleLines();
700		if(virtualLine + delta >= firstLine + visibleLines
701			&& delta < visibleLines - 1)
702		{
703			textArea.setFirstLine(virtualLine + delta - visibleLines + 1);
704		}
705
706		return returnValue;
707	} //}}}
708
709	//{{{ expandAllFolds() method
710	/**
711	 * Expands all folds.
712	 * @since jEdit 4.0pre1
713	 */
714	public void expandAllFolds()
715	{
716		try
717		{
718			buffer.writeLock();
719
720			narrowed = false;
721
722			if(offsetMgr.getVirtualLineCount(index) == buffer.getLineCount())
723				return;
724
725			offsetMgr.setVirtualLineCount(index,buffer.getLineCount());
726			for(int i = 0; i < buffer.getLineCount(); i++)
727			{
728				offsetMgr.setLineVisible(i,index,true);
729			}
730			foldStructureChanged();
731		}
732		finally
733		{
734			buffer.writeUnlock();
735		}
736	} //}}}
737
738	//{{{ expandFolds() method
739	/**
740	 * This method should only be called from <code>actions.xml</code>.
741	 * @since jEdit 4.0pre1
742	 */
743	public void expandFolds(char digit)
744	{
745		if(digit < '1' || digit > '9')
746		{
747			Toolkit.getDefaultToolkit().beep();
748			return;
749		}
750		else
751			expandFolds((int)(digit - '1') + 1);
752	} //}}}
753
754	//{{{ expandFolds() method
755	/**
756	 * Expands all folds with the specified fold level.
757	 * @param foldLevel The fold level
758	 * @since jEdit 4.0pre1
759	 */
760	public void expandFolds(int foldLevel)
761	{
762		try
763		{
764			buffer.writeLock();
765
766			narrowed = false;
767
768			// so that getFoldLevel() calling fireFoldLevelsChanged()
769			// won't break
770			offsetMgr.setVirtualLineCount(index,buffer.getLineCount());
771
772			int newVirtualLineCount = 0;
773			foldLevel = (foldLevel - 1) * buffer.getIndentSize() + 1;
774
775			/* this ensures that the first line is always visible */
776			boolean seenVisibleLine = false;
777
778			for(int i = 0; i < buffer.getLineCount(); i++)
779			{
780				if(!seenVisibleLine || buffer.getFoldLevel(i) < foldLevel)
781				{
782					seenVisibleLine = true;
783					offsetMgr.setLineVisible(i,index,true);
784					newVirtualLineCount++;
785				}
786				else
787					offsetMgr.setLineVisible(i,index,false);
788			}
789
790			offsetMgr.setVirtualLineCount(index,newVirtualLineCount);
791		}
792		finally
793		{
794			buffer.writeUnlock();
795		}
796
797		foldStructureChanged();
798	} //}}}
799
800	//{{{ narrow() method
801	/**
802	 * Narrows the visible portion of the buffer to the specified
803	 * line range.
804	 * @param start The first line
805	 * @param end The last line
806	 * @since jEdit 4.0pre1
807	 */
808	public void narrow(int start, int end)
809	{
810		if(start > end || start < 0 || end >= offsetMgr.getLineCount())
811			throw new ArrayIndexOutOfBoundsException(start + ", " + end);
812
813		// ideally, this should somehow be rolled into the below loop.
814		if(start != offsetMgr.getLineCount() - 1
815			&& !offsetMgr.isLineVisible(start + 1,index))
816			expandFold(start,false);
817
818		int virtualLineCount = offsetMgr.getVirtualLineCount(index);
819		for(int i = 0; i < start; i++)
820		{
821			if(offsetMgr.isLineVisible(i,index))
822			{
823				virtualLineCount--;
824				offsetMgr.setLineVisible(i,index,false);
825			}
826		}
827
828		for(int i = end + 1; i < buffer.getLineCount(); i++)
829		{
830			if(offsetMgr.isLineVisible(i,index))
831			{
832				virtualLineCount--;
833				offsetMgr.setLineVisible(i,index,false);
834			}
835		}
836
837		offsetMgr.setVirtualLineCount(index,virtualLineCount);
838
839		narrowed = true;
840
841		foldStructureChanged();
842
843		// Hack... need a more direct way of obtaining a view?
844		// JEditTextArea.getView() method?
845		GUIUtilities.getView(textArea).getStatus().setMessageAndClear(
846			jEdit.getProperty("view.status.narrow"));
847	} //}}}
848
849	//{{{ Methods for Buffer class to call
850
851	//{{{ _grab() method
852	/**
853	 * Do not call this method. The only reason it is public is so
854	 * that the <code>Buffer</code> class can call it.
855	 */
856	public final void _grab(int index)
857	{
858		this.index = index;
859		lastPhysical = lastVirtual = -1;
860	} //}}}
861
862	//{{{ _release() method
863	/**
864	 * Do not call this method. The only reason it is public is so
865	 * that the <code>Buffer</code> class can call it.
866	 */
867	public final void _release()
868	{
869		index = -1;
870	} //}}}
871
872	//{{{ _getIndex() method
873	/**
874	 * Do not call this method. The only reason it is public is so
875	 * that the <code>Buffer</code> class can call it.
876	 */
877	public final int _getIndex()
878	{
879		return index;
880	} //}}}
881
882	//{{{ _invalidate() method
883	/**
884	 * Do not call this method. The only reason it is public is so
885	 * that the <code>Buffer</code> class can call it.
886	 */
887	public void _invalidate(int startLine)
888	{
889		if(lastPhysical >= startLine)
890			lastPhysical = lastVirtual = -1;
891	} //}}}
892
893	//}}}
894
895	//{{{ foldStructureChanged() method
896	/**
897	 * This method is only public so that the EditPane class can call it in
898	 * response to a buffer's fold handler change.
899	 * @since jEdit 4.0pre8
900	 */
901	public void foldStructureChanged()
902	{
903		lastPhysical = lastVirtual = -1;
904		textArea.foldStructureChanged();
905	} //}}}
906
907	//{{{ Private members
908
909	//{{{ Instance variables
910	private Buffer buffer;
911	private OffsetManager offsetMgr;
912	private JEditTextArea textArea;
913	private int index;
914	private int lastPhysical;
915	private int lastVirtual;
916	private boolean narrowed;
917	//}}}
918
919	//}}}
920}