MCPcopy Create free account
hub / github.com/WinMerge/winmerge / Advance

Function Advance

Src/MergeDocDiffCopy.cpp:815–843  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

813};
814
815static CEPoint Advance(const CDiffTextBuffer& buf, const CEPoint& pt, int distance)
816{
817 assert(distance >= 0);
818 CEPoint ptMoved = pt;
819 while (distance > 0)
820 {
821 if (buf.GetLineFlags(ptMoved.y) & LF_GHOST)
822 break;
823 else if (ptMoved.x + distance > buf.GetLineLength(ptMoved.y))
824 {
825 distance -= buf.GetFullLineLength(ptMoved.y) - ptMoved.x;
826 ptMoved.x = 0;
827 ++ptMoved.y;
828 const int nLineCount = buf.GetLineCount();
829 if (ptMoved.y > nLineCount)
830 {
831 ptMoved.x = buf.GetLineLength(nLineCount - 1);
832 ptMoved.y = nLineCount - 1;
833 break;
834 }
835 }
836 else
837 {
838 ptMoved.x += distance;
839 distance = 0;
840 }
841 }
842 return ptMoved;
843}
844
845std::tuple<CEPoint, CEPoint, CEPoint, CEPoint> CMergeDoc::GetCharacterRange(int srcPane, int dstPane, int activePane, int nDiff,
846 const CEPoint& ptStart, const CEPoint& ptEnd)

Callers 1

GetCharacterRangeMethod · 0.70

Calls 1

assertClass · 0.85

Tested by

no test coverage detected