rewrite major part of strbuffer and Scrollpad::flush