aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2021-06-03 13:10:55 +0200
committerHampusM <hampus@hampusmat.com>2021-06-03 13:10:55 +0200
commit4e3074dfd752dd52951d300090c642aee76cfaac (patch)
tree19a9cf48584123edab3dfca5b201860e99d7f711
parent5e131ddb475de7cd9821c4a0245fc5c64035a6b4 (diff)
Made patch line nr and +/- columns unselectable
-rw-r--r--src/frontend/components/CommitPatch.vue18
-rw-r--r--src/frontend/scss/style.scss4
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;
}