procedure AddColorStr(s: string; const col: TColor = clBlack; const NewLine: boolean = true);
begin
with WsjtxMemo do
begin
if NewLine then
begin
writeln('---------------------print NL-----------------');
Lines.Add('');
Lines.Delete(Lines.Count - 1); // avoid double line spacing
end;
writeln('---------------------print text-----------------');
writeln('textlen',Length(s));
SelStart := length(Text);
writeln('selstart ',SelStart);
SelLength := length(s);
writeln('sellen ',SelLength);
SelText := s;
writeln('seltext ',s);
SetRangeColor(SelStart, SelLength, col);
end;
end;