MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / diff_linesToChars

Method diff_linesToChars

3rdparty/diff-match-patch/diff_match_patch.cpp:501–520  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

499}
500
501QList<QVariant> diff_match_patch::diff_linesToChars(const QString &text1,
502 const QString &text2) {
503 QStringList lineArray;
504 QMap<QString, int> lineHash;
505 // e.g. linearray[4] == "Hello\n"
506 // e.g. linehash.get("Hello\n") == 4
507
508 // "\x00" is a valid character, but various debuggers don't like it.
509 // So we'll insert a junk entry to avoid generating a null character.
510 lineArray.append("");
511
512 const QString chars1 = diff_linesToCharsMunge(text1, lineArray, lineHash);
513 const QString chars2 = diff_linesToCharsMunge(text2, lineArray, lineHash);
514
515 QList<QVariant> listRet;
516 listRet.append(QVariant::fromValue(chars1));
517 listRet.append(QVariant::fromValue(chars2));
518 listRet.append(QVariant::fromValue(lineArray));
519 return listRet;
520}
521
522
523QString diff_match_patch::diff_linesToCharsMunge(const QString &text,

Callers 1

diffTextMethod · 0.80

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected