Skip to content

Add pull request files line selections#36014

Draft
lunny wants to merge 20 commits into
go-gitea:mainfrom
lunny:lunny/add_pr_files_selection
Draft

Add pull request files line selections#36014
lunny wants to merge 20 commits into
go-gitea:mainfrom
lunny:lunny/add_pr_files_selection

Conversation

@lunny
Copy link
Copy Markdown
Member

@lunny lunny commented Nov 24, 2025

This PR allows select multiple lines on the pull request files view page.

image

@lunny lunny added this to the 1.26.0 milestone Nov 24, 2025
@lunny lunny added type/enhancement An improvement of existing functionality topic/ui Change the appearance of the Gitea UI labels Nov 24, 2025
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Nov 24, 2025
@lunny lunny marked this pull request as draft November 24, 2025 01:40
@lunny lunny marked this pull request as ready for review November 24, 2025 18:41
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Nov 25, 2025
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Nov 25, 2025
Comment thread templates/repo/diff/blob_excerpt.tmpl Outdated
Comment thread templates/repo/diff/blob_excerpt.tmpl Outdated
Comment thread web_src/js/features/repo-diff-selection.ts Outdated
Comment thread web_src/js/features/repo-diff-selection.ts Outdated
Comment thread web_src/js/features/repo-diff-selection.ts Outdated
Comment thread web_src/js/features/repo-diff-selection.ts Outdated
@wxiaoguang
Copy link
Copy Markdown
Contributor

The logic is quite complex, I would suggest to carefully review every line and make sure every line is clear. Or you can also help to answer my questions. Thank you. @lafriks @Zettat123

@wxiaoguang wxiaoguang requested a review from lafriks December 14, 2025 11:25
@GiteaBot GiteaBot removed the lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. label Dec 14, 2025
@wxiaoguang wxiaoguang requested a review from Zettat123 December 14, 2025 11:25
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Dec 14, 2025
if (e.defaultPrevented) return;
handleDiffLineNumberClick(cell, e);
});
window.addEventListener('hashchange', () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why duplicate "hashchange" listeners? Won't it conflict with window.addEventListener('hashchange', onLocationHashChange);?

Comment on lines +19 to +20
window.location.hash = '';
window.location.hash = currentHash;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think readers can understand why it needs these two lines?

When you copy code, why not also copy the comments? Or, why not introduce a common function for such requirement?

if (targetElement) {
// Try again to highlight and scroll now that the element is loaded
const success = await highlightDiffSelectionFromHash();
if (success) return;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this loop still right?

If the selected line are in the expanded area (blob excerpt), now you just keep "loading more files", but the selected range can never be really loaded.

This comment was marked as off-topic.

Copy link
Copy Markdown
Contributor

@wxiaoguang wxiaoguang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, the logic is not right.

#36014 (comment)

#36014 (comment)

#36014 (comment)

@GiteaBot GiteaBot added lgtm/blocked A maintainer has reservations with the PR and thus it cannot be merged and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jan 29, 2026
@wxiaoguang
Copy link
Copy Markdown
Contributor

@silverwind although AI reviewing is good, I believe we should make sure the code is overall correct, and the design is overall good enough and maintainable, before asking AI to review. Otherwise, it a waste of everyone's time, including AI's time.

@silverwind
Copy link
Copy Markdown
Member

Yeah sorry, just thought some more feedback may be good. This PR needs a bigger cleanup in any case, maybe I'll try later.

@bircni
Copy link
Copy Markdown
Member

bircni commented Feb 27, 2026

any plans here?

@lunny
Copy link
Copy Markdown
Member Author

lunny commented Feb 27, 2026

any plans here?

I’m currently tied up with other priorities. Would you be able to take this on?

@bircni
Copy link
Copy Markdown
Member

bircni commented Feb 27, 2026

any plans here?

I’m currently tied up with other priorities. Would you be able to take this on?

I currently have too many open PRs, I think I need to first fix them and then I can maybe have a look at it

@silverwind
Copy link
Copy Markdown
Member

This is definitely a useful feature, just needs some cleanup.

@wxiaoguang
Copy link
Copy Markdown
Contributor

This is definitely a useful feature, just needs some cleanup.

TBH, not "just needs some cleanup", the current design and implementation are problematic. It needs a new design and maybe completely rewritten.

@silverwind
Copy link
Copy Markdown
Member

Hmm yeah I'd probably start on a fresh branch on this too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/blocked A maintainer has reservations with the PR and thus it cannot be merged topic/ui Change the appearance of the Gitea UI type/enhancement An improvement of existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants