Source:
public void format(SparseFileContent src) { content = new SparseFileContent(); content.setSize(src.size()); trailingEdits = new HashSet<Integer>(); String html = toHTML(src); if (diffPrefs.isSyntaxHighlighting() && getFileType() != null && src.isWholeFile()) { html = html.replaceAll("&#39;", "'"); html = html.replace("\r</span>\n", "</span>\n"); html = prettify(html, getFileType()); } else { html = expandTabs(html); html = html.replaceAll("\n", "<br />"); } int pos = 0; int textChunkStart = 0; lastTag = Tag.NULL; col = 0; lineIdx = 0; buf = new StringBuilder(); while (pos <= html.length()) { int tagStart = html.indexOf('<', pos); int lf = html.indexOf('\n', pos); if (tagStart < 0 && lf < 0) { assert lastTag == Tag.NULL; pos = html.length(); if (textChunkStart < pos) { htmlText(html.substring(textChunkStart, pos)); } if (0 < buf.length()) { content.addLine(src.mapIndexToLine(lineIdx), buf.toString()); } break; } if (0 <= lf && lf < tagStart) { if (textChunkStart < lf) { lastTag.open(buf, html); htmlText(html.substring(textChunkStart, lf)); } pos = lf + 1; textChunkStart = pos; lastTag.close(buf, html); content.addLine(src.mapIndexToLine(lineIdx++), buf.toString()); buf = new StringBuilder(); col = 0; continue; } int tagEnd = html.indexOf('>', tagStart); assert tagStart < tagEnd; pos = tagEnd + 1; if (textChunkStart < tagStart) { lastTag.open(buf, html); htmlText(html.substring(textChunkStart, tagStart)); } textChunkStart = pos; if (html.charAt(tagStart + 1) == '/') { lastTag = lastTag.pop(buf, html); } else if (html.charAt(tagEnd - 1) != '/') { lastTag = new Tag(lastTag, tagStart, tagEnd); } } buf = null; }

Target:
public void format(SparseFileContent src) { content = new SparseFileContent(); content.setSize(src.size()); trailingEdits = new HashSet<Integer>(); String html = toHTML(src); if (diffPrefs.isSyntaxHighlighting() && getFileType() != null && src.isWholeFile()) { html = html.replaceAll("&#39;", "'"); html = html.replace("\r</span>\n", "</span>\n"); html = prettify(html, getFileType()); } else { html = expandTabs(html); } int pos = 0; int textChunkStart = 0; lastTag = Tag.NULL; col = 0; lineIdx = 0; buf = new StringBuilder(); while (pos <= html.length()) { int tagStart = html.indexOf('<', pos); int lf = html.indexOf('\n', pos); if (tagStart < 0 && lf < 0) { assert lastTag == Tag.NULL; pos = html.length(); if (textChunkStart < pos) { htmlText(html.substring(textChunkStart, pos)); } if (0 < buf.length()) { content.addLine(src.mapIndexToLine(lineIdx), buf.toString()); } break; } if (0 <= lf && lf < tagStart) { if (textChunkStart < lf) { lastTag.open(buf, html); htmlText(html.substring(textChunkStart, lf)); } pos = lf + 1; textChunkStart = pos; lastTag.close(buf, html); content.addLine(src.mapIndexToLine(lineIdx++), buf.toString()); buf = new StringBuilder(); col = 0; continue; } int tagEnd = html.indexOf('>', tagStart); assert tagStart < tagEnd; pos = tagEnd + 1; if (textChunkStart < tagStart) { lastTag.open(buf, html); htmlText(html.substring(textChunkStart, tagStart)); } textChunkStart = pos; if (html.charAt(tagStart + 1) == '/') { lastTag = lastTag.pop(buf, html); } else if (html.charAt(tagEnd - 1) != '/') { lastTag = new Tag(lastTag, tagStart, tagEnd); } } buf = null; }