A line of output. Caches the rendering of this line for a given console width.
        public IronPythonConsoleControl()
            : base()
        {
            DoubleBuffered = true;
            _logicalLines = new List<OutputLine>();
            _currentLine = new OutputLine();
            _logicalLines.Add(_currentLine);

            _inputLines = new Queue<string>();
            _currentInputLine = new StringBuilder();

            BackColor = Color.White;
        }
 /// <summary>
 /// Write some text to the output. We need to take care to
 /// remember the lines, so we can reproduce the text later on.
 /// 
 /// For now, we just ignore "style".
 /// </summary>
 public void Write(string text, Style style)
 {
     var lines = text.Split(new string[]{Environment.NewLine}, StringSplitOptions.None);
     if (lines.Length == 1)
     {
         // no newlines in text
         _currentLine.Append(new OutputSpan(lines[0], _font));
     }
     else
     {
         foreach (var line in lines.Take(lines.Length - 1)) // we will treat the last line specially
         {
             _currentLine.Append(new OutputSpan(line, _font));
             _currentLine = new OutputLine(); // start a new line
             _logicalLines.Add(_currentLine);
         }
         var lastline = lines.Last();
         if (lastline != Environment.NewLine)
         {
             // reuse logic for no newlines in text
             Write(lastline, style);
         }
         // else: already handled in foreach: _lines.Add(_currentLine)
     }
     Invalidate();
 }