Radish alpha
r
Radicle desktop app
Radicle
Git (anonymous pull)
Log in to clone via SSH
Fix bug where adding comment on opposite line would error
✓ CI success Rūdolfs Ošiņš committed 1 year ago
commit e427af7ed252edf633ceab890c8dc1bf3b762160
parent bb38192b7ec44ce248c5dd41f1155b5af2e9b7d6
1 passed (1 total) View logs
1 file changed +10 -8
modified src/components/Diff.svelte
@@ -141,32 +141,34 @@
    e.preventDefault();
    e.stopPropagation();

+
    const commentAnchor = determineSelectedAnchor(side, line);
+

    selection = {
      file: filePath(file, side),
-
      start: determineSelectedAnchor(side, line),
-
      end: determineSelectedAnchor(side, line),
+
      start: commentAnchor,
+
      end: commentAnchor,
      hunkIdx: hunkIdx,
      lineIdx: lineIdx,
      codeLocation: {
        commit: head,
        path: filePath(file, side),
        old:
-
          side === "left"
+
          commentAnchor.side === "left"
            ? {
                type: "lines",
                range: {
-
                  start: lineNumber(line, "left") as number,
-
                  end: (lineNumber(line, "left") as number) + 1,
+
                  start: commentAnchor.lineNumber,
+
                  end: commentAnchor.lineNumber + 1,
                },
              }
            : null,
        new:
-
          side === "right"
+
          commentAnchor.side === "right"
            ? {
                type: "lines",
                range: {
-
                  start: lineNumber(line, "right") as number,
-
                  end: (lineNumber(line, "right") as number) + 1,
+
                  start: commentAnchor.lineNumber,
+
                  end: commentAnchor.lineNumber + 1,
                },
              }
            : null,