string FindColorRun(int col, int end, int row, out Color fg, out Color bg, out int fontIndex) { var line = new StringBuilder(); var item = Window.GetDisplayAttributes(col, row); fg = item.Fg; bg = item.Bg; fontIndex = item.FontIndex; line.Append(item.Code); for (var c = col + 1; c < end; ++c) { item = Window.GetDisplayAttributes(c, row); if (fg != item.Fg) { break; } if (bg != item.Bg) { break; } if (fontIndex != item.FontIndex) { break; } line.Append(item.Code); } return(line.ToString()); }