(refs #549) Selecting lines in diff without line numbers.

This commit is contained in:
Shintaro Murakami
2015-01-10 00:30:28 +09:00
parent 485d502bd3
commit c597238d9c
3 changed files with 33 additions and 21 deletions

View File

@@ -84,7 +84,7 @@ diffview = {
b.appendChild(document.createTextNode("+"));
b.style.display = "none";
b.className = "add-comment";
e.appendChild(b);
e.insertBefore(b, e.firstChild);
e.style.position = "relative";
return e;
}
@@ -117,9 +117,12 @@ diffview = {
* to the given row.
*/
function addCells (row, tidx, tend, textLines, change, thclass) {
var tmp;
if (tidx < tend) {
row.appendChild(addButton(ctelt("th", thclass, (tidx + 1).toString())));
row.appendChild(ctelt("td", change, textLines[tidx].replace(/\t/g, "\u00a0\u00a0\u00a0\u00a0")));
tmp = ctelt("th", thclass, "");
tmp.setAttribute("line-number", (tidx + 1).toString());
row.appendChild(tmp);
row.appendChild(addButton(ctelt("td", change, textLines[tidx].replace(/\t/g, "\u00a0\u00a0\u00a0\u00a0"))));
return tidx + 1;
} else {
row.appendChild(document.createElement("th"));
@@ -129,9 +132,13 @@ diffview = {
}
function addCellsInline (row, tidx, tidx2, textLines, change) {
row.appendChild(ctelt("th", "oldline", tidx == null ? "" : (tidx + 1).toString()));
row.appendChild(addButton(ctelt("th", "newline", tidx2 == null ? "" : (tidx2 + 1).toString())));
row.appendChild(ctelt("td", change, textLines[tidx != null ? tidx : tidx2].replace(/\t/g, "\u00a0\u00a0\u00a0\u00a0")));
var tmp = ctelt("th", "oldline", "");
tmp.setAttribute("line-number", tidx == null ? "" : (tidx + 1).toString());
row.appendChild(tmp);
tmp = ctelt("th", "newline", "");
tmp.setAttribute("line-number", tidx2 == null ? "" : (tidx2 + 1).toString());
row.appendChild(tmp);
row.appendChild(addButton(ctelt("td", change, textLines[tidx != null ? tidx : tidx2].replace(/\t/g, "\u00a0\u00a0\u00a0\u00a0"))));
}
for (var idx = 0; idx < opcodes.length; idx++) {