From f4cdb8bd19a73064e11be11d8381288a2568f9b3 Mon Sep 17 00:00:00 2001 From: "steven.guiheux" Date: Sun, 5 Jul 2026 02:49:50 +0200 Subject: [PATCH] fix(ui): allow dragging up for a multi-line comment (#13296) Close #13287 Remove the limitation that only allow dragging down Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13296 Reviewed-by: Mathieu Fenniak --- web_src/js/features/repo-issue.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/web_src/js/features/repo-issue.js b/web_src/js/features/repo-issue.js index 449ca52abc..ba252856da 100644 --- a/web_src/js/features/repo-issue.js +++ b/web_src/js/features/repo-issue.js @@ -594,14 +594,15 @@ export function initRepoPullRequestReview() { const filePath = this.closest('[data-path]')?.getAttribute('data-path'); if (filePath !== multiLineDrag.path) return; - // Only extend downward (end >= start) - if (lineNum < multiLineDrag.startIdx) return; - multiLineDrag.currentIdx = lineNum; - // Update highlight + // Update highlight; the drag can go both ways, highlightLineRange needs ordered bounds clearMultiLineSelection(); - highlightLineRange(multiLineDrag.path, multiLineDrag.side, multiLineDrag.startIdx, multiLineDrag.currentIdx); + highlightLineRange( + multiLineDrag.path, multiLineDrag.side, + Math.min(multiLineDrag.startIdx, multiLineDrag.currentIdx), + Math.max(multiLineDrag.startIdx, multiLineDrag.currentIdx), + ); }); // Mouseup: finalize multi-line selection