MCPcopy Create free account
hub / github.com/KDE/kdiff3 / convertLineOnScreenToLineInSource

Method convertLineOnScreenToLineInSource

src/difftextwindow.cpp:1641–1665  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1639}
1640
1641LineRef DiffTextWindowData::convertLineOnScreenToLineInSource(const qint32 lineOnScreen, const e_CoordType coordType, const bool bFirstLine) const
1642{
1643 LineRef line;
1644 if(lineOnScreen >= 0)
1645 {
1646 if(coordType == eWrapCoords) return lineOnScreen;
1647 LineType d3lIdx = m_pDiffTextWindow->convertLineToDiff3LineIdx(lineOnScreen);
1648 if(!bFirstLine && d3lIdx >= SafeInt<LineType>(mDiff3LineVector->size()))
1649 d3lIdx = SafeInt<LineType>(mDiff3LineVector->size() - 1);
1650 if(coordType == eD3LLineCoords) return d3lIdx;
1651 while(!line.isValid() && d3lIdx < SafeInt<LineType>(mDiff3LineVector->size()) && d3lIdx >= 0)
1652 {
1653 const Diff3Line* d3l = (*mDiff3LineVector)[d3lIdx];
1654 if(getWindowIndex() == e_SrcSelector::A) line = d3l->getLineA();
1655 if(getWindowIndex() == e_SrcSelector::B) line = d3l->getLineB();
1656 if(getWindowIndex() == e_SrcSelector::C) line = d3l->getLineC();
1657 if(bFirstLine)
1658 ++d3lIdx;
1659 else
1660 --d3lIdx;
1661 }
1662 assert(coordType == eFileCoords);
1663 }
1664 return line;
1665}
1666
1667void DiffTextWindow::getSelectionRange(LineRef* pFirstLine, LineRef* pLastLine, e_CoordType coordType) const
1668{

Callers 1

getSelectionRangeMethod · 0.80

Calls 6

getLineAMethod · 0.80
getLineBMethod · 0.80
getLineCMethod · 0.80
sizeMethod · 0.45
isValidMethod · 0.45

Tested by

no test coverage detected