Currently, characters in output window has the same offset in the visible document as in the internal storage. To hide the oldest lines, or lines that are in collapsed folds, we need to use separate offsets for storage and for document.
Each character will have two offsets - the full history (absolute) offset (type long), and offset in the visible document (type int).
The existing data structures need to be updated to use long values, and to use circular arrays (so the clients can write much higher number of characters to the output, up to Long.MAX_VALUE, despite the fact that the document can display only Integer.MAX_VALUE characters).
A new structure for indicating hidden lines (in collapsed folds) will be needed, as well as a new API for defining the folds.
(In reply to comment #0)
> The existing data structures need to be updated to use long values, and to use
> circular arrays (so the clients can write much higher number of characters to
> the output, up to Long.MAX_VALUE, despite the fact that the document can
> display only Integer.MAX_VALUE characters).
It turned out that it's better and simpler to remove larger blocks of lines.
If the limit is reached, half of the lines is removed and values in all data structures are recomputed. (Fixed bug 185462.)
Created attachment 133759 [details]
Proposed Patch - API
Patch containing the API change.
Implementation of the API (in module core.output2) can be found in repository
core-main, branch output_folding_228022.
Please review API change in module openide.io (I/O APIs) that adds support for folding of lines in output window.
Thank you in advance.
Unless there are any objections, I'll integrate on Thursday. Thank you.
Fixed in http://hg.netbeans.org/core-main/rev/e0ddc2583d5a
Integrated into 'main-golden', will be available in build *201305032300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
User: Jaroslav Havlin <firstname.lastname@example.org>
Log: #228022: API for folding in Output Window