Alan
You wrote in message news:
[hidden email]...
> I want to create a view exactly like the transcript, with a running log.
> However for my particular requirements (size, frequency of update
> responsiviness etc) I am concerned about performance since I note that the
> Transcript replaces the window text for every nextPutAll, rather than
> appending to it. I am curious why the Transcript was done this way. Is it
> just not worth worrying about? Or is it problematic to append text lines
> to a textedit (I dont see any protocol for doing that).
I think you are misunderstanding the implementation. The relevant bit is in
the #flush method:
...
outputWindow
caretPosition: 0;
replaceSelection: buffer contents.
...
This moves the insertion point to the end, and then "replaces" the empty
selection with new lines of output. The net effect is to append the current
buffer contents.
One thing to consider if building a TTY-style text output window where
performance is an issue would be to only flush output from the buffer when
explicitly requested. The Transcript flushes on every #cr for convenience
and because immediate display of output can be important for debugging. One
possible approach would be to introduce a short delay between the last
output to the buffer and flushing the output. Arrival of new output would
reset the timer, so that bursts of output would only be displayed when the
output stops for a short while.
Regards
Blair