Sto utilizzando il metodo diff_main
della libreria DiffMatchPatch di Google per ottenere diffs che uso poi nella mia app. Consideriamo questo caso:Come rendere Google Diff Match Patch preferisci le modifiche alla fine di una stringa?
Vecchio stringa:
Tracker.Dependency.prototype.changed = function() {
for (var id in this._dependentsById)
this._dependentsById[id]._compute();
};
Nuova stringa:
Tracker.Dependency.prototype.changed = function() {
for (var id in this._dependentsById)
this._dependentsById[id]._compute();
};
Tracker.autorun = function (f) {
constructingComputation = true;
var c = new Tracker.Computation(f);
return c;
};
L'aggiunta diff che ottengo è:
;
};
Tracker.autorun = function (f) {
constructingComputation = true;
var c = new Tracker.Computation(f);
return c
considerando che sembrerebbe che per il consumo umano una differenza più ragionevole sarebbe:
Tracker.autorun = function (f) {
constructingComputation = true;
var c = new Tracker.Computation(f);
return c;
};
Esiste un modo per far sì che DiffMatchPatch produca il secondo risultato anziché il primo?
È possibile vedere un esempio qui: https://jsfiddle.net/puje78vL/1/
vuoi condividere un violino? – Siddharth
@Siddharth done –
Ci scusiamo per non aver aggiornato questo prima con ulteriori dettagli. Ero molto malato e non ho avuto il mio laptop fino ad ora. –