Skip to content

Commit

Permalink
Fix #3180: Thread shows truncated information (#3204)
Browse files Browse the repository at this point in the history
  • Loading branch information
vivekratnavel committed Mar 7, 2022
1 parent 8c7933c commit 197b0a8
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,15 @@ private static String getPlaintextDiff(String oldValue, String newValue) {
// compute the differences
List<DiffRow> rows = generator.generateDiffRows(List.of(oldValue), List.of(newValue));

// There will be only one row of output
String diff = rows.get(0).getOldLine();
// merge rows by \n for new line
String diff = null;
for (var row : rows) {
if (diff == null) {
diff = row.getOldLine();
} else {
diff = String.format("%s\n%s", diff, row.getOldLine());
}
}

// The additions and removals will be wrapped by <!add> and <!remove> tags
// Replace them with html tags to render nicely in the UI
Expand All @@ -307,8 +314,10 @@ private static String getPlaintextDiff(String oldValue, String newValue) {
String spanAdd = "<span class=\"diff-added\">";
String spanRemove = "<span class=\"diff-removed\">";
String spanClose = "</span>";
diff = replaceWithHtml(diff, addMarker, spanAdd, spanClose);
diff = replaceWithHtml(diff, removeMarker, spanRemove, spanClose);
if (diff != null) {
diff = replaceWithHtml(diff, addMarker, spanAdd, spanClose);
diff = replaceWithHtml(diff, removeMarker, spanRemove, spanClose);
}
return diff;
}

Expand Down

0 comments on commit 197b0a8

Please sign in to comment.