Commit 398a6657 authored by Luis Javier Merino's avatar Luis Javier Merino Committed by Kurt Hindenburg
Browse files

Fix positioning of double width/double height runs

When there were several runs of double width/double height runs with
differing color/rendition/line draw/..., the second and subsequent runs
were positioned wrong. Fix the calculation of the starting x position to
account for double width, and fix a bug were the y position was
incremented for every run instead of for every line.

Can be tested with:
perl -E '$s="\e[0mTEST\e[32mTEST\e[0m"; say "\e#3$s\n\e#4$s"'
parent 559742f1
......@@ -182,10 +182,12 @@ namespace Konsole
}
QMatrix textScale;
bool doubleWidthLine = false;
if (y < lineProperties.size()) {
if ((lineProperties[y] & LINE_DOUBLEWIDTH) != 0) {
textScale.scale(2, 1);
doubleWidthLine = true;
}
if ((lineProperties[y] & LINE_DOUBLEHEIGHT) != 0) {
......@@ -197,7 +199,7 @@ namespace Konsole
paint.setWorldTransform(QTransform(textScale), true);
// Calculate the area in which the text will be drawn
QRect textArea = QRect(display->contentRect().left() + display->contentsRect().left() + display->terminalFont()->fontWidth() * x,
QRect textArea = QRect(display->contentRect().left() + display->contentsRect().left() + display->terminalFont()->fontWidth() * x * (doubleWidthLine ? 2 : 1),
display->contentRect().top() + display->contentsRect().top() + display->terminalFont()->fontHeight() * y,
display->terminalFont()->fontWidth() * len,
display->terminalFont()->fontHeight());
......@@ -230,14 +232,14 @@ namespace Konsole
paint.setWorldTransform(QTransform(textScale.inverted()), true);
if (y < lineProperties.size() - 1) {
if ((lineProperties[y] & LINE_DOUBLEHEIGHT) != 0) {
y++;
}
}
x += len - 1;
}
if (y < lineProperties.size() - 1) {
if ((lineProperties[y] & LINE_DOUBLEHEIGHT) != 0) {
y++;
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment