sbool makeNotifyingStringBufferRotate_verbose; sclass NotifyingStringBufferRotator implements Runnable { NotifyingStringBuffer buf; IF0 getMaxChars; bool processing; // avoid endless loop *(NotifyingStringBuffer *buf, IF0 *getMaxChars) {} run { if (processing) ret; temp tempSet(this, processing := true); Int max = callF(getMaxChars); //if (makeNotifyingStringBufferRotate_verbose) System.out.println("XX " + max + " " + buf.length()); if (max == null || buf.length() <= max) ret; if (makeNotifyingStringBufferRotate_verbose) print("Rotating NotifyingStringBuffer (" + buf.length() + "/" + max + ")"); try { int newLength = max/2; int ofs = buf.length()-newLength; S newString = buf.substring(ofs); buf.setLength(0); buf.append("[...] ").append(newString); } catch (Exception e) { buf.setLength(0); } buf.trimToSize(); } } svoid makeNotifyingStringBufferRotate(NotifyingStringBuffer buf, IF0 getMaxChars) { if (hasElementWithClassShortNamed('NotifyingStringBufferRotator, buf.onChange)) ret; buf.onChange(new NotifyingStringBufferRotator(buf, getMaxChars)); }