void InsertTextAtCursor(string str)
{
int prev_lines = LineCount;
text.Insert(cursor, str);
ComputeRendered();
if (prev_lines != LineCount)
{
Console.SetCursorPosition(0, home_row);
Render();
cursor += str.Length;
ForceCursor(cursor);
}
else
{
RenderFrom(cursor);
cursor += str.Length;
ForceCursor(cursor);
UpdateHomeRow(TextToScreenPos(cursor));
}
}