Commit 2232ed67 authored by Luis Javier Merino's avatar Luis Javier Merino Committed by Kurt Hindenburg
Browse files

Fix selection on double width lines

TerminalDisplay::getCharacterPosition() should take double-width lines
into account to return the right column.
parent e1e832f5
......@@ -1540,8 +1540,9 @@ QPair<int, int> TerminalDisplay::getCharacterPosition(const QPoint& widgetPoint,
// column (or left-most for right-to-left input)
const int columnMax = edge ? _usedColumns : _usedColumns - 1;
const int xOffset = edge ? _terminalFont->fontWidth() / 2 : 0;
int column = qBound(0, (widgetPoint.x() + xOffset - contentsRect().left() - _contentRect.left()) / _terminalFont->fontWidth(), columnMax);
int line = qBound(0, (widgetPoint.y() - contentsRect().top() - _contentRect.top()) / _terminalFont->fontHeight(), _usedLines - 1);
bool doubleWidth = line < _lineProperties.count() && _lineProperties[line] & LINE_DOUBLEWIDTH;
int column = qBound(0, (widgetPoint.x() + xOffset - contentsRect().left() - _contentRect.left()) / _terminalFont->fontWidth() / (doubleWidth ? 2 : 1), columnMax);
return qMakePair(line, column);
}
......
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