Left-aligned bluescreen messages and replacing tabs with two spaces to avoid the question marks.

This commit is contained in:
Florian Nücke 2014-06-21 21:16:59 +02:00
parent 7cd99e8e79
commit b91c8e839d

View File

@ -282,12 +282,17 @@ abstract class GraphicsCard extends component.ManagedComponent {
else s.setBackgroundColor(0x000000) else s.setBackgroundColor(0x000000)
s.fill(0, 0, w, h, ' ') s.fill(0, 0, w, h, ' ')
try { try {
val message = "Unrecoverable error:\n" + Localization.localizeImmediately(machine.lastError) + "\n"
val wrapRegEx = s"(.{1,${math.max(1, w - 2)}})\\s".r val wrapRegEx = s"(.{1,${math.max(1, w - 2)}})\\s".r
val lines = wrapRegEx.replaceAllIn(message, m => m.group(1) + "\n").lines.toArray val lines = wrapRegEx.replaceAllIn(Localization.localizeImmediately(machine.lastError).replace("\t", " ") + "\n", m => m.group(1) + "\n").lines.toArray
val firstRow = ((h - lines.length) / 2) max 2
val message = "Unrecoverable Error"
s.set((w - message.length) / 2, firstRow - 2, message, false)
val maxLineLength = lines.map(_.length).max
val col = ((w - maxLineLength) / 2) max 0
for ((line, idx) <- lines.zipWithIndex) { for ((line, idx) <- lines.zipWithIndex) {
val col = (w - line.length) / 2 val row = firstRow + idx
val row = (h - lines.length) / 2 + idx
s.set(col, row, line, false) s.set(col, row, line, false)
} }
} }