From 4e3074dfd752dd52951d300090c642aee76cfaac Mon Sep 17 00:00:00 2001 From: HampusM Date: Thu, 3 Jun 2021 13:10:55 +0200 Subject: Made patch line nr and +/- columns unselectable --- src/frontend/components/CommitPatch.vue | 18 +++++++++--------- src/frontend/scss/style.scss | 4 ++++ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/frontend/components/CommitPatch.vue b/src/frontend/components/CommitPatch.vue index 334c0ba..2c815ff 100644 --- a/src/frontend/components/CommitPatch.vue +++ b/src/frontend/components/CommitPatch.vue @@ -57,9 +57,9 @@ export default { new_offset++; deleted_offset++; return h("tr", { class: "commit-file-pos-change" }, [ - h("td", "..."), - h("td", "..."), - h("td", "..."), + h("td", { "patch-line-col-unsel": "..." }), + h("td", { "patch-line-col-unsel": "..." }), + h("td", { "patch-line-col-unsel": "..." }), h("td", [ h("code", all_hunks[hunk_index][line_index]) ]) @@ -84,19 +84,19 @@ export default { if(hunk['new'].includes(line_index)) { first_td = h("td", ""); - second_td = h("td", { class: "line-highlight-new" }, Number(hunk["new_start"]) + line_index - new_offset); - third_td = h("td", { class: "line-new" }, "+"); + second_td = h("td", { class: "line-highlight-new", "patch-line-col-unsel": Number(hunk["new_start"]) + line_index - new_offset }); + third_td = h("td", { class: "line-new", "patch-line-col-unsel": "+" }); deleted_offset++; } else if(hunk['deleted'].includes(line_index)) { - first_td = h("td", Number(hunk["old_start"]) + line_index - deleted_offset); + first_td = h("td", { "patch-line-col-unsel": Number(hunk["old_start"]) + line_index - deleted_offset }); second_td = h("td", { class: "line-highlight-deleted" }); - third_td = h("td", { class: "line-deleted" }, "-"); + third_td = h("td", { class: "line-deleted", "patch-line-col-unsel": "-" }); new_offset++; } else { - first_td = h("td", { class: "line-unchanged" }, Number(hunk["old_start"]) + line_index - deleted_offset); - second_td = h("td", { class: "line-unchanged" }, Number(hunk["new_start"]) + line_index - new_offset); + first_td = h("td", { class: "line-unchanged", "patch-line-col-unsel": Number(hunk["old_start"]) + line_index - deleted_offset }); + second_td = h("td", { class: "line-unchanged", "patch-line-col-unsel": Number(hunk["new_start"]) + line_index - new_offset }); third_td = h("td", ""); } diff --git a/src/frontend/scss/style.scss b/src/frontend/scss/style.scss index 0cc748d..8cca066 100644 --- a/src/frontend/scss/style.scss +++ b/src/frontend/scss/style.scss @@ -256,6 +256,10 @@ a { color: colors.$text-gray; } +[patch-line-col-unsel]::before { + content: attr(patch-line-col-unsel); +} + .line-highlight-new { border-right: 1px solid colors.$new; } -- cgit v1.2.3-18-g5258