MCPcopy Create free account
hub / github.com/beefytech/Beef / GenerateMoveCommands

Method GenerateMoveCommands

IDEHelper/BfDiff.cpp:779–827  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

777}
778
779void BfDiff::GenerateMoveCommands()
780{
781#if 0
782 for (int editCmdIdx = 0; editCmdIdx < (int)mEditCommands.size(); editCmdIdx++)
783 {
784 EditCommand* editCommand = &mEditCommands[editCmdIdx];
785 if (editCommand->mCmd == EditCommandKind_InsertLine)
786 {
787 LineData* bLineData = &mBLineDatas[editCommand->mBIdx];
788 if (bLineData->mDuplicateLineData->mDeleteEditCommandIndices.size() > 0)
789 {
790 int deleteCmdIdx = bLineData->mDuplicateLineData->mDeleteEditCommandIndices[0];
791 bLineData->mDuplicateLineData->mDeleteEditCommandIndices.erase(bLineData->mDuplicateLineData->mDeleteEditCommandIndices.begin());
792
793 // Delete followed by insert
794 if (deleteCmdIdx < editCmdIdx)
795 {
796 EditCommand* deleteCommand = &mEditCommands[deleteCmdIdx];
797
798 // With 'MoveLine', mAIdx is the src within A, and mBIdx is the dest within A
799 deleteCommand->mCmd = EditCommandKind_MoveLineFrom;
800
801 editCommand->mCmd = EditCommandKind_MoveLineTo;
802 editCommand->mAltParam = deleteCmdIdx;
803 }
804 else // Insert followed by a delete
805 {
806 EditCommand* deleteCommand = &mEditCommands[deleteCmdIdx];
807
808 LineData* aLineData = &mALineDatas[deleteCommand->mAIdx];
809 LineData* aDestLineData = &mALineDatas[editCommand->mAIdx];
810 LineData* bLineData = &mBLineDatas[editCommand->mBIdx];
811
812 editCommand->mCmd = EditCommandKind_MoveLine;
813 editCommand->mAltParam = deleteCommand->mAIdx;
814
815 deleteCommand->mCmd = EditCommandKind_None;
816
817 //TODO: FIgure out how to insert this. These edits cause our deleteEditCommandIndices to get borked
818 /*CharDiffEngine strDiffEngine(mAText, mBText);
819 strDiffEngine.mCmdInsertPos = editCmdIdx + 1;
820 strDiffEngine.mAOffset = aDestLineData->mBufStart - aLineData->mBufStart;
821 strDiffEngine.MyersDiff(aLineData->mBufStart, aLineData->mBufLength, bLineData->mBufStart, bLineData->mBufLength);*/
822 }
823 }
824 }
825 }
826#endif
827}
828
829int BfDiff::GetInsertPosition(int lineNum)
830{

Callers

nothing calls this directly

Calls 3

sizeMethod · 0.45
eraseMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected