| 930 | } |
| 931 | |
| 932 | void DiffTextWindow::convertToLinePos(qint32 x, qint32 y, LineRef& line, qint32& pos) |
| 933 | { |
| 934 | const QFontMetrics& fm = fontMetrics(); |
| 935 | qint32 fontHeight = fm.lineSpacing(); |
| 936 | |
| 937 | qint32 yOffset = d->m_firstLine * fontHeight; |
| 938 | |
| 939 | if((y + yOffset) >= 0) |
| 940 | line = (y + yOffset) / fontHeight; |
| 941 | else |
| 942 | line = LineRef::invalid; |
| 943 | |
| 944 | if(line.isValid() && (!gOptions->wordWrapOn() || (size_t)line < d->m_diff3WrapLineVector.size())) |
| 945 | { |
| 946 | QString s = d->getLineString(line); |
| 947 | QTextLayout textLayout(s, font(), this); |
| 948 | d->prepareTextLayout(textLayout); |
| 949 | pos = textLayout.lineAt(0).xToCursor(x - textLayout.position().x()); |
| 950 | } |
| 951 | else |
| 952 | pos = -1; |
| 953 | } |
| 954 | |
| 955 | class FormatRangeHelper |
| 956 | { |
nothing calls this directly
no test coverage detected