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

Function ApplyEditCommands

IDEHelper/BfDiff.cpp:839–986  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

837
838#if 0
839void ApplyEditCommands()
840{
841 outA = mAText;
842 int aOffset = 0;
843
844 Array<int> deferredFromSources;
845
846 for (int i = 0; i < (int)outA.size(); i++)
847 {
848 outA[i] = toupper(outA[i]);
849 }
850
851 for (int editCmdIdx = 0; editCmdIdx < (int)editCommands.size(); editCmdIdx++)
852 {
853 EditCommand* editCommand = &editCommands[editCmdIdx];
854 if (editCommand->mAIdx == -1)
855 continue;
856
857 if (editCommand->mCmd == EditCommandKind_DeleteLine)
858 {
859 // Delete line
860 //outA.erase(outA.begin() + (editCommand->mAIdx + aOffset));
861 LineData* lineData = &mALineDatas[editCommand->mAIdx];
862 outA.erase(outA.begin() + (lineData->mBufStart + aOffset), outA.begin() + (lineData->mBufStart + lineData->mBufLength + aOffset));
863 aOffset -= lineData->mBufLength;
864 }
865 else if (editCommand->mCmd == EditCommandKind_DeleteChar)
866 {
867 outA.erase(
868 outA.begin() + (editCommand->mAIdx + aOffset),
869 outA.begin() + (editCommand->mAIdx + 1 + aOffset));
870 aOffset--;
871 }
872 else if (editCommand->mCmd == EditCommandKind_InsertChar)
873 {
874 outA.insert(outA.begin() + (editCommand->mAIdx + aOffset),
875 mBText.begin() + editCommand->mBIdx,
876 mBText.begin() + editCommand->mBIdx + 1);
877 aOffset++;
878 }
879 else if (editCommand->mCmd == EditCommandKind_InsertLine)
880 {
881 // Insert line
882 int insertPosition = GetInsertPosition(editCommand->mAIdx);
883 LineData* bLineData = &mBLineDatas[editCommand->mBIdx];
884
885 outA.insert(outA.begin() + (insertPosition + aOffset),
886 mBText.begin() + bLineData->mBufStart, mBText.begin() + bLineData->mBufStart + bLineData->mBufLength);
887 aOffset += bLineData->mBufLength;
888 }
889 else if (editCommand->mCmd == EditCommandKind_MoveLineFrom)
890 {
891 LineData* aLineDataSrc = &mALineDatas[editCommand->mAIdx];
892 editCommand->mAltParam = aLineDataSrc->mBufStart + aOffset;
893 deferredFromSources.push_back(editCmdIdx);
894 //editC
895
896 // Move line

Callers

nothing calls this directly

Calls 5

sizeMethod · 0.45
eraseMethod · 0.45
beginMethod · 0.45
push_backMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected